Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef nsCommandManager_h__
8 : #define nsCommandManager_h__
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 : class nsCommandManager
22 : : public nsICommandManager
23 : , public nsPICommandUpdater
24 : , public nsSupportsWeakReference
25 : {
26 : public:
27 : typedef nsTArray<nsCOMPtr<nsIObserver> > ObserverList;
28 :
29 : nsCommandManager();
30 :
31 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 0 : NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCommandManager, nsICommandManager)
33 :
34 : NS_DECL_NSICOMMANDMANAGER
35 : NS_DECL_NSPICOMMANDUPDATER
36 :
37 : protected:
38 : virtual ~nsCommandManager();
39 :
40 : nsresult GetControllerForCommand(const char* aCommand,
41 : mozIDOMWindowProxy* aDirectedToThisWindow,
42 : nsIController** aResult);
43 :
44 : protected:
45 : nsClassHashtable<nsCharPtrHashKey, ObserverList> mObserversTable;
46 :
47 : mozIDOMWindowProxy* mWindow; // weak ptr. The window should always outlive us
48 : };
49 :
50 : #endif // nsCommandManager_h__
|