Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_CellBroadcast_h__
7 #define mozilla_dom_CellBroadcast_h__
9 #include "mozilla/Attributes.h"
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/ErrorResult.h"
12 #include "nsICellBroadcastProvider.h"
13 #include "js/TypeDecls.h"
15 class nsPIDOMWindow;
17 namespace mozilla {
18 namespace dom {
20 class CellBroadcast MOZ_FINAL : public DOMEventTargetHelper
21 {
22 /**
23 * Class CellBroadcast doesn't actually inherit nsICellBroadcastListener.
24 * Instead, it owns an nsICellBroadcastListener derived instance mListener
25 * and passes it to nsICellBroadcastProvider. The onreceived events are first
26 * delivered to mListener and then forwarded to its owner, CellBroadcast. See
27 * also bug 775997 comment #51.
28 */
29 class Listener;
31 public:
32 NS_DECL_NSICELLBROADCASTLISTENER
34 NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
36 static already_AddRefed<CellBroadcast>
37 Create(nsPIDOMWindow* aOwner, ErrorResult& aRv);
39 CellBroadcast() MOZ_DELETE;
40 CellBroadcast(nsPIDOMWindow *aWindow,
41 nsICellBroadcastProvider* aProvider);
42 // MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
43 ~CellBroadcast();
45 nsPIDOMWindow*
46 GetParentObject() const { return GetOwner(); }
48 virtual JSObject*
49 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
51 IMPL_EVENT_HANDLER(received)
53 private:
54 nsCOMPtr<nsICellBroadcastProvider> mProvider;
55 nsRefPtr<Listener> mListener;
56 };
58 } // namespace dom
59 } // namespace mozilla
61 #endif /* mozilla_dom_CellBroadcast_h__ */