Index: Source/modules/serviceworkers/ServiceWorkerMessageEvent.h |
diff --git a/Source/modules/serviceworkers/ServiceWorkerMessageEvent.h b/Source/modules/serviceworkers/ServiceWorkerMessageEvent.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..feddb9a0aa72fed7d41ebf390cf7d3b1e7e3a130 |
--- /dev/null |
+++ b/Source/modules/serviceworkers/ServiceWorkerMessageEvent.h |
@@ -0,0 +1,73 @@ |
+// Copyright 2015 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 ServiceWorkerMessageEvent_h |
+#define ServiceWorkerMessageEvent_h |
+ |
+#include "bindings/modules/v8/UnionTypesModules.h" |
+#include "core/dom/DOMArrayBuffer.h" |
+#include "core/dom/MessagePort.h" |
+#include "modules/EventModules.h" |
+#include "modules/ModulesExport.h" |
+#include "modules/serviceworkers/ServiceWorker.h" |
+ |
+namespace blink { |
+ |
+struct ServiceWorkerMessageEventInit : public EventInit { |
+ ServiceWorkerMessageEventInit(); |
+ |
+ String origin; |
+ String lastEventId; |
+ ServiceWorkerOrMessagePort source; |
+ MessagePortArray ports; |
+}; |
+ |
+class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event { |
+ DEFINE_WRAPPERTYPEINFO(); |
+public: |
+ static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create() |
+ { |
+ return adoptRefWillBeNoop(new ServiceWorkerMessageEvent); |
+ } |
+ |
+ static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(const AtomicString& type, ServiceWorkerMessageEventInit& initializer) |
+ { |
+ return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(type, initializer)); |
+ } |
+ |
+ virtual ~ServiceWorkerMessageEvent(); |
+ |
+ void initServiceWorkerMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, const ServiceWorkerOrMessagePort& source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports); |
+ |
+ const String& origin() const { return m_origin; } |
+ const String& lastEventId() const { return m_lastEventId; } |
+ void source(ServiceWorkerOrMessagePort& result) const { result = m_source; } |
+ MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); } |
+ |
+ virtual const AtomicString& interfaceName() const override; |
+ |
+ SerializedScriptValue* serializedData() const { return m_serializedData.get(); } |
+ |
+ void setSerializedData(PassRefPtr<SerializedScriptValue> data) |
+ { |
+ ASSERT(!m_serializedData); |
+ m_serializedData = data; |
+ } |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+private: |
+ ServiceWorkerMessageEvent(); |
+ ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessageEventInit& initializer); |
+ |
+ String m_origin; |
+ String m_lastEventId; |
+ ServiceWorkerOrMessagePort m_source; |
+ RefPtr<SerializedScriptValue> m_serializedData; |
+ OwnPtrWillBeMember<MessagePortArray> m_ports; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // ServiceWorkerMessageEvent_h |