Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/launcher_context_menu.h |
| diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.h b/chrome/browser/ui/ash/launcher/launcher_context_menu.h |
| index f7006c95b84ac7cd84f3838028b23dd40df8e866..2fea69fec1ec0af4ba77f5f9646ff073de2410b5 100644 |
| --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.h |
| +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.h |
| @@ -9,25 +9,26 @@ |
| #include "ash/shelf/shelf_item_types.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| -#include "base/memory/scoped_ptr.h" |
| #include "ui/base/models/simple_menu_model.h" |
| class ChromeLauncherController; |
| -namespace extensions { |
| -class ContextMenuMatcher; |
| +namespace ash { |
| +class Shelf; |
| } |
| -// Context menu shown for the ash shell desktop, or for an item in the shelf. |
| +// Base class for context menu which is shown for a regular extension item in |
| +// the shelf, or for an Arc app item in the shelf, or shown when right click |
| +// on desktop shell. |
| class LauncherContextMenu : public ui::SimpleMenuModel, |
| public ui::SimpleMenuModel::Delegate { |
| public: |
| - LauncherContextMenu(ChromeLauncherController* controller, |
| - const ash::ShelfItem* item, |
| - ash::Shelf* shelf); |
| ~LauncherContextMenu() override; |
| - void Init(); |
| + // Static function to create contextmenu instance. |
| + static LauncherContextMenu* Create(ChromeLauncherController* controller, |
| + const ash::ShelfItem* item, |
| + ash::Shelf* shelf); |
| // ui::SimpleMenuModel::Delegate overrides: |
| bool IsItemForCommandIdDynamic(int command_id) const override; |
| @@ -38,17 +39,7 @@ class LauncherContextMenu : public ui::SimpleMenuModel, |
| ui::Accelerator* accelerator) override; |
| void ExecuteCommand(int command_id, int event_flags) override; |
| - private: |
| - FRIEND_TEST_ALL_PREFIXES( |
| - LauncherContextMenuTest, |
| - NewIncognitoWindowMenuIsDisabledWhenIncognitoModeOff); |
| - FRIEND_TEST_ALL_PREFIXES( |
| - LauncherContextMenuTest, |
| - NewWindowMenuIsDisabledWhenIncognitoModeForced); |
| - FRIEND_TEST_ALL_PREFIXES( |
| - LauncherContextMenuTest, |
| - AutoHideOptionInMaximizedMode); |
| - |
| + protected: |
| enum MenuItem { |
| MENU_OPEN_NEW, |
| MENU_CLOSE, |
| @@ -65,14 +56,45 @@ class LauncherContextMenu : public ui::SimpleMenuModel, |
| MENU_ITEM_COUNT |
| }; |
| + LauncherContextMenu(ChromeLauncherController* controller, |
| + const ash::ShelfItem* item, |
| + ash::Shelf* shelf); |
| + ChromeLauncherController* controller() const { return controller_; } |
| + |
| + const ash::ShelfItem& item() const { return item_; } |
| + |
| + ash::Shelf* shelf() const { return shelf_; } |
| + |
| + // Add menu item for pin/unpin. |
| + void AddPinMenu(); |
| + |
| + // Add common shelf options items, e.g. autohide mode, alignment and |
| + // setting wallpaper. |
| + void AddShelfOptionsMenu(); |
| + |
| + // Helper method to determine whether a command_id should be handled |
| + // by base class. Handler it if true is returned. |
|
stevenjb
2016/04/07 00:40:34
Update comment, e.g.:
// Helper method to execute
lgcheng
2016/04/07 01:28:09
Done.
|
| + bool ExecuteCommonCommand(int command_id, int event_flags); |
| + |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES( |
| + LauncherContextMenuTest, |
| + NewIncognitoWindowMenuIsDisabledWhenIncognitoModeOff); |
| + FRIEND_TEST_ALL_PREFIXES(LauncherContextMenuTest, |
| + NewWindowMenuIsDisabledWhenIncognitoModeForced); |
| + FRIEND_TEST_ALL_PREFIXES(LauncherContextMenuTest, |
| + AutoHideOptionInMaximizedMode); |
| + FRIEND_TEST_ALL_PREFIXES(LauncherContextMenuTest, |
| + DesktopShellLauncherContextMenuItemCheck); |
| + FRIEND_TEST_ALL_PREFIXES(LauncherContextMenuTest, |
| + ArcLauncherContextMenuItemCheck); |
| + |
| ChromeLauncherController* controller_; |
| ash::ShelfItem item_; |
| ash::ShelfAlignmentMenu shelf_alignment_menu_; |
| - scoped_ptr<extensions::ContextMenuMatcher> extension_items_; |
| - |
| ash::Shelf* shelf_; |
| DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); |