mash: Add shelf context menu support

Desktop / Chromium - Michael Wasserman [chromium.org] - 18 August 2017 19:17 EDT

Chrome serializes its shelf item context menus for Ash. Ash displays the menus and reports invocations to Chrome.

Add an ash-side ShelfContextMenu class that supports:
-Local menu items to set shelf & wallpaper prefs/settings.
-Proxies Chrome's menu items via mojo structs/interfaces.
-Also used for wallpaper/desktop context menus (via RWC).

Add ash::mojom::ShelfItemDelegate::GetContextMenuItems, etc.:
-Extend ExecuteCommand, MenuItem, etc. to support context menus.
-Denote the command's origin (context/app menu) and display id.
-Allow 64-bit int command and radio-group ids; null images.
-Add ash::mojom::MenuItemType=ui::MenuModel::ItemType traits.

Add common ash::ShelfItemDelegate context menu handling:
-Subclasses override new virtual GetContextMenu() helper.
-GetContextMenuItems() stores the MenuModel for execution.
-ExecuteContextMenuCommand() handles context menu invocation.

Wire up chrome's launcher item subclass context menus. Make minor launcher context menu class simplifications. Add a ShelfWindowWatcher context menu item for closing.

Remove mus, ash_shell, test, and desktop context menu classes. Remove ShellDelegate::CreateContextMenu and ash::ShelfAlignmentMenu. Inline CanChangeShelfAlignment; move CanUserModifyShelfAutoHideBehavior. Add unit tests, flip TestWallpaperDelegate::CanOpenSetWallpaperPage.

Bug: 640693, 753028 Test: No Chrome OS shelf/desktop context menu behavior changes. Change-Id: I3afb93095b4042dca57d16844c5b05308f06a384 TBR: caitkp@chromium.org Reviewed-on: https://chromium-review.googlesource.com/571517 Commit-Queue: Michael Wasserman

47bf178 mash: Add shelf context menu support.
ash/BUILD.gn | 10 +-
ash/DEPS | 1 +
ash/mus/BUILD.gn | 2 -
ash/mus/context_menu_mus.cc | 51 ----
ash/mus/context_menu_mus.h | 44 ----
ash/mus/shell_delegate_mus.cc | 6 -
ash/mus/shell_delegate_mus.h | 2 -
ash/public/cpp/remote_shelf_item_delegate.cc | 15 +-
ash/public/cpp/remote_shelf_item_delegate.h | 7 +-
ash/public/cpp/shelf_item_delegate.cc | 57 ++++-
ash/public/cpp/shelf_item_delegate.h | 17 ++
ash/public/cpp/shelf_prefs.cc | 9 -
ash/public/cpp/shelf_prefs.h | 3 -
ash/public/cpp/shelf_struct_traits.h | 47 ++++
ash/public/interfaces/shelf.mojom | 35 ++-
ash/public/interfaces/shelf.typemap | 3 +
ash/root_window_controller.cc | 12 +-
ash/shelf/app_list_shelf_item_delegate.cc | 8 +-
ash/shelf/app_list_shelf_item_delegate.h | 5 +-
ash/shelf/shelf.cc | 29 ---
ash/shelf/shelf.h | 4 -
ash/shelf/shelf_alignment_menu.h | 43 ----
ash/shelf/shelf_application_menu_model.cc | 8 +-
ash/shelf/shelf_context_menu_model.cc | 254 ++++++++++++++++++++
ash/shelf/shelf_context_menu_model.h | 66 ++++++
ash/shelf/shelf_context_menu_model_unittest.cc | 259 +++++++++++++++++++++
ash/shelf/shelf_view.cc | 58 +++--
ash/shelf/shelf_view.h | 7 +
ash/shelf/shelf_view_test_api.cc | 5 +-
ash/shelf/shelf_view_test_api.h | 4 +-
ash/shelf/shelf_view_unittest.cc | 88 +++----
ash/shelf/shelf_window_watcher_item_delegate.cc | 32 ++-
ash/shelf/shelf_window_watcher_item_delegate.h | 7 +-
ash/shell/context_menu.cc | 46 ----
ash/shell/context_menu.h | 45 ----
ash/shell/shell_delegate_impl.cc | 6 -
ash/shell/shell_delegate_impl.h | 2 -
ash/shell/window_watcher_shelf_item_delegate.cc | 8 +-
ash/shell/window_watcher_shelf_item_delegate.h | 5 +-
ash/shell_delegate.h | 8 -
ash/shell_port.cc | 5 +-
ash/strings/BUILD.gn | 2 +
ash/test_shell_delegate.cc | 5 -
ash/test_shell_delegate.h | 2 -
ash/wallpaper/test_wallpaper_delegate.cc | 4 +
ash/wallpaper/test_wallpaper_delegate.h | 1 +
chrome/browser/ui/BUILD.gn | 2 -
chrome/browser/ui/ash/chrome_shell_delegate.cc | 18 --
chrome/browser/ui/ash/chrome_shell_delegate.h | 2 -
.../app_shortcut_launcher_item_controller.cc | 16 +-
.../app_shortcut_launcher_item_controller.h | 6 +-
.../app_window_launcher_item_controller.cc | 10 +-
.../launcher/app_window_launcher_item_controller.h | 2 +-
.../arc_app_deferred_launcher_item_controller.cc | 9 +-
.../arc_app_deferred_launcher_item_controller.h | 5 +-
.../arc_app_window_launcher_item_controller.cc | 22 +-
.../arc_app_window_launcher_item_controller.h | 5 +-
.../ui/ash/launcher/arc_launcher_context_menu.cc | 11 +-
.../ui/ash/launcher/arc_launcher_context_menu.h | 10 +-
.../browser_shortcut_launcher_item_controller.cc | 17 +-
.../browser_shortcut_launcher_item_controller.h | 6 +-
.../chrome_launcher_controller_browsertest.cc | 12 +-
.../chrome_launcher_controller_unittest.cc | 15 +-
.../desktop_shell_launcher_context_menu.cc | 19 --
.../launcher/desktop_shell_launcher_context_menu.h | 32 ---
...xtension_app_window_launcher_item_controller.cc | 16 +-
...extension_app_window_launcher_item_controller.h | 5 +-
.../launcher/extension_launcher_context_menu.cc | 42 +---
.../ash/launcher/extension_launcher_context_menu.h | 11 +-
.../ui/ash/launcher/launcher_context_menu.cc | 125 +++-------
.../ui/ash/launcher/launcher_context_menu.h | 36 +--
.../ash/launcher/launcher_context_menu_unittest.cc | 115 ++-------
72 files changed, 1081 insertions(+), 825 deletions(-)

Upstream: git.chromium.org


  • Share