OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 PaymentAppManager_h | 5 #ifndef PaymentAppManager_h |
6 #define PaymentAppManager_h | 6 #define PaymentAppManager_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 "components/payments/payment_app.mojom-blink.h" | 10 #include "components/payments/payment_app.mojom-blink.h" |
11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
12 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
| 17 class ExecutionContext; |
17 class PaymentAppManifest; | 18 class PaymentAppManifest; |
18 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
19 class ScriptState; | 20 class ScriptState; |
20 class ServiceWorkerRegistration; | 21 class ServiceWorkerRegistration; |
21 | 22 |
22 class MODULES_EXPORT PaymentAppManager final | 23 class MODULES_EXPORT PaymentAppManager final |
23 : public GarbageCollectedFinalized<PaymentAppManager>, | 24 : public GarbageCollectedFinalized<PaymentAppManager>, |
24 public ScriptWrappable, | 25 public ScriptWrappable, |
25 public ContextLifecycleObserver { | 26 public ContextLifecycleObserver { |
26 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
27 USING_GARBAGE_COLLECTED_MIXIN(PaymentAppManager); | 28 USING_GARBAGE_COLLECTED_MIXIN(PaymentAppManager); |
28 WTF_MAKE_NONCOPYABLE(PaymentAppManager); | 29 WTF_MAKE_NONCOPYABLE(PaymentAppManager); |
29 | 30 |
30 public: | 31 public: |
31 static PaymentAppManager* create(ScriptState*, ServiceWorkerRegistration*); | 32 static PaymentAppManager* create(ExecutionContext*, |
| 33 ServiceWorkerRegistration*); |
32 | 34 |
33 void contextDestroyed() override; | 35 void contextDestroyed() override; |
34 | 36 |
35 ScriptPromise setManifest(ScriptState*, const PaymentAppManifest&); | 37 ScriptPromise setManifest(ScriptState*, const PaymentAppManifest&); |
36 ScriptPromise getManifest(ScriptState*); | 38 ScriptPromise getManifest(ScriptState*); |
37 | 39 |
38 DECLARE_TRACE(); | 40 DECLARE_TRACE(); |
39 | 41 |
40 private: | 42 private: |
41 PaymentAppManager(ScriptState*, ServiceWorkerRegistration*); | 43 PaymentAppManager(ExecutionContext*, ServiceWorkerRegistration*); |
42 | 44 |
43 void onSetManifest(ScriptPromiseResolver*, | 45 void onSetManifest(ScriptPromiseResolver*, |
44 payments::mojom::blink::PaymentAppManifestError); | 46 payments::mojom::blink::PaymentAppManifestError); |
45 void onGetManifest(ScriptPromiseResolver*, | 47 void onGetManifest(ScriptPromiseResolver*, |
46 payments::mojom::blink::PaymentAppManifestPtr, | 48 payments::mojom::blink::PaymentAppManifestPtr, |
47 payments::mojom::blink::PaymentAppManifestError); | 49 payments::mojom::blink::PaymentAppManifestError); |
48 void onServiceConnectionError(); | 50 void onServiceConnectionError(); |
49 | 51 |
50 Member<ServiceWorkerRegistration> m_registration; | 52 Member<ServiceWorkerRegistration> m_registration; |
51 payments::mojom::blink::PaymentAppManagerPtr m_manager; | 53 payments::mojom::blink::PaymentAppManagerPtr m_manager; |
52 }; | 54 }; |
53 | 55 |
54 } // namespace blink | 56 } // namespace blink |
55 | 57 |
56 #endif // PaymentAppManager_h | 58 #endif // PaymentAppManager_h |
OLD | NEW |