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

Side by Side Diff: views/controls/menu/menu_model_adapter.h

Issue 7541002: Make NetworkMenuModel a ui::MenuModel again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implemented reviewer suggestions. Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #ifndef VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ 5 #ifndef VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_
6 #define VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ 6 #define VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "views/controls/menu/menu_delegate.h" 11 #include "views/controls/menu/menu_delegate.h"
12 12
13 namespace ui { 13 namespace ui {
14 class MenuModel; 14 class MenuModel;
15 } 15 }
16 16
17 namespace views { 17 namespace views {
18 class MenuItemView; 18 class MenuItemView;
19 19
20 // This class wraps an instance of ui::MenuModel with the 20 // This class wraps an instance of ui::MenuModel with the
21 // views::MenuDelegate interface required by views::MenuItemView. 21 // views::MenuDelegate interface required by views::MenuItemView.
22 class MenuModelAdapter : public MenuDelegate { 22 class MenuModelAdapter : public MenuDelegate {
23 public: 23 public:
24 // The caller retains ownership of the ui::MenuModel instance and 24 // The caller retains ownership of the ui::MenuModel instance and
25 // must ensure it exists for the lifetime of the adapter. The 25 // must ensure it exists for the lifetime of the adapter.
26 // base_id argument is the command id for the first menu item.
27 explicit MenuModelAdapter(ui::MenuModel* menu_model); 26 explicit MenuModelAdapter(ui::MenuModel* menu_model);
28 virtual ~MenuModelAdapter(); 27 virtual ~MenuModelAdapter();
29 28
30 // Populate a MenuItemView menu with the ui::MenuModel items 29 // Populate a MenuItemView menu with the ui::MenuModel items
31 // (including submenus). 30 // (including submenus).
32 virtual void BuildMenu(MenuItemView* menu); 31 virtual void BuildMenu(MenuItemView* menu);
33 32
34 void set_triggerable_event_flags(int triggerable_event_flags) { 33 void set_triggerable_event_flags(int triggerable_event_flags) {
35 triggerable_event_flags_ = triggerable_event_flags; 34 triggerable_event_flags_ = triggerable_event_flags;
36 } 35 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 67
69 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). 68 // Map MenuItems to MenuModels. Used to implement WillShowMenu().
70 std::map<MenuItemView*, ui::MenuModel*> menu_map_; 69 std::map<MenuItemView*, ui::MenuModel*> menu_map_;
71 70
72 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); 71 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter);
73 }; 72 };
74 73
75 } // namespace views 74 } // namespace views
76 75
77 #endif // VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ 76 #endif // VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698