2000-11-04 11:21:20 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04: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/. */
|
2000-11-04 11:21:20 +03:00
|
|
|
|
|
|
|
#ifndef nsWindowRoot_h__
|
|
|
|
#define nsWindowRoot_h__
|
|
|
|
|
2010-02-20 19:07:03 +03:00
|
|
|
class nsPIDOMWindow;
|
2000-11-04 11:21:20 +03:00
|
|
|
class nsIDOMEventListener;
|
|
|
|
class nsIDOMEvent;
|
2014-10-18 03:05:16 +04:00
|
|
|
class nsIGlobalObject;
|
2000-11-04 11:21:20 +03:00
|
|
|
|
2014-03-18 08:48:19 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:20 +04:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-17 10:56:53 +04:00
|
|
|
#include "mozilla/EventListenerManager.h"
|
2007-05-14 13:11:38 +04:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2000-11-04 11:21:20 +03:00
|
|
|
#include "nsPIWindowRoot.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2013-10-24 22:53:52 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2014-12-09 18:48:27 +03:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2000-11-04 11:21:20 +03:00
|
|
|
|
2011-06-24 06:18:02 +04:00
|
|
|
class nsWindowRoot : public nsPIWindowRoot
|
2000-11-04 11:21:20 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsWindowRoot(nsPIDOMWindow* aWindow);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
|
2007-01-05 01:31:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager*
|
|
|
|
GetExistingListenerManager() const MOZ_OVERRIDE;
|
|
|
|
virtual mozilla::EventListenerManager*
|
|
|
|
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2013-04-17 01:16:08 +04:00
|
|
|
using mozilla::dom::EventTarget::RemoveEventListener;
|
|
|
|
virtual void AddEventListener(const nsAString& aType,
|
2013-09-24 04:25:17 +04:00
|
|
|
mozilla::dom::EventListener* aListener,
|
2013-04-17 01:16:08 +04:00
|
|
|
bool aUseCapture,
|
|
|
|
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
|
|
|
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
2007-02-16 02:04:33 +03:00
|
|
|
|
2000-11-04 11:21:20 +03:00
|
|
|
// nsPIWindowRoot
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
virtual nsPIDOMWindow* GetWindow() MOZ_OVERRIDE;
|
2010-02-20 19:07:03 +03:00
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
virtual nsresult GetControllers(nsIControllers** aResult) MOZ_OVERRIDE;
|
2010-02-20 19:07:03 +03:00
|
|
|
virtual nsresult GetControllerForCommand(const char * aCommand,
|
2013-06-05 20:15:48 +04:00
|
|
|
nsIController** _retval) MOZ_OVERRIDE;
|
2010-02-20 19:07:03 +03:00
|
|
|
|
2014-12-09 18:48:27 +03:00
|
|
|
virtual void GetEnabledDisabledCommands(nsTArray<nsCString>& aEnabledCommands,
|
|
|
|
nsTArray<nsCString>& aDisabledCommands) MOZ_OVERRIDE;
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
virtual nsIDOMNode* GetPopupNode() MOZ_OVERRIDE;
|
|
|
|
virtual void SetPopupNode(nsIDOMNode* aNode) MOZ_OVERRIDE;
|
2007-07-06 17:47:50 +04:00
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
|
|
|
mParent = aTarget;
|
|
|
|
}
|
2013-06-05 20:15:48 +04:00
|
|
|
virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
|
2013-05-31 01:46:39 +04:00
|
|
|
virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2014-10-18 03:05:16 +04:00
|
|
|
nsIGlobalObject* GetParentObject();
|
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2014-10-07 13:44:48 +04:00
|
|
|
|
2013-01-29 17:44:01 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
|
|
|
|
nsIDOMEventTarget)
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2000-11-04 11:21:20 +03:00
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsWindowRoot();
|
|
|
|
|
2014-12-09 18:48:27 +03:00
|
|
|
void GetEnabledDisabledCommandsForControllers(nsIControllers* aControllers,
|
|
|
|
nsTHashtable<nsCharPtrHashKey>& aCommandsHandled,
|
|
|
|
nsTArray<nsCString>& aEnabledCommands,
|
|
|
|
nsTArray<nsCString>& aDisabledCommands);
|
|
|
|
|
2000-11-04 11:21:20 +03:00
|
|
|
// Members
|
2013-08-08 22:23:55 +04:00
|
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
2014-03-17 10:56:53 +04:00
|
|
|
// We own the manager, which owns event listeners attached to us.
|
|
|
|
nsRefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
|
2010-02-20 19:07:03 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParent;
|
2000-11-04 11:21:20 +03:00
|
|
|
};
|
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
extern already_AddRefed<mozilla::dom::EventTarget>
|
|
|
|
NS_NewWindowRoot(nsPIDOMWindow* aWindow);
|
2000-11-04 11:21:20 +03:00
|
|
|
|
|
|
|
#endif
|