OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ | |
7 | |
8 #include "ash/launcher/launcher_alignment_menu.h" | |
9 #include "ash/launcher/launcher_types.h" | |
10 #include "base/basictypes.h" | |
11 #include "ui/base/models/simple_menu_model.h" | |
12 | |
13 class ChromeLauncherController; | |
14 | |
15 // Context menu shown for a launcher item. | |
16 class LauncherContextMenu : public ui::SimpleMenuModel, | |
17 public ui::SimpleMenuModel::Delegate { | |
18 public: | |
19 // |item| is NULL if the context menu is for the launcher (the user right | |
20 // |clicked on an area with no icons). | |
21 LauncherContextMenu(ChromeLauncherController* controller, | |
22 const ash::LauncherItem* item); | |
23 virtual ~LauncherContextMenu(); | |
24 | |
25 // ID of the item we're showing the context menu for. | |
26 ash::LauncherID id() const { return item_.id; } | |
27 | |
28 // ui::SimpleMenuModel::Delegate overrides: | |
29 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
30 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
31 virtual bool GetAcceleratorForCommandId( | |
32 int command_id, | |
33 ui::Accelerator* accelerator) OVERRIDE; | |
34 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
35 | |
36 private: | |
37 enum MenuItem { | |
38 MENU_OPEN, | |
39 MENU_CLOSE, | |
40 MENU_PIN, | |
41 LAUNCH_TYPE_PINNED_TAB, | |
42 LAUNCH_TYPE_REGULAR_TAB, | |
43 LAUNCH_TYPE_FULLSCREEN, | |
44 LAUNCH_TYPE_WINDOW, | |
45 MENU_AUTO_HIDE, | |
46 MENU_NEW_WINDOW, | |
47 MENU_NEW_INCOGNITO_WINDOW, | |
48 MENU_ALIGNMENT_MENU, | |
49 }; | |
50 | |
51 // Does |item_| represent a valid item? See description of constructor for | |
52 // details on why it may not be valid. | |
53 bool is_valid_item() const { return item_.id != 0; } | |
54 | |
55 ChromeLauncherController* controller_; | |
56 | |
57 ash::LauncherItem item_; | |
58 | |
59 ash::LauncherAlignmentMenu alignment_menu_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); | |
62 }; | |
63 | |
64 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_CONTEXT_MENU_H_ | |
OLD | NEW |