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

Side by Side Diff: ios/chrome/browser/ui/payments/address_edit_coordinator.mm

Issue 2971003002: [Payment Request] Queries application locale from payments::PaymentRequest (Closed)
Patch Set: rebase Created 3 years, 5 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 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 #import "ios/chrome/browser/ui/payments/address_edit_coordinator.h" 5 #import "ios/chrome/browser/ui/payments/address_edit_coordinator.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "components/autofill/core/browser/autofill_country.h" 10 #include "components/autofill/core/browser/autofill_country.h"
11 #include "components/autofill/core/browser/autofill_profile.h" 11 #include "components/autofill/core/browser/autofill_profile.h"
12 #include "components/autofill/core/browser/autofill_type.h" 12 #include "components/autofill/core/browser/autofill_type.h"
13 #include "components/autofill/core/browser/personal_data_manager.h" 13 #include "components/autofill/core/browser/personal_data_manager.h"
14 #include "components/autofill/core/browser/validation.h" 14 #include "components/autofill/core/browser/validation.h"
15 #include "components/autofill/core/common/autofill_constants.h" 15 #include "components/autofill/core/common/autofill_constants.h"
16 #include "components/payments/core/payments_profile_comparator.h" 16 #include "components/payments/core/payments_profile_comparator.h"
17 #include "components/strings/grit/components_strings.h" 17 #include "components/strings/grit/components_strings.h"
18 #include "ios/chrome/browser/application_context.h"
19 #include "ios/chrome/browser/payments/payment_request.h" 18 #include "ios/chrome/browser/payments/payment_request.h"
20 #import "ios/chrome/browser/ui/autofill/autofill_ui_type_util.h" 19 #import "ios/chrome/browser/ui/autofill/autofill_ui_type_util.h"
21 #import "ios/chrome/browser/ui/payments/address_edit_mediator.h" 20 #import "ios/chrome/browser/ui/payments/address_edit_mediator.h"
22 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h" 21 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 23
25 #if !defined(__has_feature) || !__has_feature(objc_arc) 24 #if !defined(__has_feature) || !__has_feature(objc_arc)
26 #error "This file requires ARC support." 25 #error "This file requires ARC support."
27 #endif 26 #endif
28 27
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // the information. 143 // the information.
145 autofill::AutofillProfile address = 144 autofill::AutofillProfile address =
146 self.address ? *self.address 145 self.address ? *self.address
147 : autofill::AutofillProfile(base::GenerateGUID(), 146 : autofill::AutofillProfile(base::GenerateGUID(),
148 autofill::kSettingsOrigin); 147 autofill::kSettingsOrigin);
149 148
150 for (EditorField* field in fields) { 149 for (EditorField* field in fields) {
151 address.SetInfo(autofill::AutofillType( 150 address.SetInfo(autofill::AutofillType(
152 AutofillTypeFromAutofillUIType(field.autofillUIType)), 151 AutofillTypeFromAutofillUIType(field.autofillUIType)),
153 base::SysNSStringToUTF16(field.value), 152 base::SysNSStringToUTF16(field.value),
154 GetApplicationContext()->GetApplicationLocale()); 153 self.paymentRequest->GetApplicationLocale());
155 } 154 }
156 155
157 if (!self.address) { 156 if (!self.address) {
158 self.paymentRequest->GetPersonalDataManager()->AddProfile(address); 157 self.paymentRequest->GetPersonalDataManager()->AddProfile(address);
159 158
160 // Add the profile to the list of profiles in |self.paymentRequest|. 159 // Add the profile to the list of profiles in |self.paymentRequest|.
161 self.address = self.paymentRequest->AddAutofillProfile(address); 160 self.address = self.paymentRequest->AddAutofillProfile(address);
162 } else { 161 } else {
163 // Override the origin. 162 // Override the origin.
164 address.set_origin(autofill::kSettingsOrigin); 163 address.set_origin(autofill::kSettingsOrigin);
(...skipping 22 matching lines...) Expand all
187 if (self.mediator.selectedCountryCode != countryCode) { 186 if (self.mediator.selectedCountryCode != countryCode) {
188 [self.mediator setSelectedCountryCode:countryCode]; 187 [self.mediator setSelectedCountryCode:countryCode];
189 [self.editViewController loadModel]; 188 [self.editViewController loadModel];
190 [self.editViewController.collectionView reloadData]; 189 [self.editViewController.collectionView reloadData];
191 } 190 }
192 [self.countrySelectionCoordinator stop]; 191 [self.countrySelectionCoordinator stop];
193 self.countrySelectionCoordinator = nil; 192 self.countrySelectionCoordinator = nil;
194 } 193 }
195 194
196 @end 195 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698