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 #include "modules/payments/PaymentRequestEvent.h" | 5 #include "modules/payments/PaymentRequestEvent.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/workers/WorkerGlobalScope.h" | 9 #include "core/workers/WorkerGlobalScope.h" |
10 #include "core/workers/WorkerLocation.h" | 10 #include "core/workers/WorkerLocation.h" |
11 #include "modules/serviceworkers/RespondWithObserver.h" | 11 #include "modules/serviceworkers/RespondWithObserver.h" |
12 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 12 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
13 #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" | 13 #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" |
| 14 #include "platform/bindings/ScriptState.h" |
14 #include "platform/wtf/PtrUtil.h" | 15 #include "platform/wtf/PtrUtil.h" |
15 #include "platform/wtf/text/AtomicString.h" | 16 #include "platform/wtf/text/AtomicString.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 PaymentRequestEvent* PaymentRequestEvent::Create( | 20 PaymentRequestEvent* PaymentRequestEvent::Create( |
20 const AtomicString& type, | 21 const AtomicString& type, |
21 const PaymentRequestEventInit& initializer) { | 22 const PaymentRequestEventInit& initializer) { |
22 return new PaymentRequestEvent(type, initializer, nullptr, nullptr); | 23 return new PaymentRequestEvent(type, initializer, nullptr, nullptr); |
23 } | 24 } |
(...skipping 22 matching lines...) Expand all Loading... |
46 } | 47 } |
47 | 48 |
48 const String& PaymentRequestEvent::paymentRequestId() const { | 49 const String& PaymentRequestEvent::paymentRequestId() const { |
49 return payment_request_id_; | 50 return payment_request_id_; |
50 } | 51 } |
51 | 52 |
52 const HeapVector<PaymentMethodData>& PaymentRequestEvent::methodData() const { | 53 const HeapVector<PaymentMethodData>& PaymentRequestEvent::methodData() const { |
53 return method_data_; | 54 return method_data_; |
54 } | 55 } |
55 | 56 |
56 void PaymentRequestEvent::total(PaymentItem& value) const { | 57 const ScriptValue PaymentRequestEvent::total(ScriptState* script_state) const { |
57 value = total_; | 58 return ScriptValue::From(script_state, total_); |
58 } | 59 } |
59 | 60 |
60 const HeapVector<PaymentDetailsModifier>& PaymentRequestEvent::modifiers() | 61 const HeapVector<PaymentDetailsModifier>& PaymentRequestEvent::modifiers() |
61 const { | 62 const { |
62 return modifiers_; | 63 return modifiers_; |
63 } | 64 } |
64 | 65 |
65 const String& PaymentRequestEvent::instrumentKey() const { | 66 const String& PaymentRequestEvent::instrumentKey() const { |
66 return instrument_key_; | 67 return instrument_key_; |
67 } | 68 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 top_level_origin_(initializer.topLevelOrigin()), | 133 top_level_origin_(initializer.topLevelOrigin()), |
133 payment_request_origin_(initializer.paymentRequestOrigin()), | 134 payment_request_origin_(initializer.paymentRequestOrigin()), |
134 payment_request_id_(initializer.paymentRequestId()), | 135 payment_request_id_(initializer.paymentRequestId()), |
135 method_data_(std::move(initializer.methodData())), | 136 method_data_(std::move(initializer.methodData())), |
136 total_(initializer.total()), | 137 total_(initializer.total()), |
137 modifiers_(initializer.modifiers()), | 138 modifiers_(initializer.modifiers()), |
138 instrument_key_(initializer.instrumentKey()), | 139 instrument_key_(initializer.instrumentKey()), |
139 observer_(respond_with_observer) {} | 140 observer_(respond_with_observer) {} |
140 | 141 |
141 } // namespace blink | 142 } // namespace blink |
OLD | NEW |