| 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..533c67f1444e1b8a875cecbbcd0b2a16b5b9c840 100644
|
| --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.h
|
| +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.h
|
| @@ -9,25 +9,23 @@
|
| #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* Create(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 +36,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 +53,47 @@ 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();
|
| +
|
| + // Helper method to check if user can modify autohide behavior
|
| + bool CanUserModifyShelfAutoHideBehavior() const;
|
| +
|
| + // Helper method to determind wheter a command_id should be handlered
|
| + // by base class.
|
| + bool IsCommonCommandId(int command_id) 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);
|
|
|