| 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 7168d7c672257d63b1507c009f496039fd1d72ba..9cd24007e0492dc36a17af6c111d5c52dc51052b 100644
|
| --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
|
| +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
|
| @@ -64,13 +64,16 @@ const int kNewTabCaptionMaximizedSpacing = 16;
|
|
|
| // Converts the |image| to a Windows icon and returns the corresponding HICON
|
| // handle. |image| is resized to desired |width| and |height| if needed.
|
| -HICON CreateHICONFromSkBitmapSizedTo(const gfx::ImageSkia& image,
|
| - int width,
|
| - int height) {
|
| - if (width == image.width() && height == image.height())
|
| - return IconUtil::CreateHICONFromSkBitmap(*image.bitmap());
|
| - return IconUtil::CreateHICONFromSkBitmap(skia::ImageOperations::Resize(
|
| - *image.bitmap(), skia::ImageOperations::RESIZE_BEST, width, height));
|
| +base::win::ScopedHICON CreateHICONFromSkBitmapSizedTo(
|
| + const gfx::ImageSkia& image,
|
| + int width,
|
| + int height) {
|
| + return base::win::ScopedHICON(IconUtil::CreateHICONFromSkBitmap(
|
| + width == image.width() && height == image.height()
|
| + ? *image.bitmap()
|
| + : skia::ImageOperations::Resize(*image.bitmap(),
|
| + skia::ImageOperations::RESIZE_BEST,
|
| + width, height)));
|
| }
|
|
|
| } // namespace
|
| @@ -581,10 +584,18 @@ void GlassBrowserFrameView::StopThrobber() {
|
| if (browser_view()->ShouldShowWindowIcon()) {
|
| gfx::ImageSkia icon = browser_view()->GetWindowIcon();
|
| if (!icon.isNull()) {
|
| - small_icon = CreateHICONFromSkBitmapSizedTo(
|
| - icon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
|
| - big_icon = CreateHICONFromSkBitmapSizedTo(
|
| - icon, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
|
| + // Take responsibility for eventually destroying the created icons.
|
| + small_window_icon_ =
|
| + CreateHICONFromSkBitmapSizedTo(icon, GetSystemMetrics(SM_CXSMICON),
|
| + GetSystemMetrics(SM_CYSMICON))
|
| + .Pass();
|
| + big_window_icon_ =
|
| + CreateHICONFromSkBitmapSizedTo(icon, GetSystemMetrics(SM_CXICON),
|
| + GetSystemMetrics(SM_CYICON))
|
| + .Pass();
|
| +
|
| + small_icon = small_window_icon_.Get();
|
| + big_icon = big_window_icon_.Get();
|
| }
|
| }
|
|
|
| @@ -601,21 +612,13 @@ void GlassBrowserFrameView::StopThrobber() {
|
| // 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
|
| - HICON previous_small_icon = reinterpret_cast<HICON>(
|
| - SendMessage(views::HWNDForWidget(frame()), WM_SETICON,
|
| - static_cast<WPARAM>(ICON_SMALL),
|
| - reinterpret_cast<LPARAM>(small_icon)));
|
| -
|
| - HICON previous_big_icon = reinterpret_cast<HICON>(
|
| - SendMessage(views::HWNDForWidget(frame()), WM_SETICON,
|
| - static_cast<WPARAM>(ICON_BIG),
|
| - reinterpret_cast<LPARAM>(big_icon)));
|
| -
|
| - if (previous_small_icon)
|
| - ::DestroyIcon(previous_small_icon);
|
| + SendMessage(views::HWNDForWidget(frame()), WM_SETICON,
|
| + static_cast<WPARAM>(ICON_SMALL),
|
| + reinterpret_cast<LPARAM>(small_icon));
|
|
|
| - if (previous_big_icon)
|
| - ::DestroyIcon(previous_big_icon);
|
| + SendMessage(views::HWNDForWidget(frame()), WM_SETICON,
|
| + static_cast<WPARAM>(ICON_BIG),
|
| + reinterpret_cast<LPARAM>(big_icon));
|
| }
|
| }
|
|
|
|
|