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..b74768d93d7086835af405f4e1242ee94101a108 |
--- /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 "core/dom/ActiveDOMObject.h" |
+#include "core/events/EventTarget.h" |
+#include "modules/broadcastchannel/BroadcastChannelConnection.h" |
+#include "platform/weborigin/SecurityOrigin.h" |
+ |
+namespace blink { |
+ |
+class BroadcastChannel final |
+ : public EventTargetWithInlineData |
+ , public ActiveScriptWrappable |
+ , public ActiveDOMObject |
haraken
2016/06/02 04:23:41
ActiveDOMObject => ContextLifecycleObserver
If yo
Marijn Kruisselbrink
2016/06/02 18:33:29
Done
|
+ , public BroadcastChannelConnection::Client { |
+ DEFINE_WRAPPERTYPEINFO(); |
+ USING_GARBAGE_COLLECTED_MIXIN(BroadcastChannel); |
+ WTF_MAKE_NONCOPYABLE(BroadcastChannel); |
+public: |
+ static BroadcastChannel* create(ExecutionContext*, const String& name, ExceptionState&); |
+ ~BroadcastChannel() override; |
+ |
+ // IDL |
+ void postMessage(const ScriptValue&, ExceptionState&); |
+ void close(); |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
+ |
+ // BroadcastChannelConnection::Client |
+ String name() const override { return m_name; } |
+ SecurityOrigin* origin() const override { return m_origin.get(); } |
+ void onMessage(const String& message) override; |
+ void onError() override; |
+ |
+ 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); |
+ |
+ RefPtr<SecurityOrigin> m_origin; |
+ String m_name; |
+ BroadcastChannelConnection* m_connection; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // BroadcastChannel_h |