| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 PaymentInstruments_h | 5 #ifndef PaymentInstruments_h |
| 6 #define PaymentInstruments_h | 6 #define PaymentInstruments_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "components/payments/content/payment_app.mojom-blink.h" |
| 9 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 11 #include "platform/wtf/Noncopyable.h" | 12 #include "platform/wtf/Noncopyable.h" |
| 12 #include "platform/wtf/text/WTFString.h" | 13 #include "platform/wtf/text/WTFString.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 17 class ExceptionState; |
| 16 class PaymentInstrument; | 18 class PaymentInstrument; |
| 17 class ScriptPromise; | 19 class ScriptPromise; |
| 20 class ScriptPromiseResolver; |
| 21 class ScriptState; |
| 18 | 22 |
| 19 class MODULES_EXPORT PaymentInstruments final | 23 class MODULES_EXPORT PaymentInstruments final |
| 20 : public GarbageCollected<PaymentInstruments>, | 24 : public GarbageCollected<PaymentInstruments>, |
| 21 public ScriptWrappable { | 25 public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 23 WTF_MAKE_NONCOPYABLE(PaymentInstruments); | 27 WTF_MAKE_NONCOPYABLE(PaymentInstruments); |
| 24 | 28 |
| 25 public: | 29 public: |
| 26 PaymentInstruments(); | 30 explicit PaymentInstruments(const payments::mojom::blink::PaymentManagerPtr&); |
| 27 | 31 |
| 28 ScriptPromise deleteInstrument(const String& instrument_key); | 32 ScriptPromise deleteInstrument(const String& instrument_key); |
| 29 ScriptPromise get(const String& instrument_key); | 33 ScriptPromise get(ScriptState*, const String& instrument_key); |
| 30 ScriptPromise keys(); | 34 ScriptPromise keys(); |
| 31 ScriptPromise has(const String& instrument_key); | 35 ScriptPromise has(const String& instrument_key); |
| 32 ScriptPromise set(const String& instrument_key, | 36 ScriptPromise set(ScriptState*, |
| 33 const PaymentInstrument& details); | 37 const String& instrument_key, |
| 38 const PaymentInstrument& details, |
| 39 ExceptionState&); |
| 34 | 40 |
| 35 DECLARE_TRACE(); | 41 DECLARE_TRACE(); |
| 42 |
| 43 private: |
| 44 void onSetPaymentInstrument(ScriptPromiseResolver*, |
| 45 payments::mojom::blink::PaymentHandlerStatus); |
| 46 void onGetPaymentInstrument(ScriptPromiseResolver*, |
| 47 payments::mojom::blink::PaymentInstrumentPtr, |
| 48 payments::mojom::blink::PaymentHandlerStatus); |
| 49 |
| 50 const payments::mojom::blink::PaymentManagerPtr& manager_; |
| 36 }; | 51 }; |
| 37 | 52 |
| 38 } // namespace blink | 53 } // namespace blink |
| 39 | 54 |
| 40 #endif // PaymentInstruments_h | 55 #endif // PaymentInstruments_h |
| OLD | NEW |