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

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

Issue 2209053004: Enhance chrome.app.window API with icon property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
index eba8e08d10b8dbf54c1b839830cd7c97f2279284..1e0c9983b74a3ca5af0a77bdfe9d5ee09b6dc198 100644
--- a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
@@ -85,6 +85,12 @@ void ExtensionAppWindowLauncherController::OnAppWindowIconChanged(
return;
ExtensionAppWindowLauncherItemController* controller = iter->second;
controller->set_image_set_by_controller(true);
+ // Set window icon for showInShelf=true window.
+ if (app_window->show_in_shelf() && !app_window->window_icon().IsEmpty()) {
+ owner()->SetLauncherItemImage(controller->shelf_id(),
+ app_window->window_icon().AsImageSkia());
+ return;
stevenjb 2016/08/04 21:00:47 nit: I would use an else here instead of an early
Andra Paraschiv 2016/08/08 13:34:12 Done.
+ }
owner()->SetLauncherItemImage(controller->shelf_id(),
app_window->app_icon().AsImageSkia());
}
@@ -180,9 +186,15 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) {
if (shelf_id == 0) {
shelf_id = owner()->CreateAppLauncherItem(controller, app_id, status);
- // Restore any existing app icon and flag as set.
const gfx::Image& app_icon = app_window->app_icon();
- if (!app_icon.IsEmpty()) {
+ const gfx::Image& window_icon = app_window->window_icon();
+ // Restore any existing window icon for showInShelf=true window
+ // and flag as set.
+ if (app_window->show_in_shelf() && !window_icon.IsEmpty()) {
+ owner()->SetLauncherItemImage(shelf_id, window_icon.AsImageSkia());
+ controller->set_image_set_by_controller(true);
+ // Restore any existing app icon and flag as set.
stevenjb 2016/08/04 21:00:47 This is confusing here. I would put both comments
Andra Paraschiv 2016/08/08 13:34:12 Done.
+ } else if (!app_icon.IsEmpty()) {
owner()->SetLauncherItemImage(shelf_id, app_icon.AsImageSkia());
controller->set_image_set_by_controller(true);
}

Powered by Google App Engine
This is Rietveld 408576698