| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 76 std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const { | 76 std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const { | 
| 77   if (items_.empty()) | 77   if (items_.empty()) | 
| 78     return std::string(); | 78     return std::string(); | 
| 79 | 79 | 
| 80   return items_[checked_item_].key; | 80   return items_[checked_item_].key; | 
| 81 } | 81 } | 
| 82 | 82 | 
| 83 void SuggestionsMenuModel::SetCheckedItem(const std::string& item_key) { | 83 void SuggestionsMenuModel::SetCheckedItem(const std::string& item_key) { | 
| 84   for (size_t i = 0; i < items_.size(); ++i) { | 84   for (size_t i = 0; i < items_.size(); ++i) { | 
| 85     if (items_[i].key == item_key) { | 85     if (items_[i].key == item_key) { | 
| 86       checked_item_ = i; | 86       if (IsEnabledAt(i)) | 
|  | 87         checked_item_ = i; | 
| 87       break; | 88       break; | 
| 88     } | 89     } | 
| 89   } | 90   } | 
| 90 } | 91 } | 
| 91 | 92 | 
| 92 void SuggestionsMenuModel::SetCheckedIndex(size_t index) { | 93 void SuggestionsMenuModel::SetCheckedIndex(size_t index) { | 
| 93   DCHECK_LT(index, items_.size()); | 94   DCHECK_LT(index, items_.size()); | 
| 94   checked_item_ = index; | 95   checked_item_ = index; | 
| 95 } | 96 } | 
| 96 | 97 | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 181 base::string16 YearComboboxModel::GetItemAt(int index) { | 182 base::string16 YearComboboxModel::GetItemAt(int index) { | 
| 182   if (index == 0) { | 183   if (index == 0) { | 
| 183     return l10n_util::GetStringUTF16( | 184     return l10n_util::GetStringUTF16( | 
| 184         IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR); | 185         IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR); | 
| 185   } | 186   } | 
| 186 | 187 | 
| 187   return base::IntToString16(this_year_ + index - 1); | 188   return base::IntToString16(this_year_ + index - 1); | 
| 188 } | 189 } | 
| 189 | 190 | 
| 190 }  // namespace autofill | 191 }  // namespace autofill | 
| OLD | NEW | 
|---|