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

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

Issue 2918133002: [Merge M60][Payments] Refactor the year and month combobox models and preselect. (Closed)
Patch Set: Created 3 years, 6 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/autofill_dialog_models.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_AUTOFILL_DIALOG_MODELS_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "ui/base/models/combobox_model.h" 16 #include "ui/base/models/combobox_model.h"
17 #include "ui/base/models/simple_combobox_model.h"
17 #include "ui/base/models/simple_menu_model.h" 18 #include "ui/base/models/simple_menu_model.h"
18 19
19 namespace autofill { 20 namespace autofill {
20 21
21 class SuggestionsMenuModel; 22 class SuggestionsMenuModel;
22 23
23 class SuggestionsMenuModelDelegate { 24 class SuggestionsMenuModelDelegate {
24 public: 25 public:
25 virtual ~SuggestionsMenuModelDelegate(); 26 virtual ~SuggestionsMenuModelDelegate();
26 27
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 DISALLOW_COPY_AND_ASSIGN(SuggestionsMenuModel); 109 DISALLOW_COPY_AND_ASSIGN(SuggestionsMenuModel);
109 }; 110 };
110 111
111 // A model for possible months in the Gregorian calendar. 112 // A model for possible months in the Gregorian calendar.
112 class MonthComboboxModel : public ui::ComboboxModel { 113 class MonthComboboxModel : public ui::ComboboxModel {
113 public: 114 public:
114 MonthComboboxModel(); 115 MonthComboboxModel();
115 ~MonthComboboxModel() override; 116 ~MonthComboboxModel() override;
116 117
117 static base::string16 FormatMonth(int index);
118
119 // ui::Combobox implementation: 118 // ui::Combobox implementation:
120 int GetItemCount() const override; 119 int GetItemCount() const override;
121 base::string16 GetItemAt(int index) override; 120 base::string16 GetItemAt(int index) override;
122 121
123 private: 122 private:
124 DISALLOW_COPY_AND_ASSIGN(MonthComboboxModel); 123 DISALLOW_COPY_AND_ASSIGN(MonthComboboxModel);
125 }; 124 };
126 125
127 // A model for years between now and a decade hence. 126 // A model for years between now and a decade hence.
128 class YearComboboxModel : public ui::ComboboxModel { 127 class YearComboboxModel : public ui::SimpleComboboxModel {
129 public: 128 public:
130 YearComboboxModel(); 129 // If |additional_year| is not in the year range initially in this model
130 // [current year, current year + 9], this will add |additional_year| to the
131 // model. Passing 0 has no effect.
132 explicit YearComboboxModel(int additional_year = 0);
131 ~YearComboboxModel() override; 133 ~YearComboboxModel() override;
132 134
133 // ui::Combobox implementation:
134 int GetItemCount() const override;
135 base::string16 GetItemAt(int index) override;
136
137 private: 135 private:
138 // The current year (e.g., 2012).
139 int this_year_;
140
141 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); 136 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel);
142 }; 137 };
143 138
144 } // namespace autofill 139 } // namespace autofill
145 140
146 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ 141 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/autofill/autofill_dialog_models.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698