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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 13697002: Make autofill's Address store country using the country code so that app locale isn't needed for th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 (*inputs)[j].initial_value = 146 (*inputs)[j].initial_value =
147 group->GetInfo((*inputs)[j].type, app_locale); 147 group->GetInfo((*inputs)[j].type, app_locale);
148 } 148 }
149 } 149 }
150 150
151 // Initializes |form_group| from user-entered data. 151 // Initializes |form_group| from user-entered data.
152 void FillFormGroupFromOutputs(const DetailOutputMap& detail_outputs, 152 void FillFormGroupFromOutputs(const DetailOutputMap& detail_outputs,
153 FormGroup* form_group) { 153 FormGroup* form_group) {
154 for (DetailOutputMap::const_iterator iter = detail_outputs.begin(); 154 for (DetailOutputMap::const_iterator iter = detail_outputs.begin();
155 iter != detail_outputs.end(); ++iter) { 155 iter != detail_outputs.end(); ++iter) {
156 if (!iter->second.empty()) 156 if (!iter->second.empty()) {
157 form_group->SetRawInfo(iter->first->type, iter->second); 157 if (iter->first->type == ADDRESS_HOME_COUNTRY) {
158 form_group->SetInfo(ADDRESS_HOME_COUNTRY,
159 iter->second,
160 g_browser_process->GetApplicationLocale());
161 } else {
162 form_group->SetRawInfo(iter->first->type, iter->second);
163 }
164 }
158 } 165 }
159 } 166 }
160 167
161 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. 168 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|.
162 // These outparams are required because |card|/|profile| accept different types 169 // These outparams are required because |card|/|profile| accept different types
163 // of raw info, and CreditCard doesn't save CVCs. 170 // of raw info, and CreditCard doesn't save CVCs.
164 void GetBillingInfoFromOutputs(const DetailOutputMap& output, 171 void GetBillingInfoFromOutputs(const DetailOutputMap& output,
165 CreditCard* card, 172 CreditCard* card,
166 string16* cvc, 173 string16* cvc,
167 AutofillProfile* profile) { 174 AutofillProfile* profile) {
168 for (DetailOutputMap::const_iterator it = output.begin(); 175 for (DetailOutputMap::const_iterator it = output.begin();
169 it != output.end(); ++it) { 176 it != output.end(); ++it) {
170 string16 trimmed; 177 string16 trimmed;
171 TrimWhitespace(it->second, TRIM_ALL, &trimmed); 178 TrimWhitespace(it->second, TRIM_ALL, &trimmed);
172 179
173 // Special case CVC as CreditCard just swallows it. 180 // Special case CVC as CreditCard just swallows it.
174 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) { 181 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) {
175 if (cvc) 182 if (cvc)
176 cvc->assign(trimmed); 183 cvc->assign(trimmed);
184 } else if (it->first->type == ADDRESS_HOME_COUNTRY) {
Ilya Sherman 2013/04/05 07:18:41 I think you need to handle ADDRESS_BILLING_COUNTRY
jam 2013/04/05 07:35:35 Done.
185 profile->SetInfo(ADDRESS_HOME_COUNTRY,
186 trimmed,
187 g_browser_process->GetApplicationLocale());
177 } else { 188 } else {
178 // Copy the credit card name to |profile| in addition to |card| as 189 // Copy the credit card name to |profile| in addition to |card| as
179 // wallet::Instrument requires a recipient name for its billing address. 190 // wallet::Instrument requires a recipient name for its billing address.
180 if (profile && it->first->type == CREDIT_CARD_NAME) 191 if (profile && it->first->type == CREDIT_CARD_NAME)
181 profile->SetRawInfo(NAME_FULL, trimmed); 192 profile->SetRawInfo(NAME_FULL, trimmed);
182 193
183 if (IsCreditCardType(it->first->type)) { 194 if (IsCreditCardType(it->first->type)) {
184 if (card) 195 if (card)
185 card->SetRawInfo(it->first->type, trimmed); 196 card->SetRawInfo(it->first->type, trimmed);
186 } else if (profile) { 197 } else if (profile) {
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; 2076 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL;
2066 } 2077 }
2067 2078
2068 // Has Wallet items. 2079 // Has Wallet items.
2069 return has_autofill_profiles ? 2080 return has_autofill_profiles ?
2070 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : 2081 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL :
2071 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; 2082 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL;
2072 } 2083 }
2073 2084
2074 } // namespace autofill 2085 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698