| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 base::string16 phone = | 54 base::string16 phone = |
| 55 GetInfoForDisplay(AutofillType(PHONE_HOME_WHOLE_NUMBER)); | 55 GetInfoForDisplay(AutofillType(PHONE_HOME_WHOLE_NUMBER)); |
| 56 if (phone.empty()) | 56 if (phone.empty()) |
| 57 return false; | 57 return false; |
| 58 | 58 |
| 59 // Format the address. | 59 // Format the address. |
| 60 scoped_ptr< ::i18n::addressinput::AddressData> address_data = | 60 scoped_ptr< ::i18n::addressinput::AddressData> address_data = |
| 61 i18n::CreateAddressData( | 61 i18n::CreateAddressData( |
| 62 base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this))); | 62 base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this))); |
| 63 address_data->language_code = GetLanguageCode(); | 63 address_data->language_code = GetLanguageCode(); |
| 64 // Interactive autofill dialog does not display organization field. |
| 65 address_data->organization.clear(); |
| 64 std::vector<std::string> lines; | 66 std::vector<std::string> lines; |
| 65 ::i18n::addressinput::GetFormattedNationalAddress(*address_data, &lines); | 67 ::i18n::addressinput::GetFormattedNationalAddress(*address_data, &lines); |
| 66 | 68 |
| 67 std::string single_line; | 69 std::string single_line; |
| 68 ::i18n::addressinput::GetFormattedNationalAddressLine( | 70 ::i18n::addressinput::GetFormattedNationalAddressLine( |
| 69 *address_data, &single_line); | 71 *address_data, &single_line); |
| 70 | 72 |
| 71 // Email and phone number aren't part of address formatting. | 73 // Email and phone number aren't part of address formatting. |
| 72 base::string16 non_address_info; | 74 base::string16 non_address_info; |
| 73 base::string16 email = GetInfoForDisplay(AutofillType(EMAIL_ADDRESS)); | 75 base::string16 email = GetInfoForDisplay(AutofillType(EMAIL_ADDRESS)); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 396 } |
| 395 | 397 |
| 396 return base::UTF8ToUTF16(address_->GetFieldValue(field)); | 398 return base::UTF8ToUTF16(address_->GetFieldValue(field)); |
| 397 } | 399 } |
| 398 | 400 |
| 399 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { | 401 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { |
| 400 return address_->language_code; | 402 return address_->language_code; |
| 401 } | 403 } |
| 402 | 404 |
| 403 } // namespace autofill | 405 } // namespace autofill |
| OLD | NEW |