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

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

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
Index: chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc b/chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a858feb05941c7041e725ae29a4df6b088c2f1cb
--- /dev/null
+++ b/chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc
@@ -0,0 +1,70 @@
+// 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.
+
+#include "chrome/browser/ui/autofill/autofill_dialog_comboboxes.h"
+
+#include "base/string_number_conversions.h"
+#include "base/stringprintf.h"
+#include "base/time.h"
+#include "base/utf_string_conversions.h"
+
+namespace autofill {
+
+// SuggestionsComboboxModel ----------------------------------------------------
+
+SuggestionsComboboxModel::SuggestionsComboboxModel() {}
+
+SuggestionsComboboxModel::~SuggestionsComboboxModel() {}
+
+void SuggestionsComboboxModel::AddItem(
+ const std::string& key, const string16& item) {
+ items_.push_back(std::make_pair(key, item));
+}
+
+std::string SuggestionsComboboxModel::GetItemKeyAt(int index) const {
+ return items_[index].first;
+}
+
+int SuggestionsComboboxModel::GetItemCount() const {
+ return items_.size();
+}
+
+string16 SuggestionsComboboxModel::GetItemAt(int index) {
+ return items_[index].second;
+}
+
+// MonthComboboxModel ----------------------------------------------------------
+
+MonthComboboxModel::MonthComboboxModel() {}
+
+MonthComboboxModel::~MonthComboboxModel() {}
+
+int MonthComboboxModel::GetItemCount() const {
+ return 12;
+}
+
+string16 MonthComboboxModel::GetItemAt(int index) {
+ return ASCIIToUTF16(StringPrintf("%2d", index + 1));
+}
+
+// YearComboboxModel -----------------------------------------------------------
+
+YearComboboxModel::YearComboboxModel() : this_year_(0) {
+ base::Time time = base::Time::Now();
+ base::Time::Exploded exploded;
+ time.LocalExplode(&exploded);
+ this_year_ = exploded.year;
+}
+
+YearComboboxModel::~YearComboboxModel() {}
+
+int YearComboboxModel::GetItemCount() const {
+ return 10;
+}
+
+string16 YearComboboxModel::GetItemAt(int index) {
+ return base::IntToString16(this_year_ + index);
+}
+
+} // autofill
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_comboboxes.h ('k') | chrome/browser/ui/autofill/autofill_dialog_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698