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

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

Issue 2900783003: Handle app custom icon via aura::Window property. (Closed)
Patch Set: nits Created 3 years, 7 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/arc_app_window.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_app_window.cc b/chrome/browser/ui/ash/launcher/arc_app_window.cc
index d47bf54ef72a1e9207b9945d97a8d38faac75b99..ca8db03b9dfaefcaa42227bf8b35f75effdc83ce 100644
--- a/chrome/browser/ui/ash/launcher/arc_app_window.cc
+++ b/chrome/browser/ui/ash/launcher/arc_app_window.cc
@@ -33,8 +33,6 @@ void ArcAppWindow::SetController(
ArcAppWindowLauncherItemController* controller) {
DCHECK(!controller_ || !controller);
controller_ = controller;
- if (controller_)
- controller_->UpdateLauncherItem();
}
void ArcAppWindow::SetFullscreenMode(FullScreenMode mode) {
@@ -49,7 +47,7 @@ void ArcAppWindow::SetDescription(
GetNativeWindow()->SetTitle(base::UTF8ToUTF16(title));
ImageDecoder::Cancel(this);
if (unsafe_icon_data_png.empty()) {
- ResetIcon();
+ SetIcon(gfx::ImageSkia());
return;
}
@@ -157,21 +155,20 @@ void ArcAppWindow::SetAlwaysOnTop(bool always_on_top) {
NOTREACHED();
}
-void ArcAppWindow::ResetIcon() {
- if (icon_.isNull())
+void ArcAppWindow::SetIcon(const gfx::ImageSkia& icon) {
+ if (!exo::ShellSurface::GetMainSurface(GetNativeWindow()))
return;
- icon_ = gfx::ImageSkia();
- if (controller_)
- controller_->UpdateLauncherItem();
+ exo::ShellSurface* shell_surface = static_cast<exo::ShellSurface*>(
+ widget_->widget_delegate()->GetContentsView());
+ if (!shell_surface)
+ return;
+ shell_surface->SetIcon(icon);
}
void ArcAppWindow::OnImageDecoded(const SkBitmap& decoded_image) {
- // TODO(khmel): Use aura::Window property http://crbug.com/724292
- icon_ = gfx::ImageSkiaOperations::CreateResizedImage(
+ SetIcon(gfx::ImageSkiaOperations::CreateResizedImage(
gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f)),
skia::ImageOperations::RESIZE_BEST,
gfx::Size(extension_misc::EXTENSION_ICON_SMALL,
- extension_misc::EXTENSION_ICON_SMALL));
- if (controller_)
- controller_->UpdateLauncherItem();
+ extension_misc::EXTENSION_ICON_SMALL)));
}

Powered by Google App Engine
This is Rietveld 408576698