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

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

Issue 347183005: autofill names - dont parse when calling SetRawInfo(FULL_NAME) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now with street address behavior change Created 6 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 | 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 field.Type().GetStorableType()))); 194 field.Type().GetStorableType())));
195 } 195 }
196 196
197 // Initializes |form_group| from user-entered data. 197 // Initializes |form_group| from user-entered data.
198 void FillFormGroupFromOutputs(const FieldValueMap& detail_outputs, 198 void FillFormGroupFromOutputs(const FieldValueMap& detail_outputs,
199 FormGroup* form_group) { 199 FormGroup* form_group) {
200 for (FieldValueMap::const_iterator iter = detail_outputs.begin(); 200 for (FieldValueMap::const_iterator iter = detail_outputs.begin();
201 iter != detail_outputs.end(); ++iter) { 201 iter != detail_outputs.end(); ++iter) {
202 ServerFieldType type = iter->first; 202 ServerFieldType type = iter->first;
203 if (!iter->second.empty()) { 203 if (!iter->second.empty()) {
204 if (type == ADDRESS_HOME_COUNTRY || type == ADDRESS_BILLING_COUNTRY) { 204 form_group->SetInfo(AutofillType(type),
205 form_group->SetInfo(AutofillType(type), 205 iter->second,
206 iter->second, 206 g_browser_process->GetApplicationLocale());
207 g_browser_process->GetApplicationLocale());
208 } else {
209 form_group->SetRawInfo(
210 AutofillType(type).GetStorableType(), iter->second);
211 }
212 } 207 }
213 } 208 }
214 } 209 }
215 210
216 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. 211 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|.
217 // These outparams are required because |card|/|profile| accept different types 212 // These outparams are required because |card|/|profile| accept different types
218 // of raw info, and CreditCard doesn't save CVCs. 213 // of raw info, and CreditCard doesn't save CVCs.
219 void GetBillingInfoFromOutputs(const FieldValueMap& output, 214 void GetBillingInfoFromOutputs(const FieldValueMap& output,
220 CreditCard* card, 215 CreditCard* card,
221 base::string16* cvc, 216 base::string16* cvc,
222 AutofillProfile* profile) { 217 AutofillProfile* profile) {
223 for (FieldValueMap::const_iterator it = output.begin(); 218 for (FieldValueMap::const_iterator it = output.begin();
224 it != output.end(); ++it) { 219 it != output.end(); ++it) {
225 const ServerFieldType type = it->first; 220 const ServerFieldType type = it->first;
226 base::string16 trimmed; 221 base::string16 trimmed;
227 base::TrimWhitespace(it->second, base::TRIM_ALL, &trimmed); 222 base::TrimWhitespace(it->second, base::TRIM_ALL, &trimmed);
228 223
229 // Special case CVC as CreditCard just swallows it. 224 // Special case CVC as CreditCard just swallows it.
230 if (type == CREDIT_CARD_VERIFICATION_CODE) { 225 if (type == CREDIT_CARD_VERIFICATION_CODE) {
231 if (cvc) 226 if (cvc)
232 cvc->assign(trimmed); 227 cvc->assign(trimmed);
233 } else if (type == ADDRESS_HOME_COUNTRY || 228 } else if (common::IsCreditCardType(type)) {
234 type == ADDRESS_BILLING_COUNTRY) { 229 card->SetRawInfo(type, trimmed);
235 if (profile) {
236 profile->SetInfo(AutofillType(type),
237 trimmed,
238 g_browser_process->GetApplicationLocale());
239 }
240 } else { 230 } else {
241 // Copy the credit card name to |profile| in addition to |card| as 231 // Copy the credit card name to |profile| in addition to |card| as
242 // wallet::Instrument requires a recipient name for its billing address. 232 // wallet::Instrument requires a recipient name for its billing address.
243 if (card && type == NAME_FULL) 233 if (card && type == NAME_FULL)
244 card->SetRawInfo(CREDIT_CARD_NAME, trimmed); 234 card->SetRawInfo(CREDIT_CARD_NAME, trimmed);
245 235
246 if (common::IsCreditCardType(type)) { 236 if (profile) {
247 if (card) 237 profile->SetInfo(AutofillType(AutofillType(type).GetStorableType()),
248 card->SetRawInfo(type, trimmed); 238 trimmed,
249 } else if (profile) { 239 g_browser_process->GetApplicationLocale());
250 profile->SetRawInfo(AutofillType(type).GetStorableType(), trimmed);
251 } 240 }
252 } 241 }
253 } 242 }
254 } 243 }
255 244
256 // Returns the containing window for the given |web_contents|. The containing 245 // Returns the containing window for the given |web_contents|. The containing
257 // window might be a browser window for a Chrome tab, or it might be an app 246 // window might be a browser window for a Chrome tab, or it might be an app
258 // window for a platform app. 247 // window for a platform app.
259 ui::BaseWindow* GetBaseWindowForWebContents( 248 ui::BaseWindow* GetBaseWindowForWebContents(
260 content::WebContents* web_contents) { 249 content::WebContents* web_contents) {
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 cards[i]->guid(), 3033 cards[i]->guid(),
3045 cards[i]->Label(), 3034 cards[i]->Label(),
3046 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type()))); 3035 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type())));
3047 suggested_cc_.SetEnabled( 3036 suggested_cc_.SetEnabled(
3048 cards[i]->guid(), 3037 cards[i]->guid(),
3049 !ShouldDisallowCcType(cards[i]->TypeForDisplay())); 3038 !ShouldDisallowCcType(cards[i]->TypeForDisplay()));
3050 } 3039 }
3051 3040
3052 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); 3041 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles();
3053 std::vector<base::string16> labels; 3042 std::vector<base::string16> labels;
3054 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); 3043 AutofillProfile::CreateDifferentiatingLabels(
3044 profiles,
3045 g_browser_process->GetApplicationLocale(),
3046 &labels);
3055 DCHECK_EQ(labels.size(), profiles.size()); 3047 DCHECK_EQ(labels.size(), profiles.size());
3056 for (size_t i = 0; i < profiles.size(); ++i) { 3048 for (size_t i = 0; i < profiles.size(); ++i) {
3057 const AutofillProfile& profile = *profiles[i]; 3049 const AutofillProfile& profile = *profiles[i];
3058 if (!i18ninput::AddressHasCompleteAndVerifiedData( 3050 if (!i18ninput::AddressHasCompleteAndVerifiedData(
3059 profile, g_browser_process->GetApplicationLocale())) { 3051 profile, g_browser_process->GetApplicationLocale())) {
3060 continue; 3052 continue;
3061 } 3053 }
3062 3054
3063 // Don't add variants for addresses: name is part of credit card and 3055 // Don't add variants for addresses: name is part of credit card and
3064 // we'll just ignore email and phone number variants. 3056 // we'll just ignore email and phone number variants.
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 view_->UpdateButtonStrip(); 4120 view_->UpdateButtonStrip();
4129 } 4121 }
4130 4122
4131 void AutofillDialogControllerImpl::FetchWalletCookie() { 4123 void AutofillDialogControllerImpl::FetchWalletCookie() {
4132 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); 4124 net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
4133 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); 4125 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context));
4134 signin_helper_->StartWalletCookieValueFetch(); 4126 signin_helper_->StartWalletCookieValueFetch();
4135 } 4127 }
4136 4128
4137 } // namespace autofill 4129 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698