Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3395)

Unified Diff: chrome/browser/ui/ash/launcher/launcher_context_menu.h

Issue 1838263002: Arc app integration in shelf launcher context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor and comments&inlucdes cleanup Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..868dd4eed67f25b37b4e290ee435b49929091cb6 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 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);
+
+ virtual void Init() = 0;
khmel 2016/03/30 00:58:46 You don't use Init in this class, please remove it
lgcheng 2016/03/30 02:06:25 Done.
// 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,44 @@ 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 determind whether a command_id should be handled
+ // 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);

Powered by Google App Engine
This is Rietveld 408576698