OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/status_icons/status_icon_win.h" | 5 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
9 #include "chrome/browser/ui/views/status_icons/status_tray_win.h" | 9 #include "chrome/browser/ui/views/status_icons/status_tray_win.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 NOTIFYICONDATA icon_data; | 97 NOTIFYICONDATA icon_data; |
98 InitIconData(&icon_data); | 98 InitIconData(&icon_data); |
99 icon_data.uFlags = NIF_ICON; | 99 icon_data.uFlags = NIF_ICON; |
100 icon_.Set(IconUtil::CreateHICONFromSkBitmap(*image.bitmap())); | 100 icon_.Set(IconUtil::CreateHICONFromSkBitmap(*image.bitmap())); |
101 icon_data.hIcon = icon_.Get(); | 101 icon_data.hIcon = icon_.Get(); |
102 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); | 102 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); |
103 if (!result) | 103 if (!result) |
104 LOG(WARNING) << "Error setting status tray icon image"; | 104 LOG(WARNING) << "Error setting status tray icon image"; |
105 } | 105 } |
106 | 106 |
107 void StatusIconWin::SetPressedImage(const gfx::ImageSkia& image) { | |
108 // Ignore pressed images, since the standard on Windows is to not highlight | |
109 // pressed status icons. | |
110 } | |
111 | |
112 void StatusIconWin::SetToolTip(const base::string16& tool_tip) { | 107 void StatusIconWin::SetToolTip(const base::string16& tool_tip) { |
113 // Create the icon. | 108 // Create the icon. |
114 NOTIFYICONDATA icon_data; | 109 NOTIFYICONDATA icon_data; |
115 InitIconData(&icon_data); | 110 InitIconData(&icon_data); |
116 icon_data.uFlags = NIF_TIP; | 111 icon_data.uFlags = NIF_TIP; |
117 wcscpy_s(icon_data.szTip, tool_tip.c_str()); | 112 wcscpy_s(icon_data.szTip, tool_tip.c_str()); |
118 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); | 113 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); |
119 if (!result) | 114 if (!result) |
120 LOG(WARNING) << "Unable to set tooltip for status tray icon"; | 115 LOG(WARNING) << "Unable to set tooltip for status tray icon"; |
121 } | 116 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 memset(icon_data, 0, sizeof(NOTIFYICONDATA)); | 164 memset(icon_data, 0, sizeof(NOTIFYICONDATA)); |
170 icon_data->cbSize = sizeof(NOTIFYICONDATA); | 165 icon_data->cbSize = sizeof(NOTIFYICONDATA); |
171 } else { | 166 } else { |
172 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE); | 167 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE); |
173 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE; | 168 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE; |
174 } | 169 } |
175 | 170 |
176 icon_data->hWnd = window_; | 171 icon_data->hWnd = window_; |
177 icon_data->uID = icon_id_; | 172 icon_data->uID = icon_id_; |
178 } | 173 } |
OLD | NEW |