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

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

Issue 256443004: Revert of Moves the notification icon out of the status area overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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"
10 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "ui/gfx/icon_util.h" 10 #include "ui/gfx/icon_util.h"
12 #include "ui/gfx/point.h" 11 #include "ui/gfx/point.h"
13 #include "ui/views/controls/menu/menu_item_view.h" 12 #include "ui/views/controls/menu/menu_item_view.h"
14 #include "ui/views/controls/menu/menu_runner.h" 13 #include "ui/views/controls/menu/menu_runner.h"
15 14
16 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
17 // StatusIconWin, public: 16 // StatusIconWin, public:
18 17
19 StatusIconWin::StatusIconWin(StatusTrayWin* tray, 18 StatusIconWin::StatusIconWin(UINT id, HWND window, UINT message)
20 UINT id, 19 : icon_id_(id),
21 HWND window,
22 UINT message)
23 : tray_(tray),
24 icon_id_(id),
25 window_(window), 20 window_(window),
26 message_id_(message), 21 message_id_(message),
27 menu_model_(NULL) { 22 menu_model_(NULL) {
28 NOTIFYICONDATA icon_data; 23 NOTIFYICONDATA icon_data;
29 InitIconData(&icon_data); 24 InitIconData(&icon_data);
30 icon_data.uFlags = NIF_MESSAGE; 25 icon_data.uFlags = NIF_MESSAGE;
31 icon_data.uCallbackMessage = message_id_; 26 icon_data.uCallbackMessage = message_id_;
32 BOOL result = Shell_NotifyIcon(NIM_ADD, &icon_data); 27 BOOL result = Shell_NotifyIcon(NIM_ADD, &icon_data);
33 // This can happen if the explorer process isn't running when we try to 28 // This can happen if the explorer process isn't running when we try to
34 // create the icon for some reason (for example, at startup). 29 // create the icon for some reason (for example, at startup).
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 icon_data.uFlags |= NIF_ICON; 135 icon_data.uFlags |= NIF_ICON;
141 icon_data.dwInfoFlags = NIIF_USER; 136 icon_data.dwInfoFlags = NIIF_USER;
142 } 137 }
143 } 138 }
144 139
145 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); 140 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
146 if (!result) 141 if (!result)
147 LOG(WARNING) << "Unable to create status tray balloon."; 142 LOG(WARNING) << "Unable to create status tray balloon.";
148 } 143 }
149 144
150 void StatusIconWin::ForceVisible() {
151 tray_->UpdateIconVisibilityInBackground(this);
152 }
153
154 //////////////////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////////////////
155 // StatusIconWin, private: 146 // StatusIconWin, private:
156 147
157 void StatusIconWin::UpdatePlatformContextMenu(StatusIconMenuModel* menu) { 148 void StatusIconWin::UpdatePlatformContextMenu(StatusIconMenuModel* menu) {
158 // |menu_model_| is about to be destroyed. Destroy the menu (which closes it) 149 // |menu_model_| is about to be destroyed. Destroy the menu (which closes it)
159 // so that it doesn't attempt to continue using |menu_model_|. 150 // so that it doesn't attempt to continue using |menu_model_|.
160 menu_runner_.reset(); 151 menu_runner_.reset();
161 DCHECK(menu); 152 DCHECK(menu);
162 menu_model_ = menu; 153 menu_model_ = menu;
163 } 154 }
164 155
165 void StatusIconWin::InitIconData(NOTIFYICONDATA* icon_data) { 156 void StatusIconWin::InitIconData(NOTIFYICONDATA* icon_data) {
166 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { 157 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
167 memset(icon_data, 0, sizeof(NOTIFYICONDATA)); 158 memset(icon_data, 0, sizeof(NOTIFYICONDATA));
168 icon_data->cbSize = sizeof(NOTIFYICONDATA); 159 icon_data->cbSize = sizeof(NOTIFYICONDATA);
169 } else { 160 } else {
170 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE); 161 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE);
171 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE; 162 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE;
172 } 163 }
173 164
174 icon_data->hWnd = window_; 165 icon_data->hWnd = window_;
175 icon_data->uID = icon_id_; 166 icon_data->uID = icon_id_;
176 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698