| 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..cc201ceeba1f7e1c0423c08911351e6a3f776225 100644
|
| --- a/chrome/browser/ui/ash/launcher/arc_app_window.cc
|
| +++ b/chrome/browser/ui/ash/launcher/arc_app_window.cc
|
| @@ -14,6 +14,7 @@
|
| #include "ui/aura/window.h"
|
| #include "ui/gfx/codec/png_codec.h"
|
| #include "ui/gfx/image/image_skia_operations.h"
|
| +#include "ui/views/widget/native_widget_aura.h"
|
| #include "ui/views/widget/widget.h"
|
|
|
| ArcAppWindow::ArcAppWindow(int task_id,
|
| @@ -33,8 +34,6 @@ void ArcAppWindow::SetController(
|
| ArcAppWindowLauncherItemController* controller) {
|
| DCHECK(!controller_ || !controller);
|
| controller_ = controller;
|
| - if (controller_)
|
| - controller_->UpdateLauncherItem();
|
| }
|
|
|
| void ArcAppWindow::SetFullscreenMode(FullScreenMode mode) {
|
| @@ -49,7 +48,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 +156,25 @@ 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())) {
|
| + // Support unit tests where we don't have exo system initialized.
|
| + views::NativeWidgetAura::AssignIconToAuraWindow(
|
| + GetNativeWindow(), gfx::ImageSkia() /* window_icon */,
|
| + icon /* app_icon */);
|
| 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)));
|
| }
|
|
|