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/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool SuggestionsMenuModel::IsCommandIdEnabled( | 105 bool SuggestionsMenuModel::IsCommandIdEnabled( |
106 int command_id) const { | 106 int command_id) const { |
107 // Please note: command_id is same as the 0-based index in |items_|. | 107 // Please note: command_id is same as the 0-based index in |items_|. |
108 DCHECK_GE(command_id, 0); | 108 DCHECK_GE(command_id, 0); |
109 DCHECK_LT(static_cast<size_t>(command_id), items_.size()); | 109 DCHECK_LT(static_cast<size_t>(command_id), items_.size()); |
110 return items_[command_id].enabled; | 110 return items_[command_id].enabled; |
111 } | 111 } |
112 | 112 |
113 bool SuggestionsMenuModel::GetAcceleratorForCommandId( | 113 bool SuggestionsMenuModel::GetAcceleratorForCommandId( |
114 int command_id, | 114 int command_id, |
115 ui::Accelerator* accelerator) { | 115 ui::Accelerator* accelerator) const { |
116 return false; | 116 return false; |
117 } | 117 } |
118 | 118 |
119 void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) { | 119 void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) { |
120 delegate_->SuggestionItemSelected(this, command_id); | 120 delegate_->SuggestionItemSelected(this, command_id); |
121 } | 121 } |
122 | 122 |
123 size_t SuggestionsMenuModel::GetItemIndex(const std::string& item_key) { | 123 size_t SuggestionsMenuModel::GetItemIndex(const std::string& item_key) { |
124 for (size_t i = 0; i < items_.size(); ++i) { | 124 for (size_t i = 0; i < items_.size(); ++i) { |
125 if (items_[i].key == item_key) | 125 if (items_[i].key == item_key) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 base::string16 YearComboboxModel::GetItemAt(int index) { | 171 base::string16 YearComboboxModel::GetItemAt(int index) { |
172 if (index == 0) { | 172 if (index == 0) { |
173 return l10n_util::GetStringUTF16( | 173 return l10n_util::GetStringUTF16( |
174 IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR); | 174 IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR); |
175 } | 175 } |
176 | 176 |
177 return base::IntToString16(this_year_ + index - 1); | 177 return base::IntToString16(this_year_ + index - 1); |
178 } | 178 } |
179 | 179 |
180 } // namespace autofill | 180 } // namespace autofill |
OLD | NEW |