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 PaymentManager_h | 5 #ifndef PaymentManager_h |
6 #define PaymentManager_h | 6 #define PaymentManager_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "components/payments/mojom/payment_app.mojom-blink.h" | 9 #include "components/payments/mojom/payment_app.mojom-blink.h" |
10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
11 #include "platform/bindings/ScriptWrappable.h" | 11 #include "platform/bindings/ScriptWrappable.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class PaymentAppManifest; | |
17 class PaymentInstruments; | 16 class PaymentInstruments; |
18 class ScriptPromiseResolver; | |
19 class ScriptState; | |
20 class ServiceWorkerRegistration; | 17 class ServiceWorkerRegistration; |
21 | 18 |
22 class MODULES_EXPORT PaymentManager final | 19 class MODULES_EXPORT PaymentManager final |
23 : public GarbageCollectedFinalized<PaymentManager>, | 20 : public GarbageCollectedFinalized<PaymentManager>, |
24 public ScriptWrappable { | 21 public ScriptWrappable { |
25 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
26 WTF_MAKE_NONCOPYABLE(PaymentManager); | 23 WTF_MAKE_NONCOPYABLE(PaymentManager); |
27 | 24 |
28 public: | 25 public: |
29 static PaymentManager* Create(ServiceWorkerRegistration*); | 26 static PaymentManager* Create(ServiceWorkerRegistration*); |
30 | 27 |
31 ScriptPromise setManifest(ScriptState*, const PaymentAppManifest&); | |
32 ScriptPromise getManifest(ScriptState*); | |
33 | |
34 PaymentInstruments* instruments(); | 28 PaymentInstruments* instruments(); |
35 | 29 |
36 DECLARE_TRACE(); | 30 DECLARE_TRACE(); |
37 | 31 |
38 private: | 32 private: |
39 explicit PaymentManager(ServiceWorkerRegistration*); | 33 explicit PaymentManager(ServiceWorkerRegistration*); |
40 | 34 |
41 void OnSetManifest(ScriptPromiseResolver*, | |
42 payments::mojom::blink::PaymentAppManifestError); | |
43 void OnGetManifest(ScriptPromiseResolver*, | |
44 payments::mojom::blink::PaymentAppManifestPtr, | |
45 payments::mojom::blink::PaymentAppManifestError); | |
46 void OnServiceConnectionError(); | 35 void OnServiceConnectionError(); |
47 | 36 |
48 Member<ServiceWorkerRegistration> registration_; | 37 Member<ServiceWorkerRegistration> registration_; |
49 payments::mojom::blink::PaymentManagerPtr manager_; | 38 payments::mojom::blink::PaymentManagerPtr manager_; |
50 Member<PaymentInstruments> instruments_; | 39 Member<PaymentInstruments> instruments_; |
51 }; | 40 }; |
52 | 41 |
53 } // namespace blink | 42 } // namespace blink |
54 | 43 |
55 #endif // PaymentManager_h | 44 #endif // PaymentManager_h |
OLD | NEW |