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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual ~PaymentRequest(); | 44 virtual ~PaymentRequest(); |
45 | 45 |
46 struct MethodData { | 46 struct MethodData { |
47 MethodData(const Vector<String>& methods, const String& data) | 47 MethodData(const Vector<String>& methods, const String& data) |
48 : supportedMethods(methods), stringifiedData(data) {} | 48 : supportedMethods(methods), stringifiedData(data) {} |
49 Vector<String> supportedMethods; | 49 Vector<String> supportedMethods; |
50 String stringifiedData; | 50 String stringifiedData; |
51 }; | 51 }; |
52 | 52 |
53 ScriptPromise show(ScriptState*); | 53 ScriptPromise show(ScriptState*); |
54 void abort(ExceptionState&); | 54 ScriptPromise abort(ScriptState*); |
55 | 55 |
56 PaymentAddress* getShippingAddress() const { return m_shippingAddress.get();
} | 56 PaymentAddress* getShippingAddress() const { return m_shippingAddress.get();
} |
57 const String& shippingOption() const { return m_shippingOption; } | 57 const String& shippingOption() const { return m_shippingOption; } |
58 | 58 |
59 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange); | 59 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange); |
60 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange); | 60 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange); |
61 | 61 |
62 // EventTargetWithInlineData: | 62 // EventTargetWithInlineData: |
63 const AtomicString& interfaceName() const override; | 63 const AtomicString& interfaceName() const override; |
64 ExecutionContext* getExecutionContext() const override; | 64 ExecutionContext* getExecutionContext() const override; |
(...skipping 15 matching lines...) Expand all Loading... |
80 | 80 |
81 // ActiveScriptWrappable: | 81 // ActiveScriptWrappable: |
82 bool hasPendingActivity() const override; | 82 bool hasPendingActivity() const override; |
83 | 83 |
84 // mojom::blink::PaymentRequestClient: | 84 // mojom::blink::PaymentRequestClient: |
85 void OnShippingAddressChange(mojom::blink::PaymentAddressPtr) override; | 85 void OnShippingAddressChange(mojom::blink::PaymentAddressPtr) override; |
86 void OnShippingOptionChange(const String& shippingOptionId) override; | 86 void OnShippingOptionChange(const String& shippingOptionId) override; |
87 void OnPaymentResponse(mojom::blink::PaymentResponsePtr) override; | 87 void OnPaymentResponse(mojom::blink::PaymentResponsePtr) override; |
88 void OnError() override; | 88 void OnError() override; |
89 void OnComplete() override; | 89 void OnComplete() override; |
| 90 void OnAbort(bool abortedSuccessfully) override; |
90 | 91 |
91 // Clears the promise resolvers and closes the Mojo connection. | 92 // Clears the promise resolvers and closes the Mojo connection. |
92 void clearResolversAndCloseMojoConnection(); | 93 void clearResolversAndCloseMojoConnection(); |
93 | 94 |
94 Vector<MethodData> m_methodData; | 95 Vector<MethodData> m_methodData; |
95 PaymentDetails m_details; | 96 PaymentDetails m_details; |
96 PaymentOptions m_options; | 97 PaymentOptions m_options; |
97 Member<PaymentAddress> m_shippingAddress; | 98 Member<PaymentAddress> m_shippingAddress; |
98 String m_shippingOption; | 99 String m_shippingOption; |
99 Member<ScriptPromiseResolver> m_showResolver; | 100 Member<ScriptPromiseResolver> m_showResolver; |
100 Member<ScriptPromiseResolver> m_completeResolver; | 101 Member<ScriptPromiseResolver> m_completeResolver; |
| 102 Member<ScriptPromiseResolver> m_abortResolver; |
101 mojom::blink::PaymentRequestPtr m_paymentProvider; | 103 mojom::blink::PaymentRequestPtr m_paymentProvider; |
102 mojo::Binding<mojom::blink::PaymentRequestClient> m_clientBinding; | 104 mojo::Binding<mojom::blink::PaymentRequestClient> m_clientBinding; |
103 }; | 105 }; |
104 | 106 |
105 } // namespace blink | 107 } // namespace blink |
106 | 108 |
107 #endif // PaymentRequest_h | 109 #endif // PaymentRequest_h |
OLD | NEW |