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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h
diff --git a/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h b/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8c36324f42f0346a4ac6ab6f19cf48670cc470a
--- /dev/null
+++ b/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BroadcastChannel_h
+#define BroadcastChannel_h
+
+#include "bindings/core/v8/ActiveScriptWrappable.h"
+#include "components/webmessaging/broadcast_channel.mojom-blink.h"
+#include "core/dom/ActiveDOMObject.h"
+#include "core/events/EventTarget.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
+
+namespace blink {
+
+class BroadcastChannel final
+ : public EventTargetWithInlineData
+ , public ActiveScriptWrappable
+ , public ActiveDOMObject
+ , public webmessaging::mojom::blink::BroadcastChannelClient {
+ DEFINE_WRAPPERTYPEINFO();
+ USING_GARBAGE_COLLECTED_MIXIN(BroadcastChannel);
+
+public:
+ static BroadcastChannel* create(ExecutionContext*, const String& name);
+ ~BroadcastChannel() override;
+
+ // IDL
+ String name() const { return m_name; }
+ void postMessage(const ScriptValue&, ExceptionState&);
+ void close();
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
+
+ const AtomicString& interfaceName() const override;
+ ExecutionContext* getExecutionContext() const override { return ActiveDOMObject::getExecutionContext(); }
+ bool hasPendingActivity() const override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ BroadcastChannel(ExecutionContext*, const String& name);
+
+ // mojom
+ void OnMessage(const String& message) override;
+ void OnError();
+
+ String m_name;
+
+ mojo::AssociatedBinding<webmessaging::mojom::blink::BroadcastChannelClient> m_binding;
+ webmessaging::mojom::blink::BroadcastChannelClientAssociatedPtr m_remoteClient;
+};
+
+} // namespace blink
+
+#endif // BroadcastChannel_h

Powered by Google App Engine
This is Rietveld 408576698