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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_comboboxes.h

Issue 11428071: support CC expiration dates in imperative autocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_comboboxes.h
diff --git a/chrome/browser/ui/autofill/autofill_dialog_comboboxes.h b/chrome/browser/ui/autofill/autofill_dialog_comboboxes.h
new file mode 100644
index 0000000000000000000000000000000000000000..5ab73dd1849e3fca4c207ac69b92c3a49aaac5df
--- /dev/null
+++ b/chrome/browser/ui/autofill/autofill_dialog_comboboxes.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMBOBOXES_H_
+#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMBOBOXES_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/string16.h"
+#include "ui/base/models/combobox_model.h"
+
+namespace autofill {
+
+// A model for the comboboxes that allow the user to select from different sets
+// of known data.
+class SuggestionsComboboxModel : public ui::ComboboxModel {
+ public:
+ SuggestionsComboboxModel();
+ virtual ~SuggestionsComboboxModel();
+
+ // Adds an item and its identifying key to the model.
+ void AddItem(const std::string& key, const string16& display_label);
+
+ // Returns the ID key for the item at |index|.
+ std::string GetItemKeyAt(int index) const;
+
+ // ui::Combobox implementation:
+ virtual int GetItemCount() const OVERRIDE;
+ virtual string16 GetItemAt(int index) OVERRIDE;
+
+ private:
+ // The items this model represents, in presentation order. The first
+ // string is the "key" which identifies the item. The second is the
+ // display string for the item.
+ std::vector<std::pair<std::string, string16> > items_;
+
+ DISALLOW_COPY_AND_ASSIGN(SuggestionsComboboxModel);
+};
+
+// A model for possible months in the Gregorian calendar.
+class MonthComboboxModel : public ui::ComboboxModel {
+ public:
+ MonthComboboxModel();
+ virtual ~MonthComboboxModel();
+
+ // ui::Combobox implementation:
+ virtual int GetItemCount() const OVERRIDE;
+ virtual string16 GetItemAt(int index) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MonthComboboxModel);
+};
+
+// A model for years between now and a decade hence.
+class YearComboboxModel : public ui::ComboboxModel {
+ public:
+ YearComboboxModel();
+ virtual ~YearComboboxModel();
+
+ // ui::Combobox implementation:
+ virtual int GetItemCount() const OVERRIDE;
+ virtual string16 GetItemAt(int index) OVERRIDE;
+
+ private:
+ // The current year (e.g., 2012).
+ int this_year_;
+
+ DISALLOW_COPY_AND_ASSIGN(YearComboboxModel);
+};
+
+} // autofill
+
+#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMBOBOXES_H_
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698