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/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 checked_item_(0) {} | 22 checked_item_(0) {} |
23 | 23 |
24 SuggestionsMenuModel::~SuggestionsMenuModel() {} | 24 SuggestionsMenuModel::~SuggestionsMenuModel() {} |
25 | 25 |
26 void SuggestionsMenuModel::AddKeyedItem( | 26 void SuggestionsMenuModel::AddKeyedItem( |
27 const std::string& key, const string16& item) { | 27 const std::string& key, const string16& item) { |
28 items_.push_back(std::make_pair(key, item)); | 28 items_.push_back(std::make_pair(key, item)); |
29 AddCheckItem(items_.size() - 1, item); | 29 AddCheckItem(items_.size() - 1, item); |
30 } | 30 } |
31 | 31 |
| 32 void SuggestionsMenuModel::Reset() { |
| 33 checked_item_ = 0; |
| 34 items_.clear(); |
| 35 Clear(); |
| 36 } |
| 37 |
32 std::string SuggestionsMenuModel::GetItemKeyAt(int index) const { | 38 std::string SuggestionsMenuModel::GetItemKeyAt(int index) const { |
33 return items_[index].first; | 39 return items_[index].first; |
34 } | 40 } |
35 | 41 |
36 bool SuggestionsMenuModel::IsCommandIdChecked( | 42 bool SuggestionsMenuModel::IsCommandIdChecked( |
37 int command_id) const { | 43 int command_id) const { |
38 return checked_item_ == command_id; | 44 return checked_item_ == command_id; |
39 } | 45 } |
40 | 46 |
41 bool SuggestionsMenuModel::IsCommandIdEnabled( | 47 bool SuggestionsMenuModel::IsCommandIdEnabled( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 87 |
82 int YearComboboxModel::GetItemCount() const { | 88 int YearComboboxModel::GetItemCount() const { |
83 return 10; | 89 return 10; |
84 } | 90 } |
85 | 91 |
86 string16 YearComboboxModel::GetItemAt(int index) { | 92 string16 YearComboboxModel::GetItemAt(int index) { |
87 return base::IntToString16(this_year_ + index); | 93 return base::IntToString16(this_year_ + index); |
88 } | 94 } |
89 | 95 |
90 } // autofill | 96 } // autofill |
OLD | NEW |