Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp

Issue 2887713002: PaymentHandler: Merge PaymentAppRequest and PaymentRequestEvent. (Closed)
Patch Set: PaymentHandler: Merge PaymentAppRequest and PaymentRequestEvent. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/PaymentAppRequestConversion.h" 5 #include "modules/payments/PaymentAppRequestConversion.h"
6 6
7 #include "bindings/core/v8/ToV8ForCore.h" 7 #include "bindings/core/v8/ToV8ForCore.h"
8 #include "modules/payments/PaymentAppRequest.h" 8 #include "modules/payments/PaymentAppRequest.h"
9 #include "modules/payments/PaymentCurrencyAmount.h" 9 #include "modules/payments/PaymentCurrencyAmount.h"
10 #include "modules/payments/PaymentDetailsModifier.h" 10 #include "modules/payments/PaymentDetailsModifier.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ScriptState* script_state, 87 ScriptState* script_state,
88 const WebPaymentAppRequest& web_app_request) { 88 const WebPaymentAppRequest& web_app_request) {
89 DCHECK(script_state); 89 DCHECK(script_state);
90 90
91 PaymentAppRequest app_request; 91 PaymentAppRequest app_request;
92 if (!script_state->ContextIsValid()) 92 if (!script_state->ContextIsValid())
93 return app_request; 93 return app_request;
94 94
95 ScriptState::Scope scope(script_state); 95 ScriptState::Scope scope(script_state);
96 96
97 app_request.setOrigin(web_app_request.origin); 97 app_request.setTopLevelOrigin(web_app_request.top_level_origin);
98 app_request.setPaymentRequestOrigin(web_app_request.payment_request_origin);
99 app_request.setPaymentRequestId(web_app_request.payment_request_id);
98 HeapVector<PaymentMethodData> method_data; 100 HeapVector<PaymentMethodData> method_data;
99 for (const auto& md : web_app_request.method_data) { 101 for (const auto& md : web_app_request.method_data) {
100 method_data.push_back(ToPaymentMethodData(script_state, md)); 102 method_data.push_back(ToPaymentMethodData(script_state, md));
101 } 103 }
102 app_request.setMethodData(method_data); 104 app_request.setMethodData(method_data);
103 app_request.setTotal(ToPaymentItem(web_app_request.total)); 105 app_request.setTotal(ToPaymentItem(web_app_request.total));
104 HeapVector<PaymentDetailsModifier> modifiers; 106 HeapVector<PaymentDetailsModifier> modifiers;
105 for (const auto& modifier : web_app_request.modifiers) { 107 for (const auto& modifier : web_app_request.modifiers) {
106 modifiers.push_back(ToPaymentDetailsModifier(script_state, modifier)); 108 modifiers.push_back(ToPaymentDetailsModifier(script_state, modifier));
107 } 109 }
108 app_request.setOptionId(web_app_request.option_id); 110 app_request.setModifiers(modifiers);
111 app_request.setInstrumentKey(web_app_request.instrument_key);
109 return app_request; 112 return app_request;
110 } 113 }
111 114
112 } // namespace blink 115 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698