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

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

Issue 252803002: rAc: autofill invalid phone numbers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/data_model_wrapper.h" 5 #include "chrome/browser/ui/autofill/data_model_wrapper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 profile_->GetRawMultiInfo(type.GetStorableType(), &values); 134 profile_->GetRawMultiInfo(type.GetStorableType(), &values);
135 const base::string16& phone_number = values[GetVariantForType(type)]; 135 const base::string16& phone_number = values[GetVariantForType(type)];
136 136
137 // If there is no user-defined formatting at all, add some standard 137 // If there is no user-defined formatting at all, add some standard
138 // formatting. 138 // formatting.
139 if (base::ContainsOnlyChars(phone_number, 139 if (base::ContainsOnlyChars(phone_number,
140 base::ASCIIToUTF16("0123456789"))) { 140 base::ASCIIToUTF16("0123456789"))) {
141 std::string region = base::UTF16ToASCII( 141 std::string region = base::UTF16ToASCII(
142 GetInfo(AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE))); 142 GetInfo(AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE)));
143 i18n::PhoneObject phone(phone_number, region); 143 i18n::PhoneObject phone(phone_number, region);
144 return phone.GetFormattedNumber(); 144 base::string16 formatted_number = phone.GetFormattedNumber();
145 // Formatting may fail.
146 if (!formatted_number.empty())
147 return formatted_number;
145 } 148 }
146 149
147 return phone_number; 150 return phone_number;
148 } 151 }
149 152
150 return DataModelWrapper::GetInfoForDisplay(type); 153 return DataModelWrapper::GetInfoForDisplay(type);
151 } 154 }
152 155
153 const std::string& AutofillProfileWrapper::GetLanguageCode() const { 156 const std::string& AutofillProfileWrapper::GetLanguageCode() const {
154 return profile_->language_code(); 157 return profile_->language_code();
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 396 }
394 397
395 return base::UTF8ToUTF16(address_->GetFieldValue(field)); 398 return base::UTF8ToUTF16(address_->GetFieldValue(field));
396 } 399 }
397 400
398 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { 401 const std::string& I18nAddressDataWrapper::GetLanguageCode() const {
399 return address_->language_code; 402 return address_->language_code;
400 } 403 }
401 404
402 } // namespace autofill 405 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698