Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Side by Side Diff: ui/base/models/menu_model.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/models/menu_model.h ('k') | ui/base/models/menu_model_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "ui/base/models/menu_model.h"
6
7 namespace ui {
8
9 bool MenuModel::IsVisibleAt(int index) const {
10 return true;
11 }
12
13 // static
14 bool MenuModel::GetModelAndIndexForCommandId(int command_id,
15 MenuModel** model,
16 int* index) {
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;
24 return true;
25 }
26 }
27 if ((*model)->GetCommandIdAt(candidate_index) == command_id) {
28 *index = candidate_index;
29 return true;
30 }
31 }
32 return false;
33 }
34
35 base::string16 MenuModel::GetSublabelAt(int index) const {
36 return base::string16();
37 }
38
39 base::string16 MenuModel::GetMinorTextAt(int index) const {
40 return base::string16();
41 }
42
43 const gfx::FontList* MenuModel::GetLabelFontListAt(int index) const {
44 return NULL;
45 }
46
47 // Default implementation ignores the event flags.
48 void MenuModel::ActivatedAt(int index, int event_flags) {
49 ActivatedAt(index);
50 }
51
52 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/models/menu_model.h ('k') | ui/base/models/menu_model_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698