| 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..0fe719b695dd5f247244d159149378b5feafb13a
|
| --- /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/ContextLifecycleObserver.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 ContextLifecycleObserver
|
| + , 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 ContextLifecycleObserver::getExecutionContext(); }
|
| + bool hasPendingActivity() const override;
|
| +
|
| + DECLARE_VIRTUAL_TRACE();
|
| +
|
| +private:
|
| + BroadcastChannel(ExecutionContext*, const String& name);
|
| +
|
| + RefPtr<SecurityOrigin> m_origin;
|
| + String m_name;
|
| + Member<BroadcastChannelConnection> m_connection;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // BroadcastChannel_h
|
|
|