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

Side by Side Diff: components/autofill/core/browser/country_combobox_model.h

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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set>
10 #include <string> 9 #include <string>
11 #include <vector> 10 #include <vector>
12 11
13 #include "base/callback.h" 12 #include "base/callback.h"
14 #include "base/compiler_specific.h"
15 #include "base/macros.h" 13 #include "base/macros.h"
16 #include "base/memory/scoped_vector.h"
17 #include "ui/base/models/combobox_model.h" 14 #include "ui/base/models/combobox_model.h"
18 15
19 namespace autofill { 16 namespace autofill {
20 17
21 class AutofillCountry; 18 class AutofillCountry;
22 class PersonalDataManager; 19 class PersonalDataManager;
23 20
24 // A model for countries to be used to enter addresses. 21 // A model for countries to be used to enter addresses.
25 class CountryComboboxModel : public ui::ComboboxModel { 22 class CountryComboboxModel : public ui::ComboboxModel {
26 public: 23 public:
27 using CountryVector = std::vector<std::unique_ptr<AutofillCountry>>; 24 using CountryVector = std::vector<std::unique_ptr<AutofillCountry>>;
28 25
29 CountryComboboxModel(); 26 CountryComboboxModel();
30 ~CountryComboboxModel() override; 27 ~CountryComboboxModel() override;
31 28
32 // |filter| is passed each known country's country code. If |filter| returns 29 // |filter| is passed each known country's country code. If |filter| returns
33 // true, an item for that country is added to the model (else it's omitted). 30 // true, an item for that country is added to the model (else it's omitted).
34 // |manager| determines the default choice. 31 // |manager| determines the default choice.
35 void SetCountries(const PersonalDataManager& manager, 32 void SetCountries(const PersonalDataManager& manager,
36 const base::Callback<bool(const std::string&)>& filter); 33 const base::Callback<bool(const std::string&)>& filter,
34 const std::string& app_locale);
37 35
38 // ui::ComboboxModel implementation: 36 // ui::ComboboxModel implementation:
39 int GetItemCount() const override; 37 int GetItemCount() const override;
40 base::string16 GetItemAt(int index) override; 38 base::string16 GetItemAt(int index) override;
41 bool IsItemSeparatorAt(int index) override; 39 bool IsItemSeparatorAt(int index) override;
42 40
43 const CountryVector& countries() const { return countries_; } 41 const CountryVector& countries() const { return countries_; }
44 42
45 // Returns the default country code for this model. 43 // Returns the default country code for this model.
46 std::string GetDefaultCountryCode() const; 44 std::string GetDefaultCountryCode() const;
47 45
48 private: 46 private:
49 // The countries to show in the model, including NULL for entries that are 47 // The countries to show in the model, including NULL for entries that are
50 // not countries (the separator entry). 48 // not countries (the separator entry).
51 CountryVector countries_; 49 CountryVector countries_;
52 50
53 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel); 51 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel);
54 }; 52 };
55 53
56 } // namespace autofill 54 } // namespace autofill
57 55
58 #endif // CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ 56 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/country_combobox_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698