|
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 : public nsIRDFDataSource, |
|
24 public nsIObserver, |
|
25 public nsIWindowMediatorListener, |
|
26 public nsIWindowDataSource |
|
27 { |
|
28 public: |
|
29 nsWindowDataSource() { } |
|
30 virtual ~nsWindowDataSource(); |
|
31 |
|
32 nsresult Init(); |
|
33 |
|
34 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
35 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowDataSource, |
|
36 nsIRDFDataSource) |
|
37 NS_DECL_NSIOBSERVER |
|
38 NS_DECL_NSIWINDOWMEDIATORLISTENER |
|
39 NS_DECL_NSIWINDOWDATASOURCE |
|
40 NS_DECL_NSIRDFDATASOURCE |
|
41 |
|
42 private: |
|
43 |
|
44 // mapping of window -> RDF resource |
|
45 nsInterfaceHashtable<nsPtrHashKey<nsIXULWindow>, nsIRDFResource> mWindowResources; |
|
46 |
|
47 static uint32_t windowCount; |
|
48 static uint32_t gRefCnt; |
|
49 |
|
50 nsCOMPtr<nsIRDFDataSource> mInner; |
|
51 nsCOMPtr<nsIRDFContainer> mContainer; |
|
52 |
|
53 static nsIRDFResource* kNC_Name; |
|
54 static nsIRDFResource* kNC_KeyIndex; |
|
55 static nsIRDFResource* kNC_WindowRoot; |
|
56 static nsIRDFService* gRDFService; |
|
57 }; |