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

Side by Side Diff: chrome/browser/ui/views/status_icons/status_tray_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: Created 6 years, 9 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_tray_win.h" 5 #include "chrome/browser/ui/views/status_icons/status_tray_win.h"
6 6
7 #include <commctrl.h> 7 #include <commctrl.h>
8 8
9 #include "base/win/wrapped_window_proc.h" 9 #include "base/win/wrapped_window_proc.h"
10 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" 10 #include "chrome/browser/ui/views/status_icons/status_icon_win.h"
11 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
12 #include "ui/gfx/screen.h" 12 #include "ui/gfx/screen.h"
13 #include "ui/gfx/win/hwnd_util.h" 13 #include "ui/gfx/win/hwnd_util.h"
14 #include "win8/util/win8_util.h" 14 #include "win8/util/win8_util.h"
15 15
16 static const UINT kStatusIconMessage = WM_APP + 1; 16 static const UINT kStatusIconMessage = WM_APP + 1;
17 17
18 namespace { 18 namespace {
19 // |kBaseIconId| is 2 to avoid conflicts with plugins that hard-code id 1. 19 // |kBaseIconId| is 2 to avoid conflicts with plugins that hard-code id 1.
20 const UINT kBaseIconId = 2; 20 const UINT kBaseIconId = 2;
21 21
22 UINT ReservedIconId(StatusTray::StatusIconType type) { 22 UINT ReservedIconId(StatusTray::StatusIconType type) {
23 return kBaseIconId + static_cast<UINT>(type); 23 return kBaseIconId + static_cast<UINT>(type);
24 } 24 }
25 } // namespace 25 } // namespace
26 26
27 bool StatusTrayWin::DisabledForMetroMode() {
28 return win8::IsSingleWindowMetroMode();
29 }
30
27 StatusTrayWin::StatusTrayWin() 31 StatusTrayWin::StatusTrayWin()
28 : next_icon_id_(1), 32 : next_icon_id_(1),
29 atom_(0), 33 atom_(0),
30 instance_(NULL), 34 instance_(NULL),
31 window_(NULL) { 35 window_(NULL) {
32 // Register our window class 36 // Register our window class
33 WNDCLASSEX window_class; 37 WNDCLASSEX window_class;
34 base::win::InitializeWindowClass( 38 base::win::InitializeWindowClass(
35 chrome::kStatusTrayWindowClass, 39 chrome::kStatusTrayWindowClass,
36 &base::win::WrappedWindowProc<StatusTrayWin::WndProcStatic>, 40 &base::win::WrappedWindowProc<StatusTrayWin::WndProcStatic>,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 StatusTray::StatusIconType type, 133 StatusTray::StatusIconType type,
130 const gfx::ImageSkia& image, 134 const gfx::ImageSkia& image,
131 const base::string16& tool_tip) { 135 const base::string16& tool_tip) {
132 UINT next_icon_id; 136 UINT next_icon_id;
133 if (type == StatusTray::OTHER_ICON) 137 if (type == StatusTray::OTHER_ICON)
134 next_icon_id = NextIconId(); 138 next_icon_id = NextIconId();
135 else 139 else
136 next_icon_id = ReservedIconId(type); 140 next_icon_id = ReservedIconId(type);
137 141
138 StatusIcon* icon = NULL; 142 StatusIcon* icon = NULL;
139 if (win8::IsSingleWindowMetroMode()) 143 if (DisabledForMetroMode())
140 icon = new StatusIconMetro(next_icon_id); 144 icon = new StatusIconMetro(next_icon_id);
141 else 145 else
142 icon = new StatusIconWin(next_icon_id, window_, kStatusIconMessage); 146 icon = new StatusIconWin(next_icon_id, window_, kStatusIconMessage);
143 147
144 icon->SetImage(image); 148 icon->SetImage(image);
145 icon->SetToolTip(tool_tip); 149 icon->SetToolTip(tool_tip);
146 return icon; 150 return icon;
147 } 151 }
148 152
149 UINT StatusTrayWin::NextIconId() { 153 UINT StatusTrayWin::NextIconId() {
150 UINT icon_id = next_icon_id_++; 154 UINT icon_id = next_icon_id_++;
151 return kBaseIconId + static_cast<UINT>(NAMED_STATUS_ICON_COUNT) + icon_id; 155 return kBaseIconId + static_cast<UINT>(NAMED_STATUS_ICON_COUNT) + icon_id;
152 } 156 }
153 157
154 StatusTray* StatusTray::Create() { 158 StatusTray* StatusTray::Create() {
155 return new StatusTrayWin(); 159 return new StatusTrayWin();
156 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698