| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ServiceWorkerMessageEvent_h | 5 #ifndef ServiceWorkerMessageEvent_h |
| 6 #define ServiceWorkerMessageEvent_h | 6 #define ServiceWorkerMessageEvent_h |
| 7 | 7 |
| 8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
| 9 #include "core/dom/MessagePort.h" | 9 #include "core/dom/MessagePort.h" |
| 10 #include "modules/EventModules.h" | 10 #include "modules/EventModules.h" |
| 11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
| 12 #include "modules/serviceworkers/ServiceWorkerMessageEventInit.h" | 12 #include "modules/serviceworkers/ServiceWorkerMessageEventInit.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event { | 16 class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event { |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 public: | 18 public: |
| 19 static ServiceWorkerMessageEvent* create() | |
| 20 { | |
| 21 return new ServiceWorkerMessageEvent; | |
| 22 } | |
| 23 | |
| 24 static ServiceWorkerMessageEvent* create(const AtomicString& type, const Ser
viceWorkerMessageEventInit& initializer) | 19 static ServiceWorkerMessageEvent* create(const AtomicString& type, const Ser
viceWorkerMessageEventInit& initializer) |
| 25 { | 20 { |
| 26 return new ServiceWorkerMessageEvent(type, initializer); | 21 return new ServiceWorkerMessageEvent(type, initializer); |
| 27 } | 22 } |
| 28 | 23 |
| 29 static ServiceWorkerMessageEvent* create(MessagePortArray* ports, PassRefPtr
<SerializedScriptValue> data, ServiceWorker* source, const String& origin) | 24 static ServiceWorkerMessageEvent* create(MessagePortArray* ports, PassRefPtr
<SerializedScriptValue> data, ServiceWorker* source, const String& origin) |
| 30 { | 25 { |
| 31 return new ServiceWorkerMessageEvent(data, origin, String(), source, por
ts); | 26 return new ServiceWorkerMessageEvent(data, origin, String(), source, por
ts); |
| 32 } | 27 } |
| 33 | 28 |
| 34 ~ServiceWorkerMessageEvent() override; | 29 ~ServiceWorkerMessageEvent() override; |
| 35 | 30 |
| 36 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } | 31 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } |
| 37 void setSerializedData(PassRefPtr<SerializedScriptValue> serializedData) { m
_serializedData = serializedData; } | 32 void setSerializedData(PassRefPtr<SerializedScriptValue> serializedData) { m
_serializedData = serializedData; } |
| 38 const String& origin() const { return m_origin; } | 33 const String& origin() const { return m_origin; } |
| 39 const String& lastEventId() const { return m_lastEventId; } | 34 const String& lastEventId() const { return m_lastEventId; } |
| 40 MessagePortArray ports(bool& isNull) const; | 35 MessagePortArray ports(bool& isNull) const; |
| 41 MessagePortArray ports() const; | 36 MessagePortArray ports() const; |
| 42 void source(ServiceWorkerOrMessagePort& result) const; | 37 void source(ServiceWorkerOrMessagePort& result) const; |
| 43 | 38 |
| 44 const AtomicString& interfaceName() const override; | 39 const AtomicString& interfaceName() const override; |
| 45 | 40 |
| 46 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
| 47 | 42 |
| 48 private: | 43 private: |
| 49 ServiceWorkerMessageEvent(); | |
| 50 ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessa
geEventInit& initializer); | 44 ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessa
geEventInit& initializer); |
| 51 ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, const Stri
ng& origin, const String& lastEventId, ServiceWorker* source, MessagePortArray*
ports); | 45 ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, const Stri
ng& origin, const String& lastEventId, ServiceWorker* source, MessagePortArray*
ports); |
| 52 | 46 |
| 53 RefPtr<SerializedScriptValue> m_serializedData; | 47 RefPtr<SerializedScriptValue> m_serializedData; |
| 54 String m_origin; | 48 String m_origin; |
| 55 String m_lastEventId; | 49 String m_lastEventId; |
| 56 Member<ServiceWorker> m_sourceAsServiceWorker; | 50 Member<ServiceWorker> m_sourceAsServiceWorker; |
| 57 Member<MessagePort> m_sourceAsMessagePort; | 51 Member<MessagePort> m_sourceAsMessagePort; |
| 58 Member<MessagePortArray> m_ports; | 52 Member<MessagePortArray> m_ports; |
| 59 }; | 53 }; |
| 60 | 54 |
| 61 } // namespace blink | 55 } // namespace blink |
| 62 | 56 |
| 63 #endif // ServiceWorkerMessageEvent_h | 57 #endif // ServiceWorkerMessageEvent_h |
| OLD | NEW |