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

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

Issue 1812013003: Pass shelf instances, not root windows, for ash context menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call OnShelfAlignmentChanged after LayoutShelf. 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 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/shelf/shelf_alignment_menu.h" 8 #include "ash/shelf/shelf_alignment_menu.h"
9 #include "ash/shelf/shelf_item_types.h" 9 #include "ash/shelf/shelf_item_types.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 "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "ui/base/models/simple_menu_model.h" 13 #include "ui/base/models/simple_menu_model.h"
14 14
15 class ChromeLauncherController; 15 class ChromeLauncherController;
16 16
17 namespace aura {
18 class Window;
19 }
20
21 namespace extensions { 17 namespace extensions {
22 class ContextMenuMatcher; 18 class ContextMenuMatcher;
23 } 19 }
24 20
25 // Context menu shown for a launcher item. 21 // Context menu shown for the ash shell desktop, or for an item in the shelf.
26 class LauncherContextMenu : public ui::SimpleMenuModel, 22 class LauncherContextMenu : public ui::SimpleMenuModel,
27 public ui::SimpleMenuModel::Delegate { 23 public ui::SimpleMenuModel::Delegate {
28 public: 24 public:
29 // Creates a context menu for the desktop, or shelf |item|, in |root_window|.
30 LauncherContextMenu(ChromeLauncherController* controller, 25 LauncherContextMenu(ChromeLauncherController* controller,
31 const ash::ShelfItem* item, 26 const ash::ShelfItem* item,
32 aura::Window* root_window); 27 ash::Shelf* shelf);
33
34 ~LauncherContextMenu() override; 28 ~LauncherContextMenu() override;
35 29
36 void Init(); 30 void Init();
37 31
38 // ID of the item we're showing the context menu for.
39 ash::ShelfID id() const { return item_.id; }
40
41 // ui::SimpleMenuModel::Delegate overrides: 32 // ui::SimpleMenuModel::Delegate overrides:
42 bool IsItemForCommandIdDynamic(int command_id) const override; 33 bool IsItemForCommandIdDynamic(int command_id) const override;
43 base::string16 GetLabelForCommandId(int command_id) const override; 34 base::string16 GetLabelForCommandId(int command_id) const override;
44 bool IsCommandIdChecked(int command_id) const override; 35 bool IsCommandIdChecked(int command_id) const override;
45 bool IsCommandIdEnabled(int command_id) const override; 36 bool IsCommandIdEnabled(int command_id) const override;
46 bool GetAcceleratorForCommandId(int command_id, 37 bool GetAcceleratorForCommandId(int command_id,
47 ui::Accelerator* accelerator) override; 38 ui::Accelerator* accelerator) override;
48 void ExecuteCommand(int command_id, int event_flags) override; 39 void ExecuteCommand(int command_id, int event_flags) override;
49 40
50 private: 41 private:
(...skipping 16 matching lines...) Expand all
67 LAUNCH_TYPE_FULLSCREEN, 58 LAUNCH_TYPE_FULLSCREEN,
68 LAUNCH_TYPE_WINDOW, 59 LAUNCH_TYPE_WINDOW,
69 MENU_AUTO_HIDE, 60 MENU_AUTO_HIDE,
70 MENU_NEW_WINDOW, 61 MENU_NEW_WINDOW,
71 MENU_NEW_INCOGNITO_WINDOW, 62 MENU_NEW_INCOGNITO_WINDOW,
72 MENU_ALIGNMENT_MENU, 63 MENU_ALIGNMENT_MENU,
73 MENU_CHANGE_WALLPAPER, 64 MENU_CHANGE_WALLPAPER,
74 MENU_ITEM_COUNT 65 MENU_ITEM_COUNT
75 }; 66 };
76 67
77 // Does |item_| represent a valid item? See description of constructor for
78 // details on why it may not be valid.
79 bool is_valid_item() const { return item_.id != 0; }
80
81 ChromeLauncherController* controller_; 68 ChromeLauncherController* controller_;
82 69
83 ash::ShelfItem item_; 70 ash::ShelfItem item_;
84 71
85 ash::ShelfAlignmentMenu shelf_alignment_menu_; 72 ash::ShelfAlignmentMenu shelf_alignment_menu_;
86 73
87 scoped_ptr<extensions::ContextMenuMatcher> extension_items_; 74 scoped_ptr<extensions::ContextMenuMatcher> extension_items_;
88 75
89 aura::Window* root_window_; 76 ash::Shelf* shelf_;
90 77
91 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); 78 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu);
92 }; 79 };
93 80
94 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ 81 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc ('k') | chrome/browser/ui/ash/launcher/launcher_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698