1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/embedding/components/commandhandler/src/nsCommandManager.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsCommandManager_h__ 1.10 +#define nsCommandManager_h__ 1.11 + 1.12 + 1.13 +#include "nsString.h" 1.14 +#include "nsClassHashtable.h" 1.15 +#include "nsWeakReference.h" 1.16 + 1.17 +#include "nsICommandManager.h" 1.18 +#include "nsPICommandUpdater.h" 1.19 +#include "nsCycleCollectionParticipant.h" 1.20 + 1.21 +class nsIController; 1.22 +template<class E> class nsCOMArray; 1.23 + 1.24 + 1.25 +class nsCommandManager : public nsICommandManager, 1.26 + public nsPICommandUpdater, 1.27 + public nsSupportsWeakReference 1.28 + 1.29 +{ 1.30 +public: 1.31 + typedef nsTArray<nsCOMPtr<nsIObserver> > ObserverList; 1.32 + 1.33 + nsCommandManager(); 1.34 + virtual ~nsCommandManager(); 1.35 + 1.36 + // nsISupports 1.37 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.38 + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCommandManager, nsICommandManager) 1.39 + 1.40 + // nsICommandManager 1.41 + NS_DECL_NSICOMMANDMANAGER 1.42 + 1.43 + // nsPICommandUpdater 1.44 + NS_DECL_NSPICOMMANDUPDATER 1.45 + 1.46 + 1.47 +protected: 1.48 + 1.49 + 1.50 + nsresult IsCallerChrome(bool *aIsCallerChrome); 1.51 + nsresult GetControllerForCommand(const char * aCommand, 1.52 + nsIDOMWindow *aDirectedToThisWindow, 1.53 + nsIController** outController); 1.54 + 1.55 + 1.56 +protected: 1.57 + nsClassHashtable<nsCharPtrHashKey, ObserverList> mObserversTable; 1.58 + 1.59 + nsIDOMWindow* mWindow; // weak ptr. The window should always outlive us 1.60 +}; 1.61 + 1.62 + 1.63 +#endif // nsCommandManager_h__