| 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/country_combobox_model.h" | 5 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 countries_.clear(); | 32 countries_.clear(); |
| 33 | 33 |
| 34 // Insert the default country at the top as well as in the ordered list. | 34 // Insert the default country at the top as well as in the ordered list. |
| 35 std::string default_country_code = | 35 std::string default_country_code = |
| 36 manager.GetDefaultCountryCodeForNewAddress(); | 36 manager.GetDefaultCountryCodeForNewAddress(); |
| 37 DCHECK(!default_country_code.empty()); | 37 DCHECK(!default_country_code.empty()); |
| 38 | 38 |
| 39 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 39 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 40 if (filter.is_null() || filter.Run(default_country_code)) { | 40 if (filter.is_null() || filter.Run(default_country_code)) { |
| 41 countries_.push_back(new AutofillCountry(default_country_code, app_locale)); | 41 countries_.push_back(new AutofillCountry(default_country_code, app_locale)); |
| 42 // The separator item. | 42 #if !defined(OS_ANDROID) |
| 43 // The separator item. On Android, there are separators after all items, so |
| 44 // this is unnecessary. |
| 43 countries_.push_back(NULL); | 45 countries_.push_back(NULL); |
| 46 #endif |
| 44 } | 47 } |
| 45 | 48 |
| 46 // The sorted list of countries. | 49 // The sorted list of countries. |
| 47 std::vector<std::string> available_countries; | 50 std::vector<std::string> available_countries; |
| 48 AutofillCountry::GetAvailableCountries(&available_countries); | 51 AutofillCountry::GetAvailableCountries(&available_countries); |
| 49 | 52 |
| 50 #if defined(ENABLE_AUTOFILL_DIALOG) | 53 #if defined(ENABLE_AUTOFILL_DIALOG) |
| 51 // Filter out the countries that do not have rules for address input and | 54 // Filter out the countries that do not have rules for address input and |
| 52 // validation. | 55 // validation. |
| 53 const std::vector<std::string>& addressinput_countries = | 56 const std::vector<std::string>& addressinput_countries = |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 96 |
| 94 bool CountryComboboxModel::IsItemSeparatorAt(int index) { | 97 bool CountryComboboxModel::IsItemSeparatorAt(int index) { |
| 95 return !countries_[index]; | 98 return !countries_[index]; |
| 96 } | 99 } |
| 97 | 100 |
| 98 std::string CountryComboboxModel::GetDefaultCountryCode() const { | 101 std::string CountryComboboxModel::GetDefaultCountryCode() const { |
| 99 return countries_[GetDefaultIndex()]->country_code(); | 102 return countries_[GetDefaultIndex()]->country_code(); |
| 100 } | 103 } |
| 101 | 104 |
| 102 } // namespace autofill | 105 } // namespace autofill |
| OLD | NEW |