| 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_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ |
| 7 | 7 |
| 8 #include "ash/public/cpp/shelf_item.h" | 8 #include "ash/public/cpp/shelf_item.h" |
| 9 #include "ash/shelf/shelf_alignment_menu.h" | 9 #include "ash/shelf/shelf_alignment_menu.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/base/models/simple_menu_model.h" | 11 #include "ui/base/models/simple_menu_model.h" |
| 12 | 12 |
| 13 class ChromeLauncherControllerImpl; | 13 class ChromeLauncherController; |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 class WmShelf; | 16 class WmShelf; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // Base class for context menu which is shown for a regular extension item in | 19 // Base class for context menu which is shown for a regular extension item in |
| 20 // the shelf, or for an ARC app item in the shelf, or shown when right click | 20 // the shelf, or for an ARC app item in the shelf, or shown when right click |
| 21 // on desktop shell. | 21 // on desktop shell. |
| 22 class LauncherContextMenu : public ui::SimpleMenuModel, | 22 class LauncherContextMenu : public ui::SimpleMenuModel, |
| 23 public ui::SimpleMenuModel::Delegate { | 23 public ui::SimpleMenuModel::Delegate { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 MENU_NEW_WINDOW, | 35 MENU_NEW_WINDOW, |
| 36 MENU_NEW_INCOGNITO_WINDOW, | 36 MENU_NEW_INCOGNITO_WINDOW, |
| 37 MENU_ALIGNMENT_MENU, | 37 MENU_ALIGNMENT_MENU, |
| 38 MENU_CHANGE_WALLPAPER, | 38 MENU_CHANGE_WALLPAPER, |
| 39 MENU_ITEM_COUNT | 39 MENU_ITEM_COUNT |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 ~LauncherContextMenu() override; | 42 ~LauncherContextMenu() override; |
| 43 | 43 |
| 44 // Static function to create contextmenu instance. | 44 // Static function to create contextmenu instance. |
| 45 static LauncherContextMenu* Create(ChromeLauncherControllerImpl* controller, | 45 static LauncherContextMenu* Create(ChromeLauncherController* controller, |
| 46 const ash::ShelfItem* item, | 46 const ash::ShelfItem* item, |
| 47 ash::WmShelf* wm_shelf); | 47 ash::WmShelf* wm_shelf); |
| 48 | 48 |
| 49 // ui::SimpleMenuModel::Delegate overrides: | 49 // ui::SimpleMenuModel::Delegate overrides: |
| 50 bool IsItemForCommandIdDynamic(int command_id) const override; | 50 bool IsItemForCommandIdDynamic(int command_id) const override; |
| 51 base::string16 GetLabelForCommandId(int command_id) const override; | 51 base::string16 GetLabelForCommandId(int command_id) const override; |
| 52 bool IsCommandIdChecked(int command_id) const override; | 52 bool IsCommandIdChecked(int command_id) const override; |
| 53 bool IsCommandIdEnabled(int command_id) const override; | 53 bool IsCommandIdEnabled(int command_id) const override; |
| 54 void ExecuteCommand(int command_id, int event_flags) override; | 54 void ExecuteCommand(int command_id, int event_flags) override; |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 LauncherContextMenu(ChromeLauncherControllerImpl* controller, | 57 LauncherContextMenu(ChromeLauncherController* controller, |
| 58 const ash::ShelfItem* item, | 58 const ash::ShelfItem* item, |
| 59 ash::WmShelf* wm_shelf); | 59 ash::WmShelf* wm_shelf); |
| 60 ChromeLauncherControllerImpl* controller() const { return controller_; } | 60 ChromeLauncherController* controller() const { return controller_; } |
| 61 | 61 |
| 62 const ash::ShelfItem& item() const { return item_; } | 62 const ash::ShelfItem& item() const { return item_; } |
| 63 | 63 |
| 64 // Add menu item for pin/unpin. | 64 // Add menu item for pin/unpin. |
| 65 void AddPinMenu(); | 65 void AddPinMenu(); |
| 66 | 66 |
| 67 // Add common shelf options items, e.g. autohide, alignment, and wallpaper. | 67 // Add common shelf options items, e.g. autohide, alignment, and wallpaper. |
| 68 void AddShelfOptionsMenu(); | 68 void AddShelfOptionsMenu(); |
| 69 | 69 |
| 70 // Helper method to execute common commands. Returns true if handled. | 70 // Helper method to execute common commands. Returns true if handled. |
| 71 bool ExecuteCommonCommand(int command_id, int event_flags); | 71 bool ExecuteCommonCommand(int command_id, int event_flags); |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 ChromeLauncherControllerImpl* controller_; | 74 ChromeLauncherController* controller_; |
| 75 | 75 |
| 76 ash::ShelfItem item_; | 76 ash::ShelfItem item_; |
| 77 | 77 |
| 78 ash::ShelfAlignmentMenu shelf_alignment_menu_; | 78 ash::ShelfAlignmentMenu shelf_alignment_menu_; |
| 79 | 79 |
| 80 ash::WmShelf* wm_shelf_; | 80 ash::WmShelf* wm_shelf_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); | 82 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ | 85 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ |
| OLD | NEW |