Chromium Code Reviews| Index: components/exo/shell_surface.cc |
| diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc |
| index 998769b20df6aeb73b117963a2e0d1d153fef79a..0c15ab23cf3286916eb287357cd622d3f0c6a21f 100644 |
| --- a/components/exo/shell_surface.cc |
| +++ b/components/exo/shell_surface.cc |
| @@ -42,10 +42,13 @@ |
| #include "ui/wm/core/window_animations.h" |
| #include "ui/wm/core/window_util.h" |
| +DECLARE_UI_CLASS_PROPERTY_TYPE(exo::ShellSurface*) |
|
reveman
2017/06/01 18:28:42
Don't add this. Launcher code can get the ShellSur
khmel
2017/06/01 21:55:46
Good point, thanks!
|
| + |
| namespace exo { |
| namespace { |
| DEFINE_LOCAL_UI_CLASS_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr) |
| +DEFINE_LOCAL_UI_CLASS_PROPERTY_KEY(ShellSurface*, kThisSurfaceKey, nullptr) |
| // Application Id set by the client. |
| DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kApplicationIdKey, nullptr); |
| @@ -531,6 +534,20 @@ void ShellSurface::SetApplicationId(const std::string& application_id) { |
| SetApplicationId(widget_->GetNativeWindow(), application_id); |
| } |
| +// static |
| +void ShellSurface::SetAppIcon(aura::Window* window, |
| + const gfx::ImageSkia& icon) { |
| + DCHECK(GetApplicationId(window) && !GetApplicationId(window)->empty()); |
| + ShellSurface* this_surface = window->GetProperty(kThisSurfaceKey); |
| + if (this_surface) { |
| + this_surface->icon_ = icon; |
| + this_surface->widget_->UpdateWindowIcon(); |
| + } else { |
| + // Support unit test case. |
| + window->SetProperty(aura::client::kAppIconKey, new gfx::ImageSkia(icon)); |
| + } |
| +} |
| + |
| void ShellSurface::Move() { |
| TRACE_EVENT0("exo", "ShellSurface::Move"); |
| @@ -819,6 +836,10 @@ base::string16 ShellSurface::GetWindowTitle() const { |
| return title_; |
| } |
| +gfx::ImageSkia ShellSurface::GetWindowIcon() { |
| + return icon_; |
| +} |
| + |
| void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds, |
| ui::WindowShowState show_state) { |
| if (bounds_mode_ != BoundsMode::CLIENT) |
| @@ -1156,6 +1177,7 @@ void ShellSurface::CreateShellSurfaceWidget(ui::WindowShowState show_state) { |
| window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter(widget_))); |
| SetApplicationId(window, application_id_); |
| SetMainSurface(window, surface_); |
| + window->SetProperty(kThisSurfaceKey, this); |
| // Start tracking changes to window bounds and window state. |
| window->AddObserver(this); |