| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ServiceWorkerClient_h | 5 #ifndef ServiceWorkerClient_h |
| 6 #define ServiceWorkerClient_h | 6 #define ServiceWorkerClient_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "bindings/core/v8/SerializedScriptValue.h" | 10 #include "bindings/core/v8/SerializedScriptValue.h" |
| 11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" | 13 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" |
| 14 #include "wtf/Forward.h" | 14 #include "wtf/Forward.h" |
| 15 #include <memory> | 15 #include <memory> |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class ExecutionContext; | |
| 20 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
| 20 class ScriptState; |
| 21 | 21 |
| 22 class MODULES_EXPORT ServiceWorkerClient | 22 class MODULES_EXPORT ServiceWorkerClient |
| 23 : public GarbageCollectedFinalized<ServiceWorkerClient>, | 23 : public GarbageCollectedFinalized<ServiceWorkerClient>, |
| 24 public ScriptWrappable { | 24 public ScriptWrappable { |
| 25 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
| 26 | 26 |
| 27 public: | 27 public: |
| 28 // To be used by CallbackPromiseAdapter. | 28 // To be used by CallbackPromiseAdapter. |
| 29 using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; | 29 using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; |
| 30 | 30 |
| 31 static ServiceWorkerClient* take(ScriptPromiseResolver*, | 31 static ServiceWorkerClient* take(ScriptPromiseResolver*, |
| 32 std::unique_ptr<WebServiceWorkerClientInfo>); | 32 std::unique_ptr<WebServiceWorkerClientInfo>); |
| 33 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); | 33 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); |
| 34 | 34 |
| 35 virtual ~ServiceWorkerClient(); | 35 virtual ~ServiceWorkerClient(); |
| 36 | 36 |
| 37 // Client.idl | 37 // Client.idl |
| 38 String url() const { return m_url; } | 38 String url() const { return m_url; } |
| 39 String frameType() const; | 39 String frameType() const; |
| 40 String id() const { return m_uuid; } | 40 String id() const { return m_uuid; } |
| 41 void postMessage(ExecutionContext*, | 41 void postMessage(ScriptState*, |
| 42 PassRefPtr<SerializedScriptValue> message, | 42 PassRefPtr<SerializedScriptValue> message, |
| 43 const MessagePortArray&, | 43 const MessagePortArray&, |
| 44 ExceptionState&); | 44 ExceptionState&); |
| 45 | 45 |
| 46 static bool canTransferArrayBuffersAndImageBitmaps() { return false; } | 46 static bool canTransferArrayBuffersAndImageBitmaps() { return false; } |
| 47 | 47 |
| 48 DEFINE_INLINE_VIRTUAL_TRACE() {} | 48 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); | 51 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); |
| 52 | 52 |
| 53 String uuid() const { return m_uuid; } | 53 String uuid() const { return m_uuid; } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 String m_uuid; | 56 String m_uuid; |
| 57 String m_url; | 57 String m_url; |
| 58 WebURLRequest::FrameType m_frameType; | 58 WebURLRequest::FrameType m_frameType; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| 62 | 62 |
| 63 #endif // ServiceWorkerClient_h | 63 #endif // ServiceWorkerClient_h |
| OLD | NEW |