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

Side by Side 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 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 | Annotate | Revision Log
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 #include "chrome/browser/ui/autofill/autofill_dialog_comboboxes.h"
6
7 #include "base/string_number_conversions.h"
8 #include "base/stringprintf.h"
9 #include "base/time.h"
10 #include "base/utf_string_conversions.h"
11
12 namespace autofill {
13
14 // SuggestionsComboboxModel ----------------------------------------------------
15
16 SuggestionsComboboxModel::SuggestionsComboboxModel() {}
17
18 SuggestionsComboboxModel::~SuggestionsComboboxModel() {}
19
20 void SuggestionsComboboxModel::AddItem(
21 const std::string& key, const string16& item) {
22 items_.push_back(std::make_pair(key, item));
23 }
24
25 std::string SuggestionsComboboxModel::GetItemKeyAt(int index) const {
26 return items_[index].first;
27 }
28
29 int SuggestionsComboboxModel::GetItemCount() const {
30 return items_.size();
31 }
32
33 string16 SuggestionsComboboxModel::GetItemAt(int index) {
34 return items_[index].second;
35 }
36
37 // MonthComboboxModel ----------------------------------------------------------
38
39 MonthComboboxModel::MonthComboboxModel() {}
40
41 MonthComboboxModel::~MonthComboboxModel() {}
42
43 int MonthComboboxModel::GetItemCount() const {
44 return 12;
45 }
46
47 string16 MonthComboboxModel::GetItemAt(int index) {
48 return ASCIIToUTF16(StringPrintf("%2d", index + 1));
49 }
50
51 // YearComboboxModel -----------------------------------------------------------
52
53 YearComboboxModel::YearComboboxModel() : this_year_(0) {
54 base::Time time = base::Time::Now();
55 base::Time::Exploded exploded;
56 time.LocalExplode(&exploded);
57 this_year_ = exploded.year;
58 }
59
60 YearComboboxModel::~YearComboboxModel() {}
61
62 int YearComboboxModel::GetItemCount() const {
63 return 10;
64 }
65
66 string16 YearComboboxModel::GetItemAt(int index) {
67 return base::IntToString16(this_year_ + index);
68 }
69
70 } // autofill
OLDNEW
« 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