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

Side by Side Diff: chrome/browser/ui/views/status_icons/status_icon_win.cc

Issue 1387383004: Plumb NotifierId to status icon balloons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notif_cleanup
Patch Set: Rebase Created 5 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/status_icons/status_icon_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ui/gfx/geometry/point.h" 11 #include "ui/gfx/geometry/point.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/icon_util.h" 13 #include "ui/gfx/icon_util.h"
14 #include "ui/message_center/notifier_settings.h"
14 #include "ui/views/controls/menu/menu_runner.h" 15 #include "ui/views/controls/menu/menu_runner.h"
15 16
16 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
17 // StatusIconWin, public: 18 // StatusIconWin, public:
18 19
19 StatusIconWin::StatusIconWin(StatusTrayWin* tray, 20 StatusIconWin::StatusIconWin(StatusTrayWin* tray,
20 UINT id, 21 UINT id,
21 HWND window, 22 HWND window,
22 UINT message) 23 UINT message)
23 : tray_(tray), 24 : tray_(tray),
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Create the icon. 109 // Create the icon.
109 NOTIFYICONDATA icon_data; 110 NOTIFYICONDATA icon_data;
110 InitIconData(&icon_data); 111 InitIconData(&icon_data);
111 icon_data.uFlags = NIF_TIP; 112 icon_data.uFlags = NIF_TIP;
112 wcscpy_s(icon_data.szTip, tool_tip.c_str()); 113 wcscpy_s(icon_data.szTip, tool_tip.c_str());
113 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); 114 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
114 if (!result) 115 if (!result)
115 LOG(WARNING) << "Unable to set tooltip for status tray icon"; 116 LOG(WARNING) << "Unable to set tooltip for status tray icon";
116 } 117 }
117 118
118 void StatusIconWin::DisplayBalloon(const gfx::ImageSkia& icon, 119 void StatusIconWin::DisplayBalloon(
119 const base::string16& title, 120 const gfx::ImageSkia& icon,
120 const base::string16& contents) { 121 const base::string16& title,
122 const base::string16& contents,
123 const message_center::NotifierId& notifier_id) {
121 NOTIFYICONDATA icon_data; 124 NOTIFYICONDATA icon_data;
122 InitIconData(&icon_data); 125 InitIconData(&icon_data);
123 icon_data.uFlags = NIF_INFO; 126 icon_data.uFlags = NIF_INFO;
124 icon_data.dwInfoFlags = NIIF_INFO; 127 icon_data.dwInfoFlags = NIIF_INFO;
125 wcscpy_s(icon_data.szInfoTitle, title.c_str()); 128 wcscpy_s(icon_data.szInfoTitle, title.c_str());
126 wcscpy_s(icon_data.szInfo, contents.c_str()); 129 wcscpy_s(icon_data.szInfo, contents.c_str());
127 icon_data.uTimeout = 0; 130 icon_data.uTimeout = 0;
128 131
129 base::win::Version win_version = base::win::GetVersion(); 132 base::win::Version win_version = base::win::GetVersion();
130 if (!icon.isNull() && win_version != base::win::VERSION_PRE_XP) { 133 if (!icon.isNull() && win_version != base::win::VERSION_PRE_XP) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 memset(icon_data, 0, sizeof(NOTIFYICONDATA)); 167 memset(icon_data, 0, sizeof(NOTIFYICONDATA));
165 icon_data->cbSize = sizeof(NOTIFYICONDATA); 168 icon_data->cbSize = sizeof(NOTIFYICONDATA);
166 } else { 169 } else {
167 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE); 170 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE);
168 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE; 171 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE;
169 } 172 }
170 173
171 icon_data->hWnd = window_; 174 icon_data->hWnd = window_;
172 icon_data->uID = icon_id_; 175 icon_data->uID = icon_id_;
173 } 176 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/status_icons/status_icon_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698