/src/mozilla-central/dom/xul/nsXULControllers.h
Line | Count | Source (jump to first uncovered line) |
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 | | /* |
7 | | |
8 | | The XUL "controllers" object. |
9 | | |
10 | | */ |
11 | | |
12 | | #ifndef nsXULControllers_h__ |
13 | | #define nsXULControllers_h__ |
14 | | |
15 | | #include "nsCOMPtr.h" |
16 | | #include "nsTArray.h" |
17 | | #include "nsWeakPtr.h" |
18 | | #include "nsIControllers.h" |
19 | | #include "nsCycleCollectionParticipant.h" |
20 | | |
21 | | /* non-XPCOM class for holding controllers and their IDs */ |
22 | | class nsXULControllerData final |
23 | | { |
24 | | public: |
25 | | nsXULControllerData(uint32_t inControllerID, nsIController* inController) |
26 | | : mControllerID(inControllerID) |
27 | | , mController(inController) |
28 | 0 | { |
29 | 0 | } |
30 | | |
31 | 0 | ~nsXULControllerData() {} |
32 | | |
33 | 0 | uint32_t GetControllerID() { return mControllerID; } |
34 | | |
35 | | nsresult GetController(nsIController **outController) |
36 | 0 | { |
37 | 0 | NS_IF_ADDREF(*outController = mController); |
38 | 0 | return NS_OK; |
39 | 0 | } |
40 | | |
41 | | uint32_t mControllerID; |
42 | | nsCOMPtr<nsIController> mController; |
43 | | }; |
44 | | |
45 | | class nsXULControllers final : public nsIControllers |
46 | | { |
47 | | public: |
48 | | nsXULControllers(); |
49 | | |
50 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
51 | | NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULControllers, nsIControllers) |
52 | | NS_DECL_NSICONTROLLERS |
53 | | |
54 | | protected: |
55 | | virtual ~nsXULControllers(void); |
56 | | |
57 | | void DeleteControllers(); |
58 | | |
59 | | nsTArray<nsXULControllerData*> mControllers; |
60 | | uint32_t mCurControllerID; |
61 | | }; |
62 | | |
63 | | |
64 | | |
65 | | |
66 | | #endif // nsXULControllers_h__ |