Chromium Code Reviews| Index: chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| index 22d2320ab5bf50a0d0cb904cd3f22cbfc5629136..3ad2246ee1c210b5a10c0364c50d767e2532d904 100644 |
| --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| @@ -21,6 +21,7 @@ |
| #include "components/signin/core/common/profile_management_switches.h" |
| #include "content/public/browser/notification_service.h" |
| #include "grit/theme_resources.h" |
| +#include "skia/ext/image_operations.h" |
| #include "ui/base/resource/resource_bundle_win.h" |
| #include "ui/base/theme_provider.h" |
| #include "ui/gfx/canvas.h" |
| @@ -72,6 +73,15 @@ const int kNewTabCaptionMaximizedSpacing = 16; |
| // is no avatar icon. |
| const int kTabStripIndent = -6; |
| +HICON CreateHICONFromSkBitmap(const gfx::ImageSkia& image, int width, |
|
sky
2014/12/11 15:51:23
Make sure to run git cl format.
sky
2014/12/11 15:51:23
Add description of this. Also, it should be rename
Tomasz Moniuszko
2014/12/12 11:47:07
Done.
Tomasz Moniuszko
2014/12/12 11:47:07
Done.
|
| + int height) { |
| + if (width == image.width() && height == image.height()) { |
|
sky
2014/12/11 15:51:23
nit: no {}
Tomasz Moniuszko
2014/12/12 11:47:07
Done.
|
| + return IconUtil::CreateHICONFromSkBitmap(*image.bitmap()); |
| + } |
| + return IconUtil::CreateHICONFromSkBitmap(skia::ImageOperations::Resize( |
| + *image.bitmap(), skia::ImageOperations::RESIZE_BEST, width, height)); |
| +} |
| + |
| } // namespace |
| /////////////////////////////////////////////////////////////////////////////// |
| @@ -539,27 +549,39 @@ void GlassBrowserFrameView::StopThrobber() { |
| if (throbber_running_) { |
| throbber_running_ = false; |
| - HICON frame_icon = nullptr; |
| + HICON small_icon = nullptr; |
| + HICON big_icon = nullptr; |
| // Check if hosted BrowserView has a window icon to use. |
| if (browser_view()->ShouldShowWindowIcon()) { |
| gfx::ImageSkia icon = browser_view()->GetWindowIcon(); |
| - if (!icon.isNull()) |
| - frame_icon = IconUtil::CreateHICONFromSkBitmap(*icon.bitmap()); |
| + if (!icon.isNull()) { |
| + small_icon = CreateHICONFromSkBitmap( |
| + icon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); |
| + big_icon = CreateHICONFromSkBitmap( |
| + icon, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); |
| + } |
| } |
| // Fallback to class icon. |
| - if (!frame_icon) { |
| - frame_icon = reinterpret_cast<HICON>(GetClassLongPtr( |
| + if (!small_icon) { |
| + small_icon = reinterpret_cast<HICON>(GetClassLongPtr( |
| views::HWNDForWidget(frame()), GCLP_HICONSM)); |
| } |
| + if (!big_icon) { |
| + big_icon = reinterpret_cast<HICON>(GetClassLongPtr( |
| + views::HWNDForWidget(frame()), GCLP_HICON)); |
| + } |
| - // This will reset the small icon which we set in the throbber code. |
| + // This will reset the icon which we set in the throbber code. |
| // WM_SETICON with null icon restores the icon for title bar but not |
| // for taskbar. See http://crbug.com/29996 |
| SendMessage(views::HWNDForWidget(frame()), WM_SETICON, |
| static_cast<WPARAM>(ICON_SMALL), |
| - reinterpret_cast<LPARAM>(frame_icon)); |
| + reinterpret_cast<LPARAM>(small_icon)); |
| + SendMessage(views::HWNDForWidget(frame()), WM_SETICON, |
| + static_cast<WPARAM>(ICON_BIG), |
| + reinterpret_cast<LPARAM>(big_icon)); |
| } |
| } |