Chromium Code Reviews| Index: ui/views/mus/native_widget_mus.cc |
| diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc |
| index 10fa38555069458e4104fa3c7b0dbe7ee4c6ea8e..5339bb1657cd8dd0821f94d0e86fb708c060a212 100644 |
| --- a/ui/views/mus/native_widget_mus.cc |
| +++ b/ui/views/mus/native_widget_mus.cc |
| @@ -196,6 +196,17 @@ int ResizeBehaviorFromDelegate(WidgetDelegate* delegate) { |
| return behavior; |
| } |
| +// Returns the 1x window app icon or an empty SkBitmap if no icon is available. |
| +// TODO(jamescook): Support other scale factors. |
| +SkBitmap AppIconFromDelegate(WidgetDelegate* delegate) { |
| + if (!delegate) |
| + return SkBitmap(); |
| + gfx::ImageSkia app_icon = delegate->GetWindowAppIcon(); |
| + if (app_icon.isNull()) |
| + return SkBitmap(); |
| + return app_icon.GetRepresentation(1.f).sk_bitmap(); |
| +} |
| + |
| } // namespace |
| class NativeWidgetMus::MusWindowObserver : public mus::WindowObserver { |
| @@ -352,6 +363,12 @@ void NativeWidgetMus::ConfigurePropertiesForNewWindow( |
| (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = |
| mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
| ResizeBehaviorFromDelegate(init_params.delegate)); |
| + SkBitmap app_icon = AppIconFromDelegate(init_params.delegate); |
| + if (!app_icon.isNull()) { |
| + (*properties)[mus::mojom::WindowManager::kWindowAppIcon_Property] = |
| + mojo::TypeConverter<const std::vector<uint8_t>, SkBitmap>::Convert( |
| + app_icon); |
| + } |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -542,7 +559,13 @@ bool NativeWidgetMus::SetWindowTitle(const base::string16& title) { |
| void NativeWidgetMus::SetWindowIcons(const gfx::ImageSkia& window_icon, |
| const gfx::ImageSkia& app_icon) { |
| - // NOTIMPLEMENTED(); |
| + if (!app_icon.isNull()) { |
|
sky
2016/03/23 23:30:40
Seems like you should always update the icon. That
James Cook
2016/03/25 15:39:28
Done. This revealed a problem that both the primar
|
| + // Send the app icon 1x bitmap to the window manager. |
| + // TODO(jamescook): Support other scale factors. |
| + window_->SetSharedProperty<SkBitmap>( |
| + mus::mojom::WindowManager::kWindowAppIcon_Property, |
| + app_icon.GetRepresentation(1.f).sk_bitmap()); |
| + } |
| } |
| void NativeWidgetMus::InitModalType(ui::ModalType modal_type) { |