dom/cellbroadcast/src/CellBroadcast.h

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:392d056add7c
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/. */
5
6 #ifndef mozilla_dom_CellBroadcast_h__
7 #define mozilla_dom_CellBroadcast_h__
8
9 #include "mozilla/Attributes.h"
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/ErrorResult.h"
12 #include "nsICellBroadcastProvider.h"
13 #include "js/TypeDecls.h"
14
15 class nsPIDOMWindow;
16
17 namespace mozilla {
18 namespace dom {
19
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;
30
31 public:
32 NS_DECL_NSICELLBROADCASTLISTENER
33
34 NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
35
36 static already_AddRefed<CellBroadcast>
37 Create(nsPIDOMWindow* aOwner, ErrorResult& aRv);
38
39 CellBroadcast() MOZ_DELETE;
40 CellBroadcast(nsPIDOMWindow *aWindow,
41 nsICellBroadcastProvider* aProvider);
42 // MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
43 ~CellBroadcast();
44
45 nsPIDOMWindow*
46 GetParentObject() const { return GetOwner(); }
47
48 virtual JSObject*
49 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
50
51 IMPL_EVENT_HANDLER(received)
52
53 private:
54 nsCOMPtr<nsICellBroadcastProvider> mProvider;
55 nsRefPtr<Listener> mListener;
56 };
57
58 } // namespace dom
59 } // namespace mozilla
60
61 #endif /* mozilla_dom_CellBroadcast_h__ */

mercurial