1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/document/src/nsXULCommandDispatcher.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 + 1.10 +/* 1.11 + 1.12 + This is the focus manager for XUL documents. 1.13 + 1.14 +*/ 1.15 + 1.16 +#ifndef nsXULCommandDispatcher_h__ 1.17 +#define nsXULCommandDispatcher_h__ 1.18 + 1.19 +#include "nsCOMPtr.h" 1.20 +#include "nsIDOMXULCommandDispatcher.h" 1.21 +#include "nsWeakReference.h" 1.22 +#include "nsIDOMNode.h" 1.23 +#include "nsString.h" 1.24 +#include "nsCycleCollectionParticipant.h" 1.25 + 1.26 +class nsIDOMElement; 1.27 +class nsPIWindowRoot; 1.28 + 1.29 +class nsXULCommandDispatcher : public nsIDOMXULCommandDispatcher, 1.30 + public nsSupportsWeakReference 1.31 +{ 1.32 +public: 1.33 + nsXULCommandDispatcher(nsIDocument* aDocument); 1.34 + virtual ~nsXULCommandDispatcher(); 1.35 + 1.36 + // nsISupports 1.37 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.38 + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULCommandDispatcher, 1.39 + nsIDOMXULCommandDispatcher) 1.40 + 1.41 + // nsIDOMXULCommandDispatcher interface 1.42 + NS_DECL_NSIDOMXULCOMMANDDISPATCHER 1.43 + 1.44 + void Disconnect(); 1.45 +protected: 1.46 + already_AddRefed<nsPIWindowRoot> GetWindowRoot(); 1.47 + 1.48 + nsIContent* GetRootFocusedContentAndWindow(nsPIDOMWindow** aWindow); 1.49 + 1.50 + nsCOMPtr<nsIDocument> mDocument; 1.51 + 1.52 + class Updater { 1.53 + public: 1.54 + Updater(nsIDOMElement* aElement, 1.55 + const nsAString& aEvents, 1.56 + const nsAString& aTargets) 1.57 + : mElement(aElement), 1.58 + mEvents(aEvents), 1.59 + mTargets(aTargets), 1.60 + mNext(nullptr) 1.61 + {} 1.62 + 1.63 + nsCOMPtr<nsIDOMElement> mElement; 1.64 + nsString mEvents; 1.65 + nsString mTargets; 1.66 + Updater* mNext; 1.67 + }; 1.68 + 1.69 + Updater* mUpdaters; 1.70 + 1.71 + bool Matches(const nsString& aList, 1.72 + const nsAString& aElement); 1.73 +}; 1.74 + 1.75 +#endif // nsXULCommandDispatcher_h__