dom/base/nsWindowRoot.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/nsWindowRoot.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsWindowRoot_h__
    1.11 +#define nsWindowRoot_h__
    1.12 +
    1.13 +class nsPIDOMWindow;
    1.14 +class nsIDOMEventListener;
    1.15 +class nsIDOMEvent;
    1.16 +
    1.17 +namespace mozilla {
    1.18 +class EventChainPostVisitor;
    1.19 +class EventChainPreVisitor;
    1.20 +} // namespace mozilla
    1.21 +
    1.22 +#include "mozilla/Attributes.h"
    1.23 +#include "mozilla/EventListenerManager.h"
    1.24 +#include "nsIDOMEventTarget.h"
    1.25 +#include "nsPIWindowRoot.h"
    1.26 +#include "nsCycleCollectionParticipant.h"
    1.27 +#include "nsAutoPtr.h"
    1.28 +
    1.29 +class nsWindowRoot : public nsPIWindowRoot
    1.30 +{
    1.31 +public:
    1.32 +  nsWindowRoot(nsPIDOMWindow* aWindow);
    1.33 +  virtual ~nsWindowRoot();
    1.34 +
    1.35 +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.36 +  NS_DECL_NSIDOMEVENTTARGET
    1.37 +
    1.38 +  virtual mozilla::EventListenerManager*
    1.39 +    GetExistingListenerManager() const MOZ_OVERRIDE;
    1.40 +  virtual mozilla::EventListenerManager*
    1.41 +    GetOrCreateListenerManager() MOZ_OVERRIDE;
    1.42 +
    1.43 +  using mozilla::dom::EventTarget::RemoveEventListener;
    1.44 +  virtual void AddEventListener(const nsAString& aType,
    1.45 +                                mozilla::dom::EventListener* aListener,
    1.46 +                                bool aUseCapture,
    1.47 +                                const mozilla::dom::Nullable<bool>& aWantsUntrusted,
    1.48 +                                mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    1.49 +
    1.50 +  // nsPIWindowRoot
    1.51 +
    1.52 +  virtual nsPIDOMWindow* GetWindow() MOZ_OVERRIDE;
    1.53 +
    1.54 +  virtual nsresult GetControllers(nsIControllers** aResult) MOZ_OVERRIDE;
    1.55 +  virtual nsresult GetControllerForCommand(const char * aCommand,
    1.56 +                                           nsIController** _retval) MOZ_OVERRIDE;
    1.57 +
    1.58 +  virtual nsIDOMNode* GetPopupNode() MOZ_OVERRIDE;
    1.59 +  virtual void SetPopupNode(nsIDOMNode* aNode) MOZ_OVERRIDE;
    1.60 +
    1.61 +  virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE
    1.62 +  {
    1.63 +    mParent = aTarget;
    1.64 +  }
    1.65 +  virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
    1.66 +  virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
    1.67 +
    1.68 +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
    1.69 +                                                         nsIDOMEventTarget)
    1.70 +
    1.71 +protected:
    1.72 +  // Members
    1.73 +  nsCOMPtr<nsPIDOMWindow> mWindow;
    1.74 +  // We own the manager, which owns event listeners attached to us.
    1.75 +  nsRefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
    1.76 +  nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
    1.77 +
    1.78 +  nsCOMPtr<mozilla::dom::EventTarget> mParent;
    1.79 +};
    1.80 +
    1.81 +extern already_AddRefed<mozilla::dom::EventTarget>
    1.82 +NS_NewWindowRoot(nsPIDOMWindow* aWindow);
    1.83 +
    1.84 +#endif

mercurial