OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/menus/button_menu_item_model.h" | 5 #include "app/menus/button_menu_item_model.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 | 8 |
9 namespace menus { | 9 namespace menus { |
10 | 10 |
11 bool ButtonMenuItemModel::Delegate::IsLabelForCommandIdDynamic( | 11 bool ButtonMenuItemModel::Delegate::IsItemForCommandIdDynamic( |
12 int command_id) const { | 12 int command_id) const { |
13 return false; | 13 return false; |
14 } | 14 } |
15 | 15 |
16 string16 ButtonMenuItemModel::Delegate::GetLabelForCommandId( | 16 string16 ButtonMenuItemModel::Delegate::GetLabelForCommandId( |
17 int command_id) const { | 17 int command_id) const { |
18 return string16(); | 18 return string16(); |
19 } | 19 } |
20 | 20 |
21 bool ButtonMenuItemModel::Delegate::IsCommandIdEnabled(int command_id) const { | 21 bool ButtonMenuItemModel::Delegate::IsCommandIdEnabled(int command_id) const { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 ButtonMenuItemModel::ButtonType ButtonMenuItemModel::GetTypeAt( | 76 ButtonMenuItemModel::ButtonType ButtonMenuItemModel::GetTypeAt( |
77 int index) const { | 77 int index) const { |
78 return items_[index].type; | 78 return items_[index].type; |
79 } | 79 } |
80 | 80 |
81 int ButtonMenuItemModel::GetCommandIdAt(int index) const { | 81 int ButtonMenuItemModel::GetCommandIdAt(int index) const { |
82 return items_[index].command_id; | 82 return items_[index].command_id; |
83 } | 83 } |
84 | 84 |
85 bool ButtonMenuItemModel::IsLabelDynamicAt(int index) const { | 85 bool ButtonMenuItemModel::IsItemDynamicAt(int index) const { |
86 if (delegate_) | 86 if (delegate_) |
87 return delegate_->IsLabelForCommandIdDynamic(GetCommandIdAt(index)); | 87 return delegate_->IsItemForCommandIdDynamic(GetCommandIdAt(index)); |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 string16 ButtonMenuItemModel::GetLabelAt(int index) const { | 91 string16 ButtonMenuItemModel::GetLabelAt(int index) const { |
92 if (IsLabelDynamicAt(index)) | 92 if (IsItemDynamicAt(index)) |
93 return delegate_->GetLabelForCommandId(GetCommandIdAt(index)); | 93 return delegate_->GetLabelForCommandId(GetCommandIdAt(index)); |
94 return items_[index].label; | 94 return items_[index].label; |
95 } | 95 } |
96 | 96 |
97 bool ButtonMenuItemModel::GetIconAt(int index, int* icon_idr) const { | 97 bool ButtonMenuItemModel::GetIconAt(int index, int* icon_idr) const { |
98 if (items_[index].icon_idr == -1) | 98 if (items_[index].icon_idr == -1) |
99 return false; | 99 return false; |
100 | 100 |
101 *icon_idr = items_[index].icon_idr; | 101 *icon_idr = items_[index].icon_idr; |
102 return true; | 102 return true; |
(...skipping 23 matching lines...) Expand all Loading... |
126 } | 126 } |
127 | 127 |
128 bool ButtonMenuItemModel::DoesCommandIdDismissMenu(int command_id) const { | 128 bool ButtonMenuItemModel::DoesCommandIdDismissMenu(int command_id) const { |
129 if (delegate_) | 129 if (delegate_) |
130 return delegate_->DoesCommandIdDismissMenu(command_id); | 130 return delegate_->DoesCommandIdDismissMenu(command_id); |
131 return true; | 131 return true; |
132 } | 132 } |
133 | 133 |
134 | 134 |
135 } // namespace menus | 135 } // namespace menus |
OLD | NEW |