2009-10-16 01:57:32 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; 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/. */
|
2009-10-16 01:57:32 -07:00
|
|
|
|
|
|
|
#ifndef nsEventListenerService_h__
|
|
|
|
#define nsEventListenerService_h__
|
|
|
|
#include "nsIEventListenerService.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2009-10-17 07:40:44 -07:00
|
|
|
#include "jsapi.h"
|
2012-06-18 19:30:09 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2009-10-17 07:40:44 -07:00
|
|
|
|
2013-08-27 15:10:28 -07:00
|
|
|
namespace mozilla {
|
|
|
|
template<typename T>
|
|
|
|
class Maybe;
|
|
|
|
} // namespace mozilla
|
2009-10-16 01:57:32 -07:00
|
|
|
|
|
|
|
class nsEventListenerInfo : public nsIEventListenerInfo
|
|
|
|
{
|
|
|
|
public:
|
2013-04-16 14:15:57 -07:00
|
|
|
nsEventListenerInfo(const nsAString& aType,
|
|
|
|
already_AddRefed<nsIDOMEventListener> aListener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aCapturing, bool aAllowsUntrusted,
|
|
|
|
bool aInSystemEventGroup)
|
2009-10-16 01:57:32 -07:00
|
|
|
: mType(aType), mListener(aListener), mCapturing(aCapturing),
|
|
|
|
mAllowsUntrusted(aAllowsUntrusted),
|
|
|
|
mInSystemEventGroup(aInSystemEventGroup) {}
|
|
|
|
virtual ~nsEventListenerInfo() {}
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsEventListenerInfo)
|
|
|
|
NS_DECL_NSIEVENTLISTENERINFO
|
|
|
|
protected:
|
2013-03-16 16:39:51 -07:00
|
|
|
bool GetJSVal(JSContext* aCx, mozilla::Maybe<JSAutoCompartment>& aAc,
|
2014-01-23 11:49:40 -08:00
|
|
|
JS::MutableHandle<JS::Value> aJSVal);
|
2009-10-17 07:40:44 -07:00
|
|
|
|
2009-10-16 01:57:32 -07:00
|
|
|
nsString mType;
|
|
|
|
// nsReftPtr because that is what nsListenerStruct uses too.
|
|
|
|
nsRefPtr<nsIDOMEventListener> mListener;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCapturing;
|
|
|
|
bool mAllowsUntrusted;
|
|
|
|
bool mInSystemEventGroup;
|
2009-10-16 01:57:32 -07:00
|
|
|
};
|
|
|
|
|
2012-06-18 19:30:09 -07:00
|
|
|
class nsEventListenerService MOZ_FINAL : public nsIEventListenerService
|
2009-10-16 01:57:32 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIEVENTLISTENERSERVICE
|
|
|
|
};
|
|
|
|
#endif
|