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/menu_model.h" | 5 #include "app/menus/menu_model.h" |
6 | 6 |
7 namespace menus { | 7 namespace menus { |
8 | 8 |
| 9 int MenuModel::GetFirstItemIndex(gfx::NativeMenu native_menu) const { |
| 10 return 0; |
| 11 } |
| 12 |
9 bool MenuModel::IsVisibleAt(int index) const { | 13 bool MenuModel::IsVisibleAt(int index) const { |
10 return true; | 14 return true; |
11 } | 15 } |
12 | 16 |
13 bool MenuModel::GetModelAndIndexForCommandId(int command_id, | 17 bool MenuModel::GetModelAndIndexForCommandId(int command_id, |
14 MenuModel** model, int* index) { | 18 MenuModel** model, int* index) { |
15 int item_count = (*model)->GetItemCount(); | 19 int item_count = (*model)->GetItemCount(); |
16 for (int i = 0; i < item_count; ++i) { | 20 for (int i = 0; i < item_count; ++i) { |
17 if ((*model)->GetTypeAt(i) == TYPE_SUBMENU) { | 21 if ((*model)->GetTypeAt(i) == TYPE_SUBMENU) { |
18 MenuModel* submenu_model = (*model)->GetSubmenuModelAt(i); | 22 MenuModel* submenu_model = (*model)->GetSubmenuModelAt(i); |
19 if (GetModelAndIndexForCommandId(command_id, &submenu_model, index)) { | 23 if (GetModelAndIndexForCommandId(command_id, &submenu_model, index)) { |
20 *model = submenu_model; | 24 *model = submenu_model; |
21 return true; | 25 return true; |
22 } | 26 } |
23 } | 27 } |
24 if ((*model)->GetCommandIdAt(i) == command_id) { | 28 if ((*model)->GetCommandIdAt(i) == command_id) { |
25 *index = i; | 29 *index = i; |
26 return true; | 30 return true; |
27 } | 31 } |
28 } | 32 } |
29 return false; | 33 return false; |
30 } | 34 } |
31 | 35 |
| 36 const gfx::Font* MenuModel::GetLabelFontAt(int index) const { |
| 37 return NULL; |
| 38 } |
| 39 |
32 // Default implementation ignores the disposition. | 40 // Default implementation ignores the disposition. |
33 void MenuModel::ActivatedAtWithDisposition(int index, int disposition) { | 41 void MenuModel::ActivatedAtWithDisposition(int index, int disposition) { |
34 ActivatedAt(index); | 42 ActivatedAt(index); |
35 } | 43 } |
36 | 44 |
37 } // namespace | 45 } // namespace |
OLD | NEW |