| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ServiceWorkerMessageEvent_h | |
| 6 #define ServiceWorkerMessageEvent_h | |
| 7 | |
| 8 #include "core/dom/DOMArrayBuffer.h" | |
| 9 #include "core/dom/MessagePort.h" | |
| 10 #include "modules/EventModules.h" | |
| 11 #include "modules/ModulesExport.h" | |
| 12 #include "modules/serviceworkers/ServiceWorkerMessageEventInit.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event { | |
| 17 DEFINE_WRAPPERTYPEINFO(); | |
| 18 | |
| 19 public: | |
| 20 static ServiceWorkerMessageEvent* create( | |
| 21 const AtomicString& type, | |
| 22 const ServiceWorkerMessageEventInit& initializer) { | |
| 23 return new ServiceWorkerMessageEvent(type, initializer); | |
| 24 } | |
| 25 | |
| 26 static ServiceWorkerMessageEvent* create( | |
| 27 MessagePortArray* ports, | |
| 28 PassRefPtr<SerializedScriptValue> data, | |
| 29 ServiceWorker* source, | |
| 30 const String& origin) { | |
| 31 return new ServiceWorkerMessageEvent(std::move(data), origin, String(), | |
| 32 source, ports); | |
| 33 } | |
| 34 | |
| 35 ~ServiceWorkerMessageEvent() override; | |
| 36 | |
| 37 SerializedScriptValue* serializedData() const { | |
| 38 return m_serializedData.get(); | |
| 39 } | |
| 40 void setSerializedData(PassRefPtr<SerializedScriptValue> serializedData) { | |
| 41 m_serializedData = serializedData; | |
| 42 } | |
| 43 const String& origin() const { return m_origin; } | |
| 44 const String& lastEventId() const { return m_lastEventId; } | |
| 45 MessagePortArray ports(bool& isNull) const; | |
| 46 MessagePortArray ports() const; | |
| 47 void source(ServiceWorkerOrMessagePort& result) const; | |
| 48 | |
| 49 const AtomicString& interfaceName() const override; | |
| 50 | |
| 51 DECLARE_VIRTUAL_TRACE(); | |
| 52 | |
| 53 private: | |
| 54 ServiceWorkerMessageEvent(const AtomicString& type, | |
| 55 const ServiceWorkerMessageEventInit& initializer); | |
| 56 ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, | |
| 57 const String& origin, | |
| 58 const String& lastEventId, | |
| 59 ServiceWorker* source, | |
| 60 MessagePortArray* ports); | |
| 61 | |
| 62 RefPtr<SerializedScriptValue> m_serializedData; | |
| 63 String m_origin; | |
| 64 String m_lastEventId; | |
| 65 Member<ServiceWorker> m_sourceAsServiceWorker; | |
| 66 Member<MessagePort> m_sourceAsMessagePort; | |
| 67 Member<MessagePortArray> m_ports; | |
| 68 }; | |
| 69 | |
| 70 } // namespace blink | |
| 71 | |
| 72 #endif // ServiceWorkerMessageEvent_h | |
| OLD | NEW |