| 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 ServiceWorkerWindowClient_h | 5 #ifndef ServiceWorkerWindowClient_h |
| 6 #define ServiceWorkerWindowClient_h | 6 #define ServiceWorkerWindowClient_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "modules/serviceworkers/ServiceWorkerClient.h" | 10 #include "modules/serviceworkers/ServiceWorkerClient.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "wtf/Forward.h" | 12 #include "wtf/Forward.h" |
| 13 #include "wtf/OwnPtr.h" |
| 13 #include "wtf/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class ScriptPromiseResolver; | 18 class ScriptPromiseResolver; |
| 18 class ScriptState; | 19 class ScriptState; |
| 19 | 20 |
| 20 class MODULES_EXPORT ServiceWorkerWindowClient final : public ServiceWorkerClien
t { | 21 class MODULES_EXPORT ServiceWorkerWindowClient final : public ServiceWorkerClien
t { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: | 23 public: |
| 23 // To be used by CallbackPromiseAdapter. | 24 // To be used by CallbackPromiseAdapter. |
| 24 typedef WebServiceWorkerClientInfo WebType; | 25 using WebType = OwnPtr<WebServiceWorkerClientInfo>; |
| 25 | 26 |
| 26 static ServiceWorkerWindowClient* take(ScriptPromiseResolver*, PassOwnPtr<We
bType>); | 27 static ServiceWorkerWindowClient* take(ScriptPromiseResolver*, PassOwnPtr<We
bServiceWorkerClientInfo>); |
| 27 | 28 |
| 28 static ServiceWorkerWindowClient* create(const WebServiceWorkerClientInfo&); | 29 static ServiceWorkerWindowClient* create(const WebServiceWorkerClientInfo&); |
| 29 ~ServiceWorkerWindowClient() override; | 30 ~ServiceWorkerWindowClient() override; |
| 30 | 31 |
| 31 // WindowClient.idl | 32 // WindowClient.idl |
| 32 String visibilityState() const; | 33 String visibilityState() const; |
| 33 bool focused() const { return m_isFocused; } | 34 bool focused() const { return m_isFocused; } |
| 34 ScriptPromise focus(ScriptState*); | 35 ScriptPromise focus(ScriptState*); |
| 35 ScriptPromise navigate(ScriptState*, const String& url); | 36 ScriptPromise navigate(ScriptState*, const String& url); |
| 36 | 37 |
| 37 DECLARE_VIRTUAL_TRACE(); | 38 DECLARE_VIRTUAL_TRACE(); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 explicit ServiceWorkerWindowClient(const WebServiceWorkerClientInfo&); | 41 explicit ServiceWorkerWindowClient(const WebServiceWorkerClientInfo&); |
| 41 | 42 |
| 42 WebPageVisibilityState m_pageVisibilityState; | 43 WebPageVisibilityState m_pageVisibilityState; |
| 43 bool m_isFocused; | 44 bool m_isFocused; |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace blink | 47 } // namespace blink |
| 47 | 48 |
| 48 #endif // ServiceWorkerWindowClient_h | 49 #endif // ServiceWorkerWindowClient_h |
| OLD | NEW |