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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_context_menu.h

Issue 2046843005: mash: Migrate shelf menus to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ash_shell_with_content Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_
7 7
8 #include "ash/common/shelf/shelf_item_types.h" 8 #include "ash/common/shelf/shelf_item_types.h"
9 #include "ash/shelf/shelf_alignment_menu.h" 9 #include "ash/shelf/shelf_alignment_menu.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/base/models/simple_menu_model.h" 12 #include "ui/base/models/simple_menu_model.h"
13 13
14 class ChromeLauncherController; 14 class ChromeLauncherController;
15 15
16 namespace ash { 16 namespace ash {
17 class Shelf; 17 class WmShelf;
18 } 18 }
19 19
20 // Base class for context menu which is shown for a regular extension item in 20 // Base class for context menu which is shown for a regular extension item in
21 // the shelf, or for an Arc app item in the shelf, or shown when right click 21 // the shelf, or for an Arc app item in the shelf, or shown when right click
22 // on desktop shell. 22 // on desktop shell.
23 class LauncherContextMenu : public ui::SimpleMenuModel, 23 class LauncherContextMenu : public ui::SimpleMenuModel,
24 public ui::SimpleMenuModel::Delegate { 24 public ui::SimpleMenuModel::Delegate {
25 public: 25 public:
26 ~LauncherContextMenu() override; 26 ~LauncherContextMenu() override;
27 27
28 // Static function to create contextmenu instance. 28 // Static function to create contextmenu instance.
29 static LauncherContextMenu* Create(ChromeLauncherController* controller, 29 static LauncherContextMenu* Create(ChromeLauncherController* controller,
30 const ash::ShelfItem* item, 30 const ash::ShelfItem* item,
31 ash::Shelf* shelf); 31 ash::WmShelf* wm_shelf);
32 32
33 // ui::SimpleMenuModel::Delegate overrides: 33 // ui::SimpleMenuModel::Delegate overrides:
34 bool IsItemForCommandIdDynamic(int command_id) const override; 34 bool IsItemForCommandIdDynamic(int command_id) const override;
35 base::string16 GetLabelForCommandId(int command_id) const override; 35 base::string16 GetLabelForCommandId(int command_id) const override;
36 bool IsCommandIdChecked(int command_id) const override; 36 bool IsCommandIdChecked(int command_id) const override;
37 bool IsCommandIdEnabled(int command_id) const override; 37 bool IsCommandIdEnabled(int command_id) const override;
38 bool GetAcceleratorForCommandId(int command_id, 38 bool GetAcceleratorForCommandId(int command_id,
39 ui::Accelerator* accelerator) override; 39 ui::Accelerator* accelerator) override;
40 void ExecuteCommand(int command_id, int event_flags) override; 40 void ExecuteCommand(int command_id, int event_flags) override;
41 41
42 protected: 42 protected:
43 enum MenuItem { 43 enum MenuItem {
44 MENU_OPEN_NEW, 44 MENU_OPEN_NEW,
45 MENU_CLOSE, 45 MENU_CLOSE,
46 MENU_PIN, 46 MENU_PIN,
47 LAUNCH_TYPE_PINNED_TAB, 47 LAUNCH_TYPE_PINNED_TAB,
48 LAUNCH_TYPE_REGULAR_TAB, 48 LAUNCH_TYPE_REGULAR_TAB,
49 LAUNCH_TYPE_FULLSCREEN, 49 LAUNCH_TYPE_FULLSCREEN,
50 LAUNCH_TYPE_WINDOW, 50 LAUNCH_TYPE_WINDOW,
51 MENU_AUTO_HIDE, 51 MENU_AUTO_HIDE,
52 MENU_NEW_WINDOW, 52 MENU_NEW_WINDOW,
53 MENU_NEW_INCOGNITO_WINDOW, 53 MENU_NEW_INCOGNITO_WINDOW,
54 MENU_ALIGNMENT_MENU, 54 MENU_ALIGNMENT_MENU,
55 MENU_CHANGE_WALLPAPER, 55 MENU_CHANGE_WALLPAPER,
56 MENU_ITEM_COUNT 56 MENU_ITEM_COUNT
57 }; 57 };
58 58
59 LauncherContextMenu(ChromeLauncherController* controller, 59 LauncherContextMenu(ChromeLauncherController* controller,
60 const ash::ShelfItem* item, 60 const ash::ShelfItem* item,
61 ash::Shelf* shelf); 61 ash::WmShelf* wm_shelf);
62 ChromeLauncherController* controller() const { return controller_; } 62 ChromeLauncherController* controller() const { return controller_; }
63 63
64 const ash::ShelfItem& item() const { return item_; } 64 const ash::ShelfItem& item() const { return item_; }
65 65
66 ash::Shelf* shelf() const { return shelf_; }
67
68 // Add menu item for pin/unpin. 66 // Add menu item for pin/unpin.
69 void AddPinMenu(); 67 void AddPinMenu();
70 68
71 // Add common shelf options items, e.g. autohide mode, alignment and 69 // Add common shelf options items, e.g. autohide mode, alignment and
72 // setting wallpaper. 70 // setting wallpaper.
73 void AddShelfOptionsMenu(); 71 void AddShelfOptionsMenu();
74 72
75 // Helper method to execute common commands. Returns true if handled. 73 // Helper method to execute common commands. Returns true if handled.
76 bool ExecuteCommonCommand(int command_id, int event_flags); 74 bool ExecuteCommonCommand(int command_id, int event_flags);
77 75
(...skipping 13 matching lines...) Expand all
91 DesktopShellLauncherContextMenuVerifyCloseItem); 89 DesktopShellLauncherContextMenuVerifyCloseItem);
92 FRIEND_TEST_ALL_PREFIXES(ShelfAppBrowserTest, 90 FRIEND_TEST_ALL_PREFIXES(ShelfAppBrowserTest,
93 LauncherContextMenuVerifyCloseItemAppearance); 91 LauncherContextMenuVerifyCloseItemAppearance);
94 92
95 ChromeLauncherController* controller_; 93 ChromeLauncherController* controller_;
96 94
97 ash::ShelfItem item_; 95 ash::ShelfItem item_;
98 96
99 ash::ShelfAlignmentMenu shelf_alignment_menu_; 97 ash::ShelfAlignmentMenu shelf_alignment_menu_;
100 98
101 ash::Shelf* shelf_; 99 ash::WmShelf* wm_shelf_;
102 100
103 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); 101 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu);
104 }; 102 };
105 103
106 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ 104 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698