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

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: sync 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(
34 int index) {
Ilya Sherman 2012/11/30 01:01:32 nit: Looks like this will fit on the previous line
Evan Stade 2012/11/30 22:55:25 Done.
35 return items_[index].second;
36 }
37
38 // MonthComboboxModel ----------------------------------------------------------
39
40 MonthComboboxModel::MonthComboboxModel() {}
41
42 MonthComboboxModel::~MonthComboboxModel() {}
43
44 int MonthComboboxModel::GetItemCount() const {
45 return 12;
46 }
47
48 string16 MonthComboboxModel::GetItemAt(int index) {
49 return ASCIIToUTF16(StringPrintf("%2d", index + 1));
50 }
51
52 // YearComboboxModel -----------------------------------------------------------
53
54 YearComboboxModel::YearComboboxModel() : this_year_(0) {
Ilya Sherman 2012/11/30 01:01:32 nit: No need to init this_year_ here since you ini
Evan Stade 2012/11/30 22:55:25 I think coverity still complains if you don't init
55 base::Time time = base::Time::Now();
56 base::Time::Exploded exploded;
57 time.LocalExplode(&exploded);
58 this_year_ = exploded.year;
59 }
60
61 YearComboboxModel::~YearComboboxModel() {}
62
63 int YearComboboxModel::GetItemCount() const {
64 return 10;
65 }
66
67 string16 YearComboboxModel::GetItemAt(int index) {
68 return base::IntToString16(this_year_ + index);
69 }
70
71 } // autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698