| 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 PaymentRequest_h | 5 #ifndef PaymentRequest_h |
| 6 #define PaymentRequest_h | 6 #define PaymentRequest_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 ScriptPromise show(ScriptState*); | 54 ScriptPromise show(ScriptState*); |
| 55 ScriptPromise abort(ScriptState*); | 55 ScriptPromise abort(ScriptState*); |
| 56 | 56 |
| 57 PaymentAddress* getShippingAddress() const { return m_shippingAddress.get();
} | 57 PaymentAddress* getShippingAddress() const { return m_shippingAddress.get();
} |
| 58 const String& shippingOption() const { return m_shippingOption; } | 58 const String& shippingOption() const { return m_shippingOption; } |
| 59 | 59 |
| 60 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange); | 60 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange); |
| 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange); | 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange); |
| 62 | 62 |
| 63 // ScriptWrappable: |
| 64 bool hasPendingActivity() const override; |
| 65 |
| 63 // EventTargetWithInlineData: | 66 // EventTargetWithInlineData: |
| 64 const AtomicString& interfaceName() const override; | 67 const AtomicString& interfaceName() const override; |
| 65 ExecutionContext* getExecutionContext() const override; | 68 ExecutionContext* getExecutionContext() const override; |
| 66 | 69 |
| 67 // PaymentCompleter: | 70 // PaymentCompleter: |
| 68 ScriptPromise complete(ScriptState*, PaymentComplete result) override; | 71 ScriptPromise complete(ScriptState*, PaymentComplete result) override; |
| 69 | 72 |
| 70 // PaymentUpdater: | 73 // PaymentUpdater: |
| 71 void onUpdatePaymentDetails(const ScriptValue& detailsScriptValue) override; | 74 void onUpdatePaymentDetails(const ScriptValue& detailsScriptValue) override; |
| 72 void onUpdatePaymentDetailsFailure(const String& error) override; | 75 void onUpdatePaymentDetailsFailure(const String& error) override; |
| 73 | 76 |
| 74 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
| 75 | 78 |
| 76 void onCompleteTimeoutForTesting(); | 79 void onCompleteTimeoutForTesting(); |
| 77 | 80 |
| 78 private: | 81 private: |
| 79 PaymentRequest(ScriptState*, const HeapVector<PaymentMethodData>&, const Pay
mentDetails&, const PaymentOptions&, ExceptionState&); | 82 PaymentRequest(ScriptState*, const HeapVector<PaymentMethodData>&, const Pay
mentDetails&, const PaymentOptions&, ExceptionState&); |
| 80 | 83 |
| 81 // LifecycleObserver: | 84 // LifecycleObserver: |
| 82 void contextDestroyed() override; | 85 void contextDestroyed() override; |
| 83 | 86 |
| 84 // ActiveScriptWrappable: | |
| 85 bool hasPendingActivity() const override; | |
| 86 | |
| 87 // mojom::blink::PaymentRequestClient: | 87 // mojom::blink::PaymentRequestClient: |
| 88 void OnShippingAddressChange(mojom::blink::PaymentAddressPtr) override; | 88 void OnShippingAddressChange(mojom::blink::PaymentAddressPtr) override; |
| 89 void OnShippingOptionChange(const String& shippingOptionId) override; | 89 void OnShippingOptionChange(const String& shippingOptionId) override; |
| 90 void OnPaymentResponse(mojom::blink::PaymentResponsePtr) override; | 90 void OnPaymentResponse(mojom::blink::PaymentResponsePtr) override; |
| 91 void OnError(mojom::blink::PaymentErrorReason) override; | 91 void OnError(mojom::blink::PaymentErrorReason) override; |
| 92 void OnComplete() override; | 92 void OnComplete() override; |
| 93 void OnAbort(bool abortedSuccessfully) override; | 93 void OnAbort(bool abortedSuccessfully) override; |
| 94 | 94 |
| 95 void onCompleteTimeout(TimerBase*); | 95 void onCompleteTimeout(TimerBase*); |
| 96 | 96 |
| 97 // Clears the promise resolvers and closes the Mojo connection. | 97 // Clears the promise resolvers and closes the Mojo connection. |
| 98 void clearResolversAndCloseMojoConnection(); | 98 void clearResolversAndCloseMojoConnection(); |
| 99 | 99 |
| 100 Vector<MethodData> m_methodData; | 100 Vector<MethodData> m_methodData; |
| 101 PaymentDetails m_details; | 101 PaymentDetails m_details; |
| 102 PaymentOptions m_options; | 102 PaymentOptions m_options; |
| 103 Member<PaymentAddress> m_shippingAddress; | 103 Member<PaymentAddress> m_shippingAddress; |
| 104 String m_shippingOption; | 104 String m_shippingOption; |
| 105 Member<ScriptPromiseResolver> m_showResolver; | 105 Member<ScriptPromiseResolver> m_showResolver; |
| 106 Member<ScriptPromiseResolver> m_completeResolver; | 106 Member<ScriptPromiseResolver> m_completeResolver; |
| 107 Member<ScriptPromiseResolver> m_abortResolver; | 107 Member<ScriptPromiseResolver> m_abortResolver; |
| 108 mojom::blink::PaymentRequestPtr m_paymentProvider; | 108 mojom::blink::PaymentRequestPtr m_paymentProvider; |
| 109 mojo::Binding<mojom::blink::PaymentRequestClient> m_clientBinding; | 109 mojo::Binding<mojom::blink::PaymentRequestClient> m_clientBinding; |
| 110 Timer<PaymentRequest> m_completeTimer; | 110 Timer<PaymentRequest> m_completeTimer; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| 114 | 114 |
| 115 #endif // PaymentRequest_h | 115 #endif // PaymentRequest_h |
| OLD | NEW |