| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TOOLBAR_WRENCH_MENU_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 virtual ~WrenchMenu(); | 44 virtual ~WrenchMenu(); |
| 45 | 45 |
| 46 void Init(ui::MenuModel* model); | 46 void Init(ui::MenuModel* model); |
| 47 | 47 |
| 48 // Shows the menu relative to the specified view. | 48 // Shows the menu relative to the specified view. |
| 49 void RunMenu(views::MenuButton* host); | 49 void RunMenu(views::MenuButton* host); |
| 50 | 50 |
| 51 // Whether the menu is currently visible to the user. | 51 // Whether the menu is currently visible to the user. |
| 52 bool IsShowing(); | 52 bool IsShowing(); |
| 53 | 53 |
| 54 const views::MenuConfig& GetMenuConfig() const; | |
| 55 | |
| 56 bool use_new_menu() const { return use_new_menu_; } | 54 bool use_new_menu() const { return use_new_menu_; } |
| 57 | 55 |
| 58 void AddObserver(WrenchMenuObserver* observer); | 56 void AddObserver(WrenchMenuObserver* observer); |
| 59 void RemoveObserver(WrenchMenuObserver* observer); | 57 void RemoveObserver(WrenchMenuObserver* observer); |
| 60 | 58 |
| 61 // MenuDelegate overrides: | 59 // MenuDelegate overrides: |
| 62 virtual const gfx::FontList* GetLabelFontList(int command_id) const OVERRIDE; | 60 virtual const gfx::FontList* GetLabelFontList(int command_id) const OVERRIDE; |
| 63 virtual bool GetShouldUseDisabledEmphasizedForegroundColor( | 61 virtual bool GetShouldUseDisabledEmphasizedForegroundColor( |
| 64 int command_id) const OVERRIDE; | 62 int command_id) const OVERRIDE; |
| 65 virtual base::string16 GetTooltipText(int command_id, | 63 virtual base::string16 GetTooltipText(int command_id, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const content::NotificationDetails& details) OVERRIDE; | 103 const content::NotificationDetails& details) OVERRIDE; |
| 106 | 104 |
| 107 private: | 105 private: |
| 108 class CutCopyPasteView; | 106 class CutCopyPasteView; |
| 109 class RecentTabsMenuModelDelegate; | 107 class RecentTabsMenuModelDelegate; |
| 110 class ZoomView; | 108 class ZoomView; |
| 111 | 109 |
| 112 typedef std::pair<ui::MenuModel*,int> Entry; | 110 typedef std::pair<ui::MenuModel*,int> Entry; |
| 113 typedef std::map<int,Entry> CommandIDToEntry; | 111 typedef std::map<int,Entry> CommandIDToEntry; |
| 114 | 112 |
| 115 const ui::NativeTheme* GetNativeTheme() const; | |
| 116 | |
| 117 // Populates |parent| with all the child menus in |model|. Recursively invokes | 113 // Populates |parent| with all the child menus in |model|. Recursively invokes |
| 118 // |PopulateMenu| for any submenu. | 114 // |PopulateMenu| for any submenu. |
| 119 void PopulateMenu(views::MenuItemView* parent, | 115 void PopulateMenu(views::MenuItemView* parent, |
| 120 ui::MenuModel* model); | 116 ui::MenuModel* model); |
| 121 | 117 |
| 122 // Adds a new menu item to |parent| at |menu_index| to represent the item in | 118 // Adds a new menu item to |parent| at |menu_index| to represent the item in |
| 123 // |model| at |model_index|: | 119 // |model| at |model_index|: |
| 124 // - |menu_index|: position in |parent| to add the new item. | 120 // - |menu_index|: position in |parent| to add the new item. |
| 125 // - |model_index|: position in |model| to retrieve information about the | 121 // - |model_index|: position in |model| to retrieve information about the |
| 126 // new menu item. | 122 // new menu item. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 const bool use_new_menu_; | 179 const bool use_new_menu_; |
| 184 | 180 |
| 185 const bool supports_new_separators_; | 181 const bool supports_new_separators_; |
| 186 | 182 |
| 187 ObserverList<WrenchMenuObserver> observer_list_; | 183 ObserverList<WrenchMenuObserver> observer_list_; |
| 188 | 184 |
| 189 DISALLOW_COPY_AND_ASSIGN(WrenchMenu); | 185 DISALLOW_COPY_AND_ASSIGN(WrenchMenu); |
| 190 }; | 186 }; |
| 191 | 187 |
| 192 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ | 188 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ |
| OLD | NEW |