OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BroadcastChannel_h | 5 #ifndef BroadcastChannel_h |
6 #define BroadcastChannel_h | 6 #define BroadcastChannel_h |
7 | 7 |
8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
9 #include "components/webmessaging/public/interfaces/broadcast_channel.mojom-blin
k.h" | |
10 #include "core/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
11 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
12 #include "mojo/public/cpp/bindings/associated_binding.h" | 11 #include "mojo/public/cpp/bindings/associated_binding.h" |
13 #include "platform/weborigin/SecurityOrigin.h" | 12 #include "platform/weborigin/SecurityOrigin.h" |
| 13 #include "third_party/WebKit/public/platform/modules/broadcastchannel/broadcast_
channel.mojom-blink.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class BroadcastChannel final | 17 class BroadcastChannel final |
18 : public EventTargetWithInlineData | 18 : public EventTargetWithInlineData |
19 , public ActiveScriptWrappable | 19 , public ActiveScriptWrappable |
20 , public ContextLifecycleObserver | 20 , public ContextLifecycleObserver |
21 , public webmessaging::mojom::blink::BroadcastChannelClient { | 21 , public mojom::blink::BroadcastChannelClient { |
22 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
23 USING_GARBAGE_COLLECTED_MIXIN(BroadcastChannel); | 23 USING_GARBAGE_COLLECTED_MIXIN(BroadcastChannel); |
24 USING_PRE_FINALIZER(BroadcastChannel, dispose); | 24 USING_PRE_FINALIZER(BroadcastChannel, dispose); |
25 WTF_MAKE_NONCOPYABLE(BroadcastChannel); | 25 WTF_MAKE_NONCOPYABLE(BroadcastChannel); |
26 public: | 26 public: |
27 static BroadcastChannel* create(ExecutionContext*, const String& name, Excep
tionState&); | 27 static BroadcastChannel* create(ExecutionContext*, const String& name, Excep
tionState&); |
28 ~BroadcastChannel() override; | 28 ~BroadcastChannel() override; |
29 void dispose(); | 29 void dispose(); |
30 | 30 |
31 // IDL | 31 // IDL |
(...skipping 10 matching lines...) Expand all Loading... |
42 bool hasPendingActivity() const override; | 42 bool hasPendingActivity() const override; |
43 | 43 |
44 // ContextLifecycleObserver: | 44 // ContextLifecycleObserver: |
45 void contextDestroyed() override; | 45 void contextDestroyed() override; |
46 | 46 |
47 DECLARE_VIRTUAL_TRACE(); | 47 DECLARE_VIRTUAL_TRACE(); |
48 | 48 |
49 private: | 49 private: |
50 BroadcastChannel(ExecutionContext*, const String& name); | 50 BroadcastChannel(ExecutionContext*, const String& name); |
51 | 51 |
52 // webmessaging::mojom::blink::BroadcastChannelClient: | 52 // mojom::blink::BroadcastChannelClient: |
53 void OnMessage(const String& message) override; | 53 void OnMessage(const String& message) override; |
54 | 54 |
55 // Called when the mojo binding disconnects. | 55 // Called when the mojo binding disconnects. |
56 void onError(); | 56 void onError(); |
57 | 57 |
58 RefPtr<SecurityOrigin> m_origin; | 58 RefPtr<SecurityOrigin> m_origin; |
59 String m_name; | 59 String m_name; |
60 | 60 |
61 mojo::AssociatedBinding<webmessaging::mojom::blink::BroadcastChannelClient>
m_binding; | 61 mojo::AssociatedBinding<mojom::blink::BroadcastChannelClient> m_binding; |
62 webmessaging::mojom::blink::BroadcastChannelClientAssociatedPtr m_remoteClie
nt; | 62 mojom::blink::BroadcastChannelClientAssociatedPtr m_remoteClient; |
63 }; | 63 }; |
64 | 64 |
65 } // namespace blink | 65 } // namespace blink |
66 | 66 |
67 #endif // BroadcastChannel_h | 67 #endif // BroadcastChannel_h |
OLD | NEW |