1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/events/EventListenerService.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 +#ifndef mozilla_EventListenerService_h_ 1.10 +#define mozilla_EventListenerService_h_ 1.11 + 1.12 +#include "jsapi.h" 1.13 +#include "mozilla/Attributes.h" 1.14 +#include "nsAutoPtr.h" 1.15 +#include "nsCycleCollectionParticipant.h" 1.16 +#include "nsIDOMEventListener.h" 1.17 +#include "nsIEventListenerService.h" 1.18 +#include "nsString.h" 1.19 + 1.20 +namespace mozilla { 1.21 + 1.22 +template<typename T> 1.23 +class Maybe; 1.24 + 1.25 +class EventListenerInfo MOZ_FINAL : public nsIEventListenerInfo 1.26 +{ 1.27 +public: 1.28 + EventListenerInfo(const nsAString& aType, 1.29 + already_AddRefed<nsIDOMEventListener> aListener, 1.30 + bool aCapturing, 1.31 + bool aAllowsUntrusted, 1.32 + bool aInSystemEventGroup) 1.33 + : mType(aType) 1.34 + , mListener(aListener) 1.35 + , mCapturing(aCapturing) 1.36 + , mAllowsUntrusted(aAllowsUntrusted) 1.37 + , mInSystemEventGroup(aInSystemEventGroup) 1.38 + { 1.39 + } 1.40 + 1.41 + virtual ~EventListenerInfo() {} 1.42 + 1.43 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.44 + NS_DECL_CYCLE_COLLECTION_CLASS(EventListenerInfo) 1.45 + NS_DECL_NSIEVENTLISTENERINFO 1.46 + 1.47 +protected: 1.48 + bool GetJSVal(JSContext* aCx, 1.49 + Maybe<JSAutoCompartment>& aAc, 1.50 + JS::MutableHandle<JS::Value> aJSVal); 1.51 + 1.52 + nsString mType; 1.53 + // nsReftPtr because that is what nsListenerStruct uses too. 1.54 + nsRefPtr<nsIDOMEventListener> mListener; 1.55 + bool mCapturing; 1.56 + bool mAllowsUntrusted; 1.57 + bool mInSystemEventGroup; 1.58 +}; 1.59 + 1.60 +class EventListenerService MOZ_FINAL : public nsIEventListenerService 1.61 +{ 1.62 +public: 1.63 + NS_DECL_ISUPPORTS 1.64 + NS_DECL_NSIEVENTLISTENERSERVICE 1.65 +}; 1.66 + 1.67 +} // namespace mozilla 1.68 + 1.69 +#endif // mozilla_EventListenerService_h_