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

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

Issue 383123011: Revert 282761 "Change PhoneNumber::SetInfo to only apply formatt..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 (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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const AutofillType& type) const { 128 const AutofillType& type) const {
129 // We display the "raw" phone number which contains user-defined formatting. 129 // We display the "raw" phone number which contains user-defined formatting.
130 if (type.GetStorableType() == PHONE_HOME_WHOLE_NUMBER) { 130 if (type.GetStorableType() == PHONE_HOME_WHOLE_NUMBER) {
131 std::vector<base::string16> values; 131 std::vector<base::string16> values;
132 profile_->GetRawMultiInfo(type.GetStorableType(), &values); 132 profile_->GetRawMultiInfo(type.GetStorableType(), &values);
133 const base::string16& phone_number = values[GetVariantForType(type)]; 133 const base::string16& phone_number = values[GetVariantForType(type)];
134 134
135 // If there is no user-defined formatting at all, add some standard 135 // If there is no user-defined formatting at all, add some standard
136 // formatting. 136 // formatting.
137 if (base::ContainsOnlyChars(phone_number, 137 if (base::ContainsOnlyChars(phone_number,
138 base::ASCIIToUTF16("+0123456789"))) { 138 base::ASCIIToUTF16("0123456789"))) {
139 std::string region = base::UTF16ToASCII( 139 std::string region = base::UTF16ToASCII(
140 GetInfo(AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE))); 140 GetInfo(AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE)));
141 i18n::PhoneObject phone(phone_number, region); 141 i18n::PhoneObject phone(phone_number, region);
142 base::string16 formatted_number = phone.GetFormattedNumber(); 142 base::string16 formatted_number = phone.GetFormattedNumber();
143 // Formatting may fail. 143 // Formatting may fail.
144 if (!formatted_number.empty()) 144 if (!formatted_number.empty())
145 return formatted_number; 145 return formatted_number;
146 } 146 }
147 147
148 return phone_number; 148 return phone_number;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 return base::UTF8ToUTF16(address_->GetFieldValue(field)); 393 return base::UTF8ToUTF16(address_->GetFieldValue(field));
394 } 394 }
395 395
396 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { 396 const std::string& I18nAddressDataWrapper::GetLanguageCode() const {
397 return address_->language_code; 397 return address_->language_code;
398 } 398 }
399 399
400 } // namespace autofill 400 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698