| 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 "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "public/platform/WebServiceWorkerClientsInfo.h" |
| 12 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class ExecutionContext; | 17 class ExecutionContext; |
| 17 class ScriptState; | 18 class ScriptState; |
| 18 | 19 |
| 19 class ServiceWorkerClient final : public GarbageCollected<ServiceWorkerClient>,
public ScriptWrappable { | 20 class ServiceWorkerClient final : public GarbageCollectedFinalized<ServiceWorker
Client>, public ScriptWrappable { |
| 20 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
| 21 public: | 22 public: |
| 22 static ServiceWorkerClient* create(unsigned id); | 23 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); |
| 24 |
| 25 ~ServiceWorkerClient(); |
| 23 | 26 |
| 24 // ServiceWorkerClient.idl | 27 // ServiceWorkerClient.idl |
| 28 String visibilityState() const { return m_visibilityState; } |
| 29 bool focused() const { return m_isFocused; } |
| 30 String url() const { return m_url; } |
| 31 String frameType() const; |
| 25 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); | 32 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); |
| 26 ScriptPromise focus(ScriptState*); | 33 ScriptPromise focus(ScriptState*); |
| 27 | 34 |
| 28 void trace(Visitor*) { } | 35 void trace(Visitor*) { } |
| 29 | 36 |
| 30 private: | 37 private: |
| 31 explicit ServiceWorkerClient(unsigned id); | 38 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); |
| 32 | 39 |
| 33 unsigned m_id; | 40 unsigned m_id; |
| 41 String m_visibilityState; |
| 42 bool m_isFocused; |
| 43 String m_url; |
| 44 WebURLRequest::FrameType m_frameType; |
| 34 }; | 45 }; |
| 35 | 46 |
| 36 } // namespace blink | 47 } // namespace blink |
| 37 | 48 |
| 38 #endif // ServiceWorkerClient_h | 49 #endif // ServiceWorkerClient_h |
| OLD | NEW |