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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ash/mus/context_menu_mus.h
diff --git a/ash/mus/context_menu_mus.h b/ash/mus/context_menu_mus.h
new file mode 100644
index 0000000000000000000000000000000000000000..4185d4446d1fe4504227b79e88c98a81fa5fe555
--- /dev/null
+++ b/ash/mus/context_menu_mus.h
@@ -0,0 +1,77 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_MUS_CONTEXT_MENU_MUS_H_
+#define ASH_MUS_CONTEXT_MENU_MUS_H_
+
+#include "ash/shelf/shelf_alignment_menu.h"
+#include "ash/shelf/shelf_item_types.h"
+#include "base/macros.h"
+#include "mash/shelf/public/interfaces/context_menu.mojom.h"
+#include "ui/base/models/simple_menu_model.h"
+
+namespace mojo {
+class Connector;
+}
+
+namespace ash {
+
+class Shelf;
+
+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.
+
+// Context menu for mash; some items are populated from a connection to Chrome.
+class ContextMenuMus : public ui::SimpleMenuModel,
+ public ui::SimpleMenuModel::Delegate {
+ public:
+ ContextMenuMus(ContextMenuMus* root_menu,
+ Shelf* shelf,
+ const ShelfItem* item);
+ ~ContextMenuMus() override;
+
+ // Initialize the root menu; connect to Chrome to obtain menu items, etc.
+ void InitializeRootMenu(mojo::Connector* connector);
+
+ private:
+ enum MenuItem {
+ MENU_AUTO_HIDE,
+ MENU_ALIGNMENT_MENU,
+ MENU_CHANGE_WALLPAPER,
+ };
+
+ void GetItemsAndInfoCallback(
+ mojo::Array<mash::shelf::mojom::ContextMenuItemPtr> items,
+ bool can_user_modify_shelf_auto_hide_behavior,
+ bool is_guest_session);
+
+ void AddItems(mojo::Array<mash::shelf::mojom::ContextMenuItemPtr> items);
+
+ // ui::SimpleMenuModel::Delegate overrides:
+ bool IsCommandIdChecked(int command_id) const override;
+ bool IsCommandIdEnabled(int command_id) const override;
+ bool GetAcceleratorForCommandId(int command_id,
+ ui::Accelerator* accelerator) override;
+ void ExecuteCommand(int command_id, int event_flags) override;
+
+ // The root menu owns a connection to Chrome that is also used by sub-menus.
+ ContextMenuMus* root_menu_;
+ mash::shelf::mojom::ContextMenuPtr context_menu_;
+
+ Shelf* shelf_;
+ const ShelfItem* item_;
+
+ ShelfAlignmentMenu alignment_menu_;
+
+ // Cached properties and submenus for menu items supplied by Chrome.
+ std::map<int, bool> item_enabled_;
+ std::map<int, bool> item_checked_;
+ std::map<int, scoped_ptr<ContextMenuMus>> item_submenu_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContextMenuMus);
+};
+
+} // namespace sysui
+} // namespace ash
+
+#endif // ASH_MUS_CONTEXT_MENU_MUS_H_
« 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