| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 bool MenuModel::IsVisibleAt(int index) const { |
| 10 return true; |
| 11 } |
| 12 |
| 9 bool MenuModel::GetModelAndIndexForCommandId(int command_id, | 13 bool MenuModel::GetModelAndIndexForCommandId(int command_id, |
| 10 MenuModel** model, int* index) { | 14 MenuModel** model, int* index) { |
| 11 int item_count = (*model)->GetItemCount(); | 15 int item_count = (*model)->GetItemCount(); |
| 12 for (int i = 0; i < item_count; ++i) { | 16 for (int i = 0; i < item_count; ++i) { |
| 13 if ((*model)->GetTypeAt(i) == TYPE_SUBMENU) { | 17 if ((*model)->GetTypeAt(i) == TYPE_SUBMENU) { |
| 14 MenuModel* submenu_model = (*model)->GetSubmenuModelAt(i); | 18 MenuModel* submenu_model = (*model)->GetSubmenuModelAt(i); |
| 15 if (GetModelAndIndexForCommandId(command_id, &submenu_model, index)) { | 19 if (GetModelAndIndexForCommandId(command_id, &submenu_model, index)) { |
| 16 *model = submenu_model; | 20 *model = submenu_model; |
| 17 return true; | 21 return true; |
| 18 } | 22 } |
| 19 } | 23 } |
| 20 if ((*model)->GetCommandIdAt(i) == command_id) { | 24 if ((*model)->GetCommandIdAt(i) == command_id) { |
| 21 *index = i; | 25 *index = i; |
| 22 return true; | 26 return true; |
| 23 } | 27 } |
| 24 } | 28 } |
| 25 return false; | 29 return false; |
| 26 } | 30 } |
| 27 | 31 |
| 28 } // namespace | 32 } // namespace |
| OLD | NEW |