Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "nsIRDFDataSource.h"
7 : #include "nsIWindowMediatorListener.h"
8 : #include "nsIWindowDataSource.h"
9 : #include "nsIObserver.h"
10 :
11 : #include "nsHashKeys.h"
12 : #include "nsIRDFService.h"
13 : #include "nsIRDFContainer.h"
14 : #include "nsInterfaceHashtable.h"
15 : #include "nsCycleCollectionParticipant.h"
16 :
17 : // {C744CA3D-840B-460a-8D70-7CE63C51C958}
18 : #define NS_WINDOWDATASOURCE_CID \
19 : { 0xc744ca3d, 0x840b, 0x460a, \
20 : { 0x8d, 0x70, 0x7c, 0xe6, 0x3c, 0x51, 0xc9, 0x58 } }
21 :
22 :
23 : class nsWindowDataSource final : public nsIRDFDataSource,
24 : public nsIObserver,
25 : public nsIWindowMediatorListener,
26 : public nsIWindowDataSource
27 : {
28 : public:
29 3 : nsWindowDataSource() { }
30 :
31 : nsresult Init();
32 :
33 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34 45 : NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowDataSource,
35 : nsIRDFDataSource)
36 : NS_DECL_NSIOBSERVER
37 : NS_DECL_NSIWINDOWMEDIATORLISTENER
38 : NS_DECL_NSIWINDOWDATASOURCE
39 : NS_DECL_NSIRDFDATASOURCE
40 :
41 : protected:
42 : virtual ~nsWindowDataSource();
43 :
44 : private:
45 :
46 : // mapping of window -> RDF resource
47 : nsInterfaceHashtable<nsPtrHashKey<nsIXULWindow>, nsIRDFResource> mWindowResources;
48 :
49 : static uint32_t windowCount;
50 : static uint32_t gRefCnt;
51 :
52 : nsCOMPtr<nsIRDFDataSource> mInner;
53 : nsCOMPtr<nsIRDFContainer> mContainer;
54 :
55 : static nsIRDFResource* kNC_Name;
56 : static nsIRDFResource* kNC_KeyIndex;
57 : static nsIRDFResource* kNC_WindowRoot;
58 : static nsIRDFService* gRDFService;
59 : };
|