| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // The returned item's MenuItemView::GetCommand() is the same as that of | 131 // The returned item's MenuItemView::GetCommand() is the same as that of |
| 132 // |model|->GetCommandIdAt(|model_index|). | 132 // |model|->GetCommandIdAt(|model_index|). |
| 133 views::MenuItemView* AddMenuItem(views::MenuItemView* parent, | 133 views::MenuItemView* AddMenuItem(views::MenuItemView* parent, |
| 134 int menu_index, | 134 int menu_index, |
| 135 ui::MenuModel* model, | 135 ui::MenuModel* model, |
| 136 int model_index, | 136 int model_index, |
| 137 ui::MenuModel::ItemType menu_type); | 137 ui::MenuModel::ItemType menu_type); |
| 138 | 138 |
| 139 // Invoked from the cut/copy/paste menus. Cancels the current active menu and | 139 // Invoked from the cut/copy/paste menus. Cancels the current active menu and |
| 140 // activates the menu item in |model| at |index|. | 140 // activates the menu item in |model| at |index|. |
| 141 void CancelAndEvaluate(ui::MenuModel* model, int index); | 141 void CancelAndEvaluate(ui::ButtonMenuItemModel* model, int index); |
| 142 | 142 |
| 143 // Creates the bookmark menu if necessary. Does nothing if already created or | 143 // Creates the bookmark menu if necessary. Does nothing if already created or |
| 144 // the bookmark model isn't loaded. | 144 // the bookmark model isn't loaded. |
| 145 void CreateBookmarkMenu(); | 145 void CreateBookmarkMenu(); |
| 146 | 146 |
| 147 // Returns the index of the MenuModel/index pair representing the |command_id| | 147 // Returns the index of the MenuModel/index pair representing the |command_id| |
| 148 // in |command_id_to_entry_|. | 148 // in |command_id_to_entry_|. |
| 149 int ModelIndexFromCommandId(int command_id) const; | 149 int ModelIndexFromCommandId(int command_id) const; |
| 150 | 150 |
| 151 // The views menu. Owned by |menu_runner_|. | 151 // The views menu. Owned by |menu_runner_|. |
| 152 views::MenuItemView* root_; | 152 views::MenuItemView* root_; |
| 153 | 153 |
| 154 scoped_ptr<views::MenuRunner> menu_runner_; | 154 scoped_ptr<views::MenuRunner> menu_runner_; |
| 155 | 155 |
| 156 // Maps from the command ID in model to the model/index pair the item came | 156 // Maps from the command ID in model to the model/index pair the item came |
| 157 // from. | 157 // from. |
| 158 CommandIDToEntry command_id_to_entry_; | 158 CommandIDToEntry command_id_to_entry_; |
| 159 | 159 |
| 160 // Browser the menu is being shown for. | 160 // Browser the menu is being shown for. |
| 161 Browser* browser_; | 161 Browser* browser_; |
| 162 | 162 |
| 163 // |CancelAndEvaluate| sets |selected_menu_model_| and |selected_index_|. | 163 // |CancelAndEvaluate| sets |selected_menu_model_| and |selected_index_|. |
| 164 // If |selected_menu_model_| is non-null after the menu completes | 164 // If |selected_menu_model_| is non-null after the menu completes |
| 165 // ActivatedAt is invoked. This is done so that ActivatedAt isn't invoked | 165 // ActivatedAt is invoked. This is done so that ActivatedAt isn't invoked |
| 166 // while the message loop is nested. | 166 // while the message loop is nested. |
| 167 ui::MenuModel* selected_menu_model_; | 167 ui::ButtonMenuItemModel* selected_menu_model_; |
| 168 int selected_index_; | 168 int selected_index_; |
| 169 | 169 |
| 170 // Used for managing the bookmark menu items. | 170 // Used for managing the bookmark menu items. |
| 171 scoped_ptr<BookmarkMenuDelegate> bookmark_menu_delegate_; | 171 scoped_ptr<BookmarkMenuDelegate> bookmark_menu_delegate_; |
| 172 | 172 |
| 173 // Menu corresponding to IDC_BOOKMARKS_MENU. | 173 // Menu corresponding to IDC_BOOKMARKS_MENU. |
| 174 views::MenuItemView* bookmark_menu_; | 174 views::MenuItemView* bookmark_menu_; |
| 175 | 175 |
| 176 // Menu corresponding to IDC_FEEDBACK. | 176 // Menu corresponding to IDC_FEEDBACK. |
| 177 views::MenuItemView* feedback_menu_item_; | 177 views::MenuItemView* feedback_menu_item_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 189 | 189 |
| 190 ObserverList<WrenchMenuObserver> observer_list_; | 190 ObserverList<WrenchMenuObserver> observer_list_; |
| 191 | 191 |
| 192 // Records the time from when menu opens to when the user selects a menu item. | 192 // Records the time from when menu opens to when the user selects a menu item. |
| 193 base::ElapsedTimer menu_opened_timer_; | 193 base::ElapsedTimer menu_opened_timer_; |
| 194 | 194 |
| 195 DISALLOW_COPY_AND_ASSIGN(WrenchMenu); | 195 DISALLOW_COPY_AND_ASSIGN(WrenchMenu); |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ | 198 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_H_ |
| OLD | NEW |