| Index: chrome/browser/ui/autofill/country_combobox_model.cc
|
| diff --git a/chrome/browser/ui/autofill/country_combobox_model.cc b/chrome/browser/ui/autofill/country_combobox_model.cc
|
| index a5d9f62c282b05b70f652a31a0939936d72b1f22..fda64cb4407d06e7e507e3f2c62be4a13dfa2154 100644
|
| --- a/chrome/browser/ui/autofill/country_combobox_model.cc
|
| +++ b/chrome/browser/ui/autofill/country_combobox_model.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "chrome/browser/ui/autofill/country_combobox_model.h"
|
|
|
| +#include <algorithm>
|
| +#include <iterator>
|
| +
|
| #include "base/logging.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/browser_process.h"
|
| @@ -14,7 +17,7 @@
|
|
|
| // TODO(rouslan): Remove this check. http://crbug.com/337587
|
| #if defined(ENABLE_AUTOFILL_DIALOG)
|
| -#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h"
|
| +#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui.h"
|
| #endif
|
|
|
| namespace autofill {
|
| @@ -41,12 +44,22 @@ void CountryComboboxModel::SetCountries(
|
| }
|
|
|
| // The sorted list of countries.
|
| -#if defined(ENABLE_AUTOFILL_DIALOG)
|
| - const std::vector<std::string>& available_countries =
|
| - ::i18n::addressinput::GetRegionCodes();
|
| -#else
|
| std::vector<std::string> available_countries;
|
| AutofillCountry::GetAvailableCountries(&available_countries);
|
| +
|
| +#if defined(ENABLE_AUTOFILL_DIALOG)
|
| + // Filter out the countries that do not have rules for address input and
|
| + // validation.
|
| + const std::vector<std::string>& addressinput_countries =
|
| + ::i18n::addressinput::GetRegionCodes();
|
| + std::vector<std::string> filtered_countries;
|
| + filtered_countries.reserve(available_countries.size());
|
| + std::set_intersection(available_countries.begin(),
|
| + available_countries.end(),
|
| + addressinput_countries.begin(),
|
| + addressinput_countries.end(),
|
| + std::back_inserter(filtered_countries));
|
| + available_countries.swap(filtered_countries);
|
| #endif
|
|
|
| std::vector<AutofillCountry*> sorted_countries;
|
|
|