| 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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 MonthComboboxModel::~MonthComboboxModel() {} | 147 MonthComboboxModel::~MonthComboboxModel() {} |
| 148 | 148 |
| 149 int MonthComboboxModel::GetItemCount() const { | 149 int MonthComboboxModel::GetItemCount() const { |
| 150 // 12 months plus the empty entry. | 150 // 12 months plus the empty entry. |
| 151 return 13; | 151 return 13; |
| 152 } | 152 } |
| 153 | 153 |
| 154 // static | 154 // static |
| 155 base::string16 MonthComboboxModel::FormatMonth(int index) { | 155 base::string16 MonthComboboxModel::FormatMonth(int index) { |
| 156 return ASCIIToUTF16(base::StringPrintf("%.2d", index)); | 156 return base::ASCIIToUTF16(base::StringPrintf("%.2d", index)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 base::string16 MonthComboboxModel::GetItemAt(int index) { | 159 base::string16 MonthComboboxModel::GetItemAt(int index) { |
| 160 return index == 0 ? | 160 return index == 0 ? |
| 161 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_MONTH) : | 161 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_MONTH) : |
| 162 FormatMonth(index); | 162 FormatMonth(index); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // YearComboboxModel ----------------------------------------------------------- | 165 // YearComboboxModel ----------------------------------------------------------- |
| 166 | 166 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 181 base::string16 YearComboboxModel::GetItemAt(int index) { | 181 base::string16 YearComboboxModel::GetItemAt(int index) { |
| 182 if (index == 0) { | 182 if (index == 0) { |
| 183 return l10n_util::GetStringUTF16( | 183 return l10n_util::GetStringUTF16( |
| 184 IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR); | 184 IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR); |
| 185 } | 185 } |
| 186 | 186 |
| 187 return base::IntToString16(this_year_ + index - 1); | 187 return base::IntToString16(this_year_ + index - 1); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace autofill | 190 } // namespace autofill |
| OLD | NEW |