| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |