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

Unified Diff: chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Cleanup; fix ash_shell compile and a couple tests. Created 3 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: chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc
index e885823a3e934b7a95f22f2b8ad5f4063d1c24ff..eefa923a0a125de6d5e7972c969d01757cd9cbf7 100644
--- a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc
@@ -39,9 +39,9 @@ void ExtensionAppWindowLauncherItemController::AddAppWindow(
AddWindow(app_window->GetBaseWindow());
}
-ash::ShelfAppMenuItemList
+ash::ShelfItemDelegate::MenuItemList
ExtensionAppWindowLauncherItemController::GetAppMenuItems(int event_flags) {
- ash::ShelfAppMenuItemList items;
+ ash::ShelfItemDelegate::MenuItemList items;
extensions::AppWindowRegistry* app_window_registry =
extensions::AppWindowRegistry::Get(launcher_controller()->profile());
@@ -52,6 +52,10 @@ ExtensionAppWindowLauncherItemController::GetAppMenuItems(int event_flags) {
window->GetNativeWindow());
DCHECK(app_window);
+ ash::mojom::MenuItemPtr item(ash::mojom::MenuItem::New());
+ item->command_id = window_index;
+ item->label = app_window->GetTitle();
+
// Use the app's web contents favicon, or the app window's icon.
favicon::FaviconDriver* favicon_driver =
favicon::ContentFaviconDriver::FromWebContents(
@@ -59,9 +63,9 @@ ExtensionAppWindowLauncherItemController::GetAppMenuItems(int event_flags) {
gfx::Image icon = favicon_driver->GetFavicon();
if (icon.IsEmpty())
icon = app_window->app_icon();
-
- items.push_back(base::MakeUnique<ash::ShelfApplicationMenuItem>(
- window_index, app_window->GetTitle(), &icon));
+ if (!icon.IsEmpty())
+ item->image = *icon.ToSkBitmap();
+ items.push_back(std::move(item));
++window_index;
}
return items;
@@ -69,6 +73,6 @@ ExtensionAppWindowLauncherItemController::GetAppMenuItems(int event_flags) {
void ExtensionAppWindowLauncherItemController::ExecuteCommand(
uint32_t command_id,
- int event_flags) {
+ int32_t event_flags) {
launcher_controller()->ActivateShellApp(app_id(), command_id);
}

Powered by Google App Engine
This is Rietveld 408576698