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