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

Unified Diff: components/autofill/core/browser/country_combobox_model.cc

Issue 2705773002: [Autofill] Move country combo box model from chrome to component. (Closed)
Patch Set: Rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/country_combobox_model.cc
diff --git a/chrome/browser/ui/autofill/country_combobox_model.cc b/components/autofill/core/browser/country_combobox_model.cc
similarity index 89%
rename from chrome/browser/ui/autofill/country_combobox_model.cc
rename to components/autofill/core/browser/country_combobox_model.cc
index 9a2c147e9eae641538e77894b4fa9aa019717c2d..c9f8a47a21742f7b32cab5a57a0ddd06f9c0c704 100644
--- a/chrome/browser/ui/autofill/country_combobox_model.cc
+++ b/components/autofill/core/browser/country_combobox_model.cc
@@ -2,16 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/autofill/country_combobox_model.h"
+#include "components/autofill/core/browser/country_combobox_model.h"
#include <algorithm>
#include <iterator>
+#include <utility>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "build/build_config.h"
-#include "chrome/browser/browser_process.h"
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/country_data.h"
#include "components/autofill/core/browser/personal_data_manager.h"
@@ -27,7 +26,8 @@ CountryComboboxModel::~CountryComboboxModel() {}
void CountryComboboxModel::SetCountries(
const PersonalDataManager& manager,
- const base::Callback<bool(const std::string&)>& filter) {
+ const base::Callback<bool(const std::string&)>& filter,
+ const std::string& app_locale) {
countries_.clear();
// Insert the default country at the top as well as in the ordered list.
@@ -35,7 +35,6 @@ void CountryComboboxModel::SetCountries(
manager.GetDefaultCountryCodeForNewAddress();
DCHECK(!default_country_code.empty());
- const std::string& app_locale = g_browser_process->GetApplicationLocale();
if (filter.is_null() || filter.Run(default_country_code)) {
countries_.push_back(
base::MakeUnique<AutofillCountry>(default_country_code, app_locale));
@@ -69,8 +68,7 @@ void CountryComboboxModel::SetCountries(
base::MakeUnique<AutofillCountry>(country_code, app_locale));
}
- l10n_util::SortStringsUsingMethod(app_locale,
- &sorted_countries,
+ l10n_util::SortStringsUsingMethod(app_locale, &sorted_countries,
&AutofillCountry::name);
std::move(sorted_countries.begin(), sorted_countries.end(),
std::back_inserter(countries_));

Powered by Google App Engine
This is Rietveld 408576698