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

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

Issue 110693004: Moves the notification icon out of the status area overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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/metro.h" 8 #include "base/win/metro.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "chrome/browser/ui/views/status_icons/status_tray_win.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "ui/gfx/icon_util.h" 12 #include "ui/gfx/icon_util.h"
12 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
13 #include "ui/views/controls/menu/menu_item_view.h" 14 #include "ui/views/controls/menu/menu_item_view.h"
14 #include "ui/views/controls/menu/menu_runner.h" 15 #include "ui/views/controls/menu/menu_runner.h"
15 #include "win8/util/win8_util.h" 16 #include "win8/util/win8_util.h"
16 17
17 //////////////////////////////////////////////////////////////////////////////// 18 ////////////////////////////////////////////////////////////////////////////////
18 // StatusIconWin, public: 19 // StatusIconWin, public:
19 20
20 StatusIconWin::StatusIconWin(UINT id, HWND window, UINT message) 21 StatusIconWin::StatusIconWin(StatusTrayWin* tray,
21 : icon_id_(id), 22 UINT id,
23 HWND window,
24 UINT message)
25 : tray_(tray),
26 icon_id_(id),
22 window_(window), 27 window_(window),
23 message_id_(message), 28 message_id_(message),
24 menu_model_(NULL) { 29 menu_model_(NULL) {
25 NOTIFYICONDATA icon_data; 30 NOTIFYICONDATA icon_data;
26 InitIconData(&icon_data); 31 InitIconData(&icon_data);
27 icon_data.uFlags = NIF_MESSAGE; 32 icon_data.uFlags = NIF_MESSAGE;
28 icon_data.uCallbackMessage = message_id_; 33 icon_data.uCallbackMessage = message_id_;
29 BOOL result = Shell_NotifyIcon(NIM_ADD, &icon_data); 34 BOOL result = Shell_NotifyIcon(NIM_ADD, &icon_data);
30 // This can happen if the explorer process isn't running when we try to 35 // This can happen if the explorer process isn't running when we try to
31 // create the icon for some reason (for example, at startup). 36 // create the icon for some reason (for example, at startup).
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 icon_data.uFlags |= NIF_ICON; 142 icon_data.uFlags |= NIF_ICON;
138 icon_data.dwInfoFlags = NIIF_USER; 143 icon_data.dwInfoFlags = NIIF_USER;
139 } 144 }
140 } 145 }
141 146
142 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); 147 BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
143 if (!result) 148 if (!result)
144 LOG(WARNING) << "Unable to create status tray balloon."; 149 LOG(WARNING) << "Unable to create status tray balloon.";
145 } 150 }
146 151
152 void StatusIconWin::ForceVisible() {
153 tray_->UpdateIconVisibilityInBackground(this);
154 }
155
147 //////////////////////////////////////////////////////////////////////////////// 156 ////////////////////////////////////////////////////////////////////////////////
148 // StatusIconWin, private: 157 // StatusIconWin, private:
149 158
150 void StatusIconWin::UpdatePlatformContextMenu(StatusIconMenuModel* menu) { 159 void StatusIconWin::UpdatePlatformContextMenu(StatusIconMenuModel* menu) {
151 // |menu_model_| is about to be destroyed. Destroy the menu (which closes it) 160 // |menu_model_| is about to be destroyed. Destroy the menu (which closes it)
152 // so that it doesn't attempt to continue using |menu_model_|. 161 // so that it doesn't attempt to continue using |menu_model_|.
153 menu_runner_.reset(); 162 menu_runner_.reset();
154 DCHECK(menu); 163 DCHECK(menu);
155 menu_model_ = menu; 164 menu_model_ = menu;
156 } 165 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (metro_module) { 212 if (metro_module) {
204 base::win::MetroNotification notification = 213 base::win::MetroNotification notification =
205 reinterpret_cast<base::win::MetroNotification>( 214 reinterpret_cast<base::win::MetroNotification>(
206 ::GetProcAddress(metro_module, "DisplayNotification")); 215 ::GetProcAddress(metro_module, "DisplayNotification"));
207 DCHECK(notification); 216 DCHECK(notification);
208 notification("", "", title.c_str(), contents.c_str(), L"", 217 notification("", "", title.c_str(), contents.c_str(), L"",
209 base::IntToString(id_).c_str(), NULL, NULL); 218 base::IntToString(id_).c_str(), NULL, NULL);
210 } 219 }
211 } 220 }
212 221
222 void StatusIconMetro::ForceVisible() {}
223
213 void StatusIconMetro::UpdatePlatformContextMenu(StatusIconMenuModel* menu) { 224 void StatusIconMetro::UpdatePlatformContextMenu(StatusIconMenuModel* menu) {
214 DVLOG(1) << __FUNCTION__ 225 DVLOG(1) << __FUNCTION__
215 << " This functionality is not supported in Windows 8 metro"; 226 << " This functionality is not supported in Windows 8 metro";
216 } 227 }
217 228
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698