OLD | NEW |
| (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_AUTOFILL_DIALOG_COMBOBOXES_H_ | |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMBOBOXES_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "base/string16.h" | |
14 #include "ui/base/models/combobox_model.h" | |
15 | |
16 namespace autofill { | |
17 | |
18 // A model for the comboboxes that allow the user to select from different sets | |
19 // of known data. | |
20 class SuggestionsComboboxModel : public ui::ComboboxModel { | |
21 public: | |
22 SuggestionsComboboxModel(); | |
23 virtual ~SuggestionsComboboxModel(); | |
24 | |
25 // Adds an item and its identifying key to the model. | |
26 void AddItem(const std::string& key, const string16& display_label); | |
27 | |
28 // Returns the ID key for the item at |index|. | |
29 std::string GetItemKeyAt(int index) const; | |
30 | |
31 // ui::Combobox implementation: | |
32 virtual int GetItemCount() const OVERRIDE; | |
33 virtual string16 GetItemAt(int index) OVERRIDE; | |
34 | |
35 private: | |
36 // The items this model represents, in presentation order. The first | |
37 // string is the "key" which identifies the item. The second is the | |
38 // display string for the item. | |
39 std::vector<std::pair<std::string, string16> > items_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(SuggestionsComboboxModel); | |
42 }; | |
43 | |
44 // A model for possible months in the Gregorian calendar. | |
45 class MonthComboboxModel : public ui::ComboboxModel { | |
46 public: | |
47 MonthComboboxModel(); | |
48 virtual ~MonthComboboxModel(); | |
49 | |
50 // ui::Combobox implementation: | |
51 virtual int GetItemCount() const OVERRIDE; | |
52 virtual string16 GetItemAt(int index) OVERRIDE; | |
53 | |
54 private: | |
55 DISALLOW_COPY_AND_ASSIGN(MonthComboboxModel); | |
56 }; | |
57 | |
58 // A model for years between now and a decade hence. | |
59 class YearComboboxModel : public ui::ComboboxModel { | |
60 public: | |
61 YearComboboxModel(); | |
62 virtual ~YearComboboxModel(); | |
63 | |
64 // ui::Combobox implementation: | |
65 virtual int GetItemCount() const OVERRIDE; | |
66 virtual string16 GetItemAt(int index) OVERRIDE; | |
67 | |
68 private: | |
69 // The current year (e.g., 2012). | |
70 int this_year_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); | |
73 }; | |
74 | |
75 } // autofill | |
76 | |
77 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMBOBOXES_H_ | |
OLD | NEW |