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