OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 class WrenchMenu : public views::MenuDelegate, | 34 class WrenchMenu : public views::MenuDelegate, |
35 public BaseBookmarkModelObserver, | 35 public BaseBookmarkModelObserver, |
36 public content::NotificationObserver { | 36 public content::NotificationObserver { |
37 public: | 37 public: |
38 // TODO: remove |use_new_menu| and |supports_new_separators|. | 38 // TODO: remove |use_new_menu| and |supports_new_separators|. |
39 WrenchMenu(Browser* browser, | 39 WrenchMenu(Browser* browser, |
40 bool use_new_menu, | 40 bool use_new_menu, |
41 bool supports_new_separators); | 41 bool supports_new_separators); |
42 virtual ~WrenchMenu(); | 42 virtual ~WrenchMenu(); |
43 | 43 |
44 void Init(ui::MenuModel* model); | 44 void Init(views::View* view, ui::MenuModel* model); |
sky
2013/03/19 21:08:26
It seems as though the only need you have for view
Bobby Powers
2013/03/20 14:54:38
Ah, yes! Very good. I've reworked the patch to d
| |
45 | 45 |
46 // Shows the menu relative to the specified view. | 46 // Shows the menu relative to the specified view. |
47 void RunMenu(views::MenuButton* host); | 47 void RunMenu(views::MenuButton* host); |
48 | 48 |
49 // Whether the menu is currently visible to the user. | 49 // Whether the menu is currently visible to the user. |
50 bool IsShowing(); | 50 bool IsShowing(); |
51 | 51 |
52 const views::MenuConfig& GetMenuConfig() const; | 52 const views::MenuConfig& GetMenuConfig() const; |
53 | 53 |
54 bool use_new_menu() const { return use_new_menu_; } | 54 bool use_new_menu() const { return use_new_menu_; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 class ZoomView; | 100 class ZoomView; |
101 | 101 |
102 typedef std::pair<ui::MenuModel*,int> Entry; | 102 typedef std::pair<ui::MenuModel*,int> Entry; |
103 typedef std::map<int,Entry> IDToEntry; | 103 typedef std::map<int,Entry> IDToEntry; |
104 | 104 |
105 // Populates |parent| with all the child menus in |model|. Recursively invokes | 105 // Populates |parent| with all the child menus in |model|. Recursively invokes |
106 // |PopulateMenu| for any submenu. |next_id| is incremented for every menu | 106 // |PopulateMenu| for any submenu. |next_id| is incremented for every menu |
107 // that is created. | 107 // that is created. |
108 void PopulateMenu(views::MenuItemView* parent, | 108 void PopulateMenu(views::MenuItemView* parent, |
109 ui::MenuModel* model, | 109 ui::MenuModel* model, |
110 views::View* view, | |
110 int* next_id); | 111 int* next_id); |
111 | 112 |
112 // Adds a new menu to |parent| to represent the MenuModel/index pair passed | 113 // Adds a new menu to |parent| to represent the MenuModel/index pair passed |
113 // in. | 114 // in. |
114 // Fur button containing menu items a |height| override can be specified with | 115 // Fur button containing menu items a |height| override can be specified with |
115 // a number bigger then 0. | 116 // a number bigger then 0. |
116 views::MenuItemView* AppendMenuItem(views::MenuItemView* parent, | 117 views::MenuItemView* AppendMenuItem(views::MenuItemView* parent, |
117 ui::MenuModel* model, | 118 ui::MenuModel* model, |
118 int index, | 119 int index, |
119 ui::MenuModel::ItemType menu_type, | 120 ui::MenuModel::ItemType menu_type, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 content::NotificationRegistrar registrar_; | 171 content::NotificationRegistrar registrar_; |
171 | 172 |
172 const bool use_new_menu_; | 173 const bool use_new_menu_; |
173 | 174 |
174 const bool supports_new_separators_; | 175 const bool supports_new_separators_; |
175 | 176 |
176 DISALLOW_COPY_AND_ASSIGN(WrenchMenu); | 177 DISALLOW_COPY_AND_ASSIGN(WrenchMenu); |
177 }; | 178 }; |
178 | 179 |
179 #endif // CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_ | 180 #endif // CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_ |
OLD | NEW |