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

Side by Side Diff: ash/mus/context_menu_mus.h

Issue 1760743002: Add simple mash context menu support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase; use test items; 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 ASH_MUS_CONTEXT_MENU_MUS_H_
6 #define ASH_MUS_CONTEXT_MENU_MUS_H_
7
8 #include "ash/shelf/shelf_alignment_menu.h"
9 #include "ash/shelf/shelf_item_types.h"
10 #include "base/macros.h"
11 #include "mash/shelf/public/interfaces/context_menu.mojom.h"
12 #include "ui/base/models/simple_menu_model.h"
13
14 namespace mojo {
15 class Connector;
16 }
17
18 namespace ash {
19
20 class Shelf;
21
22 namespace sysui {
sky 2016/03/18 20:30:57 This shouldn't be in the sysui namespace (namespac
msw 2016/03/18 22:10:30 Done.
23
24 // Context menu for mash; some items are populated from a connection to Chrome.
25 class ContextMenuMus : public ui::SimpleMenuModel,
26 public ui::SimpleMenuModel::Delegate {
27 public:
28 ContextMenuMus(ContextMenuMus* root_menu,
29 Shelf* shelf,
30 const ShelfItem* item);
31 ~ContextMenuMus() override;
32
33 // Initialize the root menu; connect to Chrome to obtain menu items, etc.
34 void InitializeRootMenu(mojo::Connector* connector);
35
36 private:
37 enum MenuItem {
38 MENU_AUTO_HIDE,
39 MENU_ALIGNMENT_MENU,
40 MENU_CHANGE_WALLPAPER,
41 };
42
43 void GetItemsAndInfoCallback(
44 mojo::Array<mash::shelf::mojom::ContextMenuItemPtr> items,
45 bool can_user_modify_shelf_auto_hide_behavior,
46 bool is_guest_session);
47
48 void AddItems(mojo::Array<mash::shelf::mojom::ContextMenuItemPtr> items);
49
50 // ui::SimpleMenuModel::Delegate overrides:
51 bool IsCommandIdChecked(int command_id) const override;
52 bool IsCommandIdEnabled(int command_id) const override;
53 bool GetAcceleratorForCommandId(int command_id,
54 ui::Accelerator* accelerator) override;
55 void ExecuteCommand(int command_id, int event_flags) override;
56
57 // The root menu owns a connection to Chrome that is also used by sub-menus.
58 ContextMenuMus* root_menu_;
59 mash::shelf::mojom::ContextMenuPtr context_menu_;
60
61 Shelf* shelf_;
62 const ShelfItem* item_;
63
64 ShelfAlignmentMenu alignment_menu_;
65
66 // Cached properties and submenus for menu items supplied by Chrome.
67 std::map<int, bool> item_enabled_;
68 std::map<int, bool> item_checked_;
69 std::map<int, scoped_ptr<ContextMenuMus>> item_submenu_;
70
71 DISALLOW_COPY_AND_ASSIGN(ContextMenuMus);
72 };
73
74 } // namespace sysui
75 } // namespace ash
76
77 #endif // ASH_MUS_CONTEXT_MENU_MUS_H_
OLDNEW
« no previous file with comments | « ash/mus/DEPS ('k') | ash/mus/context_menu_mus.cc » ('j') | ash/mus/context_menu_mus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698