| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/launcher/arc_app_window.h" | 5 #include "chrome/browser/ui/ash/launcher/arc_app_window.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h" | 8 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h" |
| 9 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 10 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 owner_(owner) {} | 26 owner_(owner) {} |
| 27 | 27 |
| 28 ArcAppWindow::~ArcAppWindow() { | 28 ArcAppWindow::~ArcAppWindow() { |
| 29 ImageDecoder::Cancel(this); | 29 ImageDecoder::Cancel(this); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void ArcAppWindow::SetController( | 32 void ArcAppWindow::SetController( |
| 33 ArcAppWindowLauncherItemController* controller) { | 33 ArcAppWindowLauncherItemController* controller) { |
| 34 DCHECK(!controller_ || !controller); | 34 DCHECK(!controller_ || !controller); |
| 35 controller_ = controller; | 35 controller_ = controller; |
| 36 if (controller_) | |
| 37 controller_->UpdateLauncherItem(); | |
| 38 } | 36 } |
| 39 | 37 |
| 40 void ArcAppWindow::SetFullscreenMode(FullScreenMode mode) { | 38 void ArcAppWindow::SetFullscreenMode(FullScreenMode mode) { |
| 41 DCHECK(mode != FullScreenMode::NOT_DEFINED); | 39 DCHECK(mode != FullScreenMode::NOT_DEFINED); |
| 42 fullscreen_mode_ = mode; | 40 fullscreen_mode_ = mode; |
| 43 } | 41 } |
| 44 | 42 |
| 45 void ArcAppWindow::SetDescription( | 43 void ArcAppWindow::SetDescription( |
| 46 const std::string& title, | 44 const std::string& title, |
| 47 const std::vector<uint8_t>& unsafe_icon_data_png) { | 45 const std::vector<uint8_t>& unsafe_icon_data_png) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool ArcAppWindow::IsAlwaysOnTop() const { | 149 bool ArcAppWindow::IsAlwaysOnTop() const { |
| 152 NOTREACHED(); | 150 NOTREACHED(); |
| 153 return false; | 151 return false; |
| 154 } | 152 } |
| 155 | 153 |
| 156 void ArcAppWindow::SetAlwaysOnTop(bool always_on_top) { | 154 void ArcAppWindow::SetAlwaysOnTop(bool always_on_top) { |
| 157 NOTREACHED(); | 155 NOTREACHED(); |
| 158 } | 156 } |
| 159 | 157 |
| 160 void ArcAppWindow::ResetIcon() { | 158 void ArcAppWindow::ResetIcon() { |
| 161 if (icon_.isNull()) | 159 exo::ShellSurface::SetAppIcon(GetNativeWindow(), gfx::ImageSkia()); |
| 162 return; | |
| 163 icon_ = gfx::ImageSkia(); | |
| 164 if (controller_) | |
| 165 controller_->UpdateLauncherItem(); | |
| 166 } | 160 } |
| 167 | 161 |
| 168 void ArcAppWindow::OnImageDecoded(const SkBitmap& decoded_image) { | 162 void ArcAppWindow::OnImageDecoded(const SkBitmap& decoded_image) { |
| 169 // TODO(khmel): Use aura::Window property http://crbug.com/724292 | 163 exo::ShellSurface::SetAppIcon( |
| 170 icon_ = gfx::ImageSkiaOperations::CreateResizedImage( | 164 GetNativeWindow(), |
| 171 gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f)), | 165 gfx::ImageSkiaOperations::CreateResizedImage( |
| 172 skia::ImageOperations::RESIZE_BEST, | 166 gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f)), |
| 173 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, | 167 skia::ImageOperations::RESIZE_BEST, |
| 174 extension_misc::EXTENSION_ICON_SMALL)); | 168 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, |
| 175 if (controller_) | 169 extension_misc::EXTENSION_ICON_SMALL))); |
| 176 controller_->UpdateLauncherItem(); | |
| 177 } | 170 } |
| OLD | NEW |