Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5727)

Unified Diff: chrome/browser/ui/views/status_icons/status_icon_win.cc

Issue 1406403007: Eliminate HICON leaks caused by creating icons from bitmap image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/status_icons/status_icon_win.cc
diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.cc b/chrome/browser/ui/views/status_icons/status_icon_win.cc
index 105bf487ce5951455d5d1d9963e74167c9dca79a..0ce341ed3140b2e32fa9896a087a386a51cd9f18 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_icon_win.cc
@@ -82,7 +82,7 @@ void StatusIconWin::ResetIcon() {
InitIconData(&icon_data);
icon_data.uFlags = NIF_MESSAGE;
icon_data.uCallbackMessage = message_id_;
- icon_data.hIcon = icon_.Get();
+ icon_data.hIcon = icon_.get();
// If we have an image, then set the NIF_ICON flag, which tells
// Shell_NotifyIcon() to set the image for the status icon it creates.
if (icon_data.hIcon)
@@ -98,8 +98,8 @@ void StatusIconWin::SetImage(const gfx::ImageSkia& image) {
NOTIFYICONDATA icon_data;
InitIconData(&icon_data);
icon_data.uFlags = NIF_ICON;
- icon_.Set(IconUtil::CreateHICONFromSkBitmap(*image.bitmap()));
- icon_data.hIcon = icon_.Get();
+ icon_ = IconUtil::CreateHICONFromSkBitmap(*image.bitmap()).Pass();
+ icon_data.hIcon = icon_.get();
BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
if (!result)
LOG(WARNING) << "Error setting status tray icon image";
@@ -131,12 +131,12 @@ void StatusIconWin::DisplayBalloon(
base::win::Version win_version = base::win::GetVersion();
if (!icon.isNull() && win_version != base::win::VERSION_PRE_XP) {
- balloon_icon_.Set(IconUtil::CreateHICONFromSkBitmap(*icon.bitmap()));
+ balloon_icon_ = IconUtil::CreateHICONFromSkBitmap(*icon.bitmap()).Pass();
if (win_version >= base::win::VERSION_VISTA) {
- icon_data.hBalloonIcon = balloon_icon_.Get();
+ icon_data.hBalloonIcon = balloon_icon_.get();
icon_data.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON;
} else {
- icon_data.hIcon = balloon_icon_.Get();
+ icon_data.hIcon = balloon_icon_.get();
icon_data.uFlags |= NIF_ICON;
icon_data.dwInfoFlags = NIIF_USER;
}
« no previous file with comments | « chrome/browser/ui/views/panels/panel_frame_view.cc ('k') | chrome/browser/ui/views/tabs/window_finder_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698