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

Side by Side Diff: components/payments/content/payment_response_helper.cc

Issue 2876663002: [Web Payments] Add data attribution string to dialog (Closed)
Patch Set: Address comments, fix tests compile 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
« no previous file with comments | « components/payments/content/payment_request_state.cc ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "components/payments/content/payment_response_helper.h" 5 #include "components/payments/content/payment_response_helper.h"
6 6
7 #include <string>
8
7 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
8 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/browser/autofill_country.h" 11 #include "components/autofill/core/browser/autofill_country.h"
10 #include "components/autofill/core/browser/autofill_data_util.h" 12 #include "components/autofill/core/browser/autofill_data_util.h"
11 #include "components/autofill/core/browser/autofill_type.h" 13 #include "components/autofill/core/browser/autofill_type.h"
12 #include "components/payments/content/payment_request_spec.h" 14 #include "components/payments/content/payment_request_spec.h"
13 #include "components/payments/core/payment_request_data_util.h" 15 #include "components/payments/core/payment_request_data_util.h"
14 #include "components/payments/core/payment_request_delegate.h" 16 #include "components/payments/core/payment_request_delegate.h"
15 17
16 namespace payments { 18 namespace payments {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 56 }
55 57
56 payment_request_delegate_->GetAddressNormalizer() 58 payment_request_delegate_->GetAddressNormalizer()
57 ->StartAddressNormalization(*selected_shipping_profile, country_code, 59 ->StartAddressNormalization(*selected_shipping_profile, country_code,
58 /*timeout_seconds=*/5, this); 60 /*timeout_seconds=*/5, this);
59 } 61 }
60 62
61 // Start to get the instrument details. Will call back into 63 // Start to get the instrument details. Will call back into
62 // OnInstrumentDetailsReady. 64 // OnInstrumentDetailsReady.
63 selected_instrument_->InvokePaymentApp(this); 65 selected_instrument_->InvokePaymentApp(this);
64 }; 66 }
65 67
66 PaymentResponseHelper::~PaymentResponseHelper(){}; 68 PaymentResponseHelper::~PaymentResponseHelper() {}
67 69
68 // static 70 // static
69 mojom::PaymentAddressPtr 71 mojom::PaymentAddressPtr
70 PaymentResponseHelper::GetMojomPaymentAddressFromAutofillProfile( 72 PaymentResponseHelper::GetMojomPaymentAddressFromAutofillProfile(
71 const autofill::AutofillProfile& profile, 73 const autofill::AutofillProfile& profile,
72 const std::string& app_locale) { 74 const std::string& app_locale) {
73 mojom::PaymentAddressPtr payment_address = mojom::PaymentAddress::New(); 75 mojom::PaymentAddressPtr payment_address = mojom::PaymentAddress::New();
74 76
75 payment_address->country = 77 payment_address->country =
76 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)); 78 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const std::string default_region_code = 183 const std::string default_region_code =
182 autofill::AutofillCountry::CountryCodeForLocale(app_locale_); 184 autofill::AutofillCountry::CountryCodeForLocale(app_locale_);
183 payment_response->payer_phone = 185 payment_response->payer_phone =
184 data_util::FormatPhoneForResponse(original_number, default_region_code); 186 data_util::FormatPhoneForResponse(original_number, default_region_code);
185 } 187 }
186 188
187 delegate_->OnPaymentResponseReady(std::move(payment_response)); 189 delegate_->OnPaymentResponseReady(std::move(payment_response));
188 } 190 }
189 191
190 } // namespace payments 192 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_state.cc ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698