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..ddca6dd75c3a036aa473d9197f5c690e7ee7c525 100644 |
| --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.h |
| +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.h |
| @@ -9,25 +9,24 @@ |
| #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; |
| -} |
| - |
| -// Context menu shown for the ash shell desktop, or for an item in the shelf. |
| +// Abstract class for context menu shown for the ash shell desktop, or for a |
| +// regular extension item in the shelf, or for an Arc app item in the shelf. |
| 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* CreateLauncherContextMenu( |
|
khmel
2016/03/29 20:31:27
nit: Probably Create sounds better.
lgcheng
2016/03/29 22:02:16
Done.
|
| + ChromeLauncherController* controller, |
| + const ash::ShelfItem* item, |
| + ash::Shelf* shelf); |
| + |
| + virtual void Init() = 0; |
| // ui::SimpleMenuModel::Delegate overrides: |
| bool IsItemForCommandIdDynamic(int command_id) const override; |
| @@ -38,17 +37,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 +54,43 @@ 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 menu items for autohide mode, alignment and setting wallpaper. |
| + void AddAutohideAlignmentWallpaperMenu(); |
| + |
| + // Check if user can modify autohide behavior |
| + bool CanUserModifyShelfAutoHideBehavior() const; |
| + |
| + 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); |