OLD | NEW |
---|---|
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 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 | 188 |
189 MonthComboboxModel::~MonthComboboxModel() {} | 189 MonthComboboxModel::~MonthComboboxModel() {} |
190 | 190 |
191 int MonthComboboxModel::GetItemCount() const { | 191 int MonthComboboxModel::GetItemCount() const { |
192 // 12 months plus the empty entry. | 192 // 12 months plus the empty entry. |
193 return 13; | 193 return 13; |
194 } | 194 } |
195 | 195 |
196 // static | 196 // static |
197 string16 MonthComboboxModel::FormatMonth(int index) { | 197 string16 MonthComboboxModel::FormatMonth(int index) { |
198 return ASCIIToUTF16(base::StringPrintf("%2d", index)); | 198 return ASCIIToUTF16(base::StringPrintf("%.2d", index)); |
Evan Stade
2013/04/05 23:24:01
isherman: NB
| |
199 } | 199 } |
200 | 200 |
201 string16 MonthComboboxModel::GetItemAt(int index) { | 201 string16 MonthComboboxModel::GetItemAt(int index) { |
202 return index == 0 ? string16() : FormatMonth(index); | 202 return index == 0 ? string16() : FormatMonth(index); |
203 } | 203 } |
204 | 204 |
205 // YearComboboxModel ----------------------------------------------------------- | 205 // YearComboboxModel ----------------------------------------------------------- |
206 | 206 |
207 YearComboboxModel::YearComboboxModel() : this_year_(0) { | 207 YearComboboxModel::YearComboboxModel() : this_year_(0) { |
208 base::Time time = base::Time::Now(); | 208 base::Time time = base::Time::Now(); |
(...skipping 10 matching lines...) Expand all Loading... | |
219 } | 219 } |
220 | 220 |
221 string16 YearComboboxModel::GetItemAt(int index) { | 221 string16 YearComboboxModel::GetItemAt(int index) { |
222 if (index == 0) | 222 if (index == 0) |
223 return string16(); | 223 return string16(); |
224 | 224 |
225 return base::IntToString16(this_year_ + index - 1); | 225 return base::IntToString16(this_year_ + index - 1); |
226 } | 226 } |
227 | 227 |
228 } // autofill | 228 } // autofill |
OLD | NEW |