1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/models/menu_model.h"
9 bool MenuModel::IsVisibleAt(int index
) const {
14 bool MenuModel::GetModelAndIndexForCommandId(int command_id
,
17 const int item_count
= (*model
)->GetItemCount();
18 for (int i
= 0; i
< item_count
; ++i
) {
19 const int candidate_index
= i
;
20 if ((*model
)->GetTypeAt(candidate_index
) == TYPE_SUBMENU
) {
21 MenuModel
* submenu_model
= (*model
)->GetSubmenuModelAt(candidate_index
);
22 if (GetModelAndIndexForCommandId(command_id
, &submenu_model
, index
)) {
23 *model
= submenu_model
;
27 if ((*model
)->GetCommandIdAt(candidate_index
) == command_id
) {
28 *index
= candidate_index
;
35 base::string16
MenuModel::GetSublabelAt(int index
) const {
36 return base::string16();
39 base::string16
MenuModel::GetMinorTextAt(int index
) const {
40 return base::string16();
43 const gfx::FontList
* MenuModel::GetLabelFontListAt(int index
) const {
47 // Default implementation ignores the event flags.
48 void MenuModel::ActivatedAt(int index
, int event_flags
) {