Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h

Issue 2004643002: Implement BroadcastChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BroadcastChannel_h
6 #define BroadcastChannel_h
7
8 #include "bindings/core/v8/ActiveScriptWrappable.h"
9 #include "components/webmessaging/broadcast_channel.mojom-blink.h"
10 #include "core/dom/ActiveDOMObject.h"
11 #include "core/events/EventTarget.h"
12 #include "mojo/public/cpp/bindings/associated_binding.h"
13
14 namespace blink {
15
16 class BroadcastChannel final
17 : public EventTargetWithInlineData
18 , public ActiveScriptWrappable
19 , public ActiveDOMObject
20 , public webmessaging::mojom::blink::BroadcastChannelClient {
21 DEFINE_WRAPPERTYPEINFO();
22 USING_GARBAGE_COLLECTED_MIXIN(BroadcastChannel);
23
24 public:
25 static BroadcastChannel* create(ExecutionContext*, const String& name);
26 ~BroadcastChannel() override;
27
28 // IDL
29 String name() const { return m_name; }
30 void postMessage(const ScriptValue&, ExceptionState&);
31 void close();
32 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
33
34 const AtomicString& interfaceName() const override;
35 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); }
36 bool hasPendingActivity() const override;
37
38 DECLARE_VIRTUAL_TRACE();
39
40 private:
41 BroadcastChannel(ExecutionContext*, const String& name);
42
43 // mojom
44 void OnMessage(const String& message) override;
45 void OnError();
46
47 String m_name;
48
49 mojo::AssociatedBinding<webmessaging::mojom::blink::BroadcastChannelClient> m_binding;
50 webmessaging::mojom::blink::BroadcastChannelClientAssociatedPtr m_remoteClie nt;
51 };
52
53 } // namespace blink
54
55 #endif // BroadcastChannel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698