2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsWindowRoot_h__
|
|
|
|
#define nsWindowRoot_h__
|
|
|
|
|
2010-02-20 08:07:03 -08:00
|
|
|
class nsPIDOMWindow;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIDOMEventListener;
|
2011-06-23 19:18:01 -07:00
|
|
|
class nsEventListenerManager;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIDOMEvent;
|
|
|
|
class nsEventChainPreVisitor;
|
|
|
|
class nsEventChainPostVisitor;
|
|
|
|
|
2007-05-14 02:11:38 -07:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2011-06-23 19:18:01 -07:00
|
|
|
#include "nsEventListenerManager.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsPIWindowRoot.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
|
2011-06-23 19:18:02 -07:00
|
|
|
class nsWindowRoot : public nsPIWindowRoot
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-02-20 08:07:03 -08:00
|
|
|
nsWindowRoot(nsPIDOMWindow* aWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~nsWindowRoot();
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
2013-04-16 14:16:08 -07:00
|
|
|
using mozilla::dom::EventTarget::RemoveEventListener;
|
|
|
|
virtual void AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
|
|
|
bool aUseCapture,
|
|
|
|
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
|
|
|
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsPIWindowRoot
|
|
|
|
|
2010-02-20 08:07:03 -08:00
|
|
|
virtual nsPIDOMWindow* GetWindow();
|
|
|
|
|
|
|
|
virtual nsresult GetControllers(nsIControllers** aResult);
|
|
|
|
virtual nsresult GetControllerForCommand(const char * aCommand,
|
|
|
|
nsIController** _retval);
|
|
|
|
|
2010-08-09 09:17:19 -07:00
|
|
|
virtual nsIDOMNode* GetPopupNode();
|
2010-02-20 08:07:03 -08:00
|
|
|
virtual void SetPopupNode(nsIDOMNode* aNode);
|
2007-07-06 06:47:50 -07:00
|
|
|
|
2013-04-05 17:44:15 -07:00
|
|
|
virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget)
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
|
|
|
mParent = aTarget;
|
|
|
|
}
|
2013-04-05 17:44:15 -07:00
|
|
|
virtual mozilla::dom::EventTarget* GetParentTarget() { return mParent; }
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2013-01-29 05:44:01 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
|
|
|
|
nsIDOMEventTarget)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Members
|
2010-02-20 08:07:03 -08:00
|
|
|
nsPIDOMWindow* mWindow; // [Weak]. The window will hold on to us and let go when it dies.
|
2011-06-23 19:18:01 -07:00
|
|
|
nsRefPtr<nsEventListenerManager> mListenerManager; // [Strong]. We own the manager, which owns event listeners attached
|
2007-03-22 10:30:00 -07:00
|
|
|
// to us.
|
2010-02-20 08:07:03 -08:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2013-04-05 17:44:15 -07:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParent;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-04-05 17:44:15 -07:00
|
|
|
extern already_AddRefed<mozilla::dom::EventTarget>
|
|
|
|
NS_NewWindowRoot(nsPIDOMWindow* aWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#endif
|