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 25 matching lines...) Expand all Loading... |
36 items_.push_back(std::make_pair(key, item)); | 36 items_.push_back(std::make_pair(key, item)); |
37 AddCheckItem(items_.size() - 1, item); | 37 AddCheckItem(items_.size() - 1, item); |
38 } | 38 } |
39 | 39 |
40 void SuggestionsMenuModel::AddKeyedItemWithIcon( | 40 void SuggestionsMenuModel::AddKeyedItemWithIcon( |
41 const std::string& key, const string16& item, const gfx::Image& icon) { | 41 const std::string& key, const string16& item, const gfx::Image& icon) { |
42 AddKeyedItem(key, item); | 42 AddKeyedItem(key, item); |
43 SetIcon(items_.size() - 1, icon); | 43 SetIcon(items_.size() - 1, icon); |
44 } | 44 } |
45 | 45 |
| 46 void SuggestionsMenuModel::AddKeyedItemWithSublabel( |
| 47 const std::string& key, |
| 48 const string16& display_label, const string16& display_sublabel) { |
| 49 AddKeyedItem(key, display_label); |
| 50 SetSublabel(items_.size() - 1, display_sublabel); |
| 51 } |
| 52 |
| 53 void SuggestionsMenuModel::AddKeyedItemWithSublabelAndIcon( |
| 54 const std::string& key, |
| 55 const string16& display_label, const string16& display_sublabel, |
| 56 const gfx::Image& icon) { |
| 57 AddKeyedItemWithIcon(key, display_label, icon); |
| 58 SetSublabel(items_.size() - 1, display_sublabel); |
| 59 } |
| 60 |
46 void SuggestionsMenuModel::Reset() { | 61 void SuggestionsMenuModel::Reset() { |
47 checked_item_ = 0; | 62 checked_item_ = 0; |
48 items_.clear(); | 63 items_.clear(); |
49 Clear(); | 64 Clear(); |
50 } | 65 } |
51 | 66 |
52 std::string SuggestionsMenuModel::GetItemKeyAt(int index) const { | 67 std::string SuggestionsMenuModel::GetItemKeyAt(int index) const { |
53 return items_[index].first; | 68 return items_[index].first; |
54 } | 69 } |
55 | 70 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 212 } |
198 | 213 |
199 string16 YearComboboxModel::GetItemAt(int index) { | 214 string16 YearComboboxModel::GetItemAt(int index) { |
200 if (index == 0) | 215 if (index == 0) |
201 return string16(); | 216 return string16(); |
202 | 217 |
203 return base::IntToString16(this_year_ + index - 1); | 218 return base::IntToString16(this_year_ + index - 1); |
204 } | 219 } |
205 | 220 |
206 } // autofill | 221 } // autofill |
OLD | NEW |