OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/app_window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 | 588 |
589 void AppWindow::UpdateDraggableRegions( | 589 void AppWindow::UpdateDraggableRegions( |
590 const std::vector<DraggableRegion>& regions) { | 590 const std::vector<DraggableRegion>& regions) { |
591 native_app_window_->UpdateDraggableRegions(regions); | 591 native_app_window_->UpdateDraggableRegions(regions); |
592 } | 592 } |
593 | 593 |
594 void AppWindow::UpdateAppIcon(const gfx::Image& image) { | 594 void AppWindow::UpdateAppIcon(const gfx::Image& image) { |
595 // Set the showInShelf=true window icon and add the app_icon_image_ | 595 // Set the showInShelf=true window icon and add the app_icon_image_ |
596 // as a badge. If the image is empty, set the default app icon placeholder | 596 // as a badge. If the image is empty, set the default app icon placeholder |
597 // as the base image. | 597 // as the base image. |
598 if (window_icon_url_.is_valid() && !app_icon_image_->image().IsEmpty()) { | 598 if (window_icon_url_.is_valid() && app_icon_image_ && |
khmel
2017/04/06 19:08:59
this fixes crash when icon is set but not showInSh
| |
599 !app_icon_image_->image().IsEmpty()) { | |
599 gfx::Image base_image = | 600 gfx::Image base_image = |
600 !image.IsEmpty() | 601 !image.IsEmpty() |
601 ? image | 602 ? image |
602 : gfx::Image(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 603 : gfx::Image(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
603 IDR_APP_DEFAULT_ICON)); | 604 IDR_APP_DEFAULT_ICON)); |
604 // Scale the icon to EXTENSION_ICON_LARGE. | 605 // Scale the icon to EXTENSION_ICON_LARGE. |
605 const int large_icon_size = extension_misc::EXTENSION_ICON_LARGE; | 606 const int large_icon_size = extension_misc::EXTENSION_ICON_LARGE; |
606 if (base_image.Width() != large_icon_size || | 607 if (base_image.Width() != large_icon_size || |
607 base_image.Height() != large_icon_size) { | 608 base_image.Height() != large_icon_size) { |
608 gfx::ImageSkia resized_image = | 609 gfx::ImageSkia resized_image = |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1113 region.bounds.x(), | 1114 region.bounds.x(), |
1114 region.bounds.y(), | 1115 region.bounds.y(), |
1115 region.bounds.right(), | 1116 region.bounds.right(), |
1116 region.bounds.bottom(), | 1117 region.bounds.bottom(), |
1117 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1118 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1118 } | 1119 } |
1119 return sk_region; | 1120 return sk_region; |
1120 } | 1121 } |
1121 | 1122 |
1122 } // namespace extensions | 1123 } // namespace extensions |
OLD | NEW |