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

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: Issue Correction 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..494b0e1583a311940620a0b75cb67d4a4b3413d7 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.h
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.h
@@ -9,25 +9,22 @@
#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;
khmel 2016/03/31 18:23:12 nit: do we need namespace ash { class Shelf; } It
lgcheng 2016/03/31 21:15:19 Done.
-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);
// ui::SimpleMenuModel::Delegate overrides:
bool IsItemForCommandIdDynamic(int command_id) const override;
@@ -38,17 +35,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 +52,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 determine 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