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

Side by Side Diff: chrome/browser/ui/autofill/country_combobox_model.h

Issue 2705773002: [Autofill] Move country combo box model from chrome to component. (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/autofill/country_combobox_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
7
8 #include <memory>
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include "base/callback.h"
14 #include "base/compiler_specific.h"
15 #include "base/macros.h"
16 #include "base/memory/scoped_vector.h"
17 #include "ui/base/models/combobox_model.h"
18
19 namespace autofill {
20
21 class AutofillCountry;
22 class PersonalDataManager;
23
24 // A model for countries to be used to enter addresses.
25 class CountryComboboxModel : public ui::ComboboxModel {
26 public:
27 using CountryVector = std::vector<std::unique_ptr<AutofillCountry>>;
28
29 CountryComboboxModel();
30 ~CountryComboboxModel() override;
31
32 // |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).
34 // |manager| determines the default choice.
35 void SetCountries(const PersonalDataManager& manager,
36 const base::Callback<bool(const std::string&)>& filter);
37
38 // ui::ComboboxModel implementation:
39 int GetItemCount() const override;
40 base::string16 GetItemAt(int index) override;
41 bool IsItemSeparatorAt(int index) override;
42
43 const CountryVector& countries() const { return countries_; }
44
45 // Returns the default country code for this model.
46 std::string GetDefaultCountryCode() const;
47
48 private:
49 // The countries to show in the model, including NULL for entries that are
50 // not countries (the separator entry).
51 CountryVector countries_;
52
53 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel);
54 };
55
56 } // namespace autofill
57
58 #endif // CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/autofill/country_combobox_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698