|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
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 #ifndef nsCommandManager_h__ |
|
7 #define nsCommandManager_h__ |
|
8 |
|
9 |
|
10 #include "nsString.h" |
|
11 #include "nsClassHashtable.h" |
|
12 #include "nsWeakReference.h" |
|
13 |
|
14 #include "nsICommandManager.h" |
|
15 #include "nsPICommandUpdater.h" |
|
16 #include "nsCycleCollectionParticipant.h" |
|
17 |
|
18 class nsIController; |
|
19 template<class E> class nsCOMArray; |
|
20 |
|
21 |
|
22 class nsCommandManager : public nsICommandManager, |
|
23 public nsPICommandUpdater, |
|
24 public nsSupportsWeakReference |
|
25 |
|
26 { |
|
27 public: |
|
28 typedef nsTArray<nsCOMPtr<nsIObserver> > ObserverList; |
|
29 |
|
30 nsCommandManager(); |
|
31 virtual ~nsCommandManager(); |
|
32 |
|
33 // nsISupports |
|
34 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
35 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCommandManager, nsICommandManager) |
|
36 |
|
37 // nsICommandManager |
|
38 NS_DECL_NSICOMMANDMANAGER |
|
39 |
|
40 // nsPICommandUpdater |
|
41 NS_DECL_NSPICOMMANDUPDATER |
|
42 |
|
43 |
|
44 protected: |
|
45 |
|
46 |
|
47 nsresult IsCallerChrome(bool *aIsCallerChrome); |
|
48 nsresult GetControllerForCommand(const char * aCommand, |
|
49 nsIDOMWindow *aDirectedToThisWindow, |
|
50 nsIController** outController); |
|
51 |
|
52 |
|
53 protected: |
|
54 nsClassHashtable<nsCharPtrHashKey, ObserverList> mObserversTable; |
|
55 |
|
56 nsIDOMWindow* mWindow; // weak ptr. The window should always outlive us |
|
57 }; |
|
58 |
|
59 |
|
60 #endif // nsCommandManager_h__ |