OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/win/wrapped_window_proc.h" |
7 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" | 8 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" |
8 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
9 #include "ui/base/win/hwnd_util.h" | 10 #include "ui/base/win/hwnd_util.h" |
10 | 11 |
11 static const UINT kStatusIconMessage = WM_APP + 1; | 12 static const UINT kStatusIconMessage = WM_APP + 1; |
12 | 13 |
13 StatusTrayWin::StatusTrayWin() | 14 StatusTrayWin::StatusTrayWin() |
14 : next_icon_id_(1) { | 15 : next_icon_id_(1) { |
15 // Register our window class | 16 // Register our window class |
16 HINSTANCE hinst = GetModuleHandle(NULL); | 17 HINSTANCE hinst = GetModuleHandle(NULL); |
17 WNDCLASSEX wc = {0}; | 18 WNDCLASSEX wc = {0}; |
18 wc.cbSize = sizeof(wc); | 19 wc.cbSize = sizeof(wc); |
19 wc.lpfnWndProc = StatusTrayWin::WndProcStatic; | 20 wc.lpfnWndProc = base::win::WrappedWindowProc<StatusTrayWin::WndProcStatic>; |
20 wc.hInstance = hinst; | 21 wc.hInstance = hinst; |
21 wc.lpszClassName = chrome::kStatusTrayWindowClass; | 22 wc.lpszClassName = chrome::kStatusTrayWindowClass; |
22 ATOM clazz = RegisterClassEx(&wc); | 23 ATOM clazz = RegisterClassEx(&wc); |
23 DCHECK(clazz); | 24 DCHECK(clazz); |
24 | 25 |
25 // If the taskbar is re-created after we start up, we have to rebuild all of | 26 // If the taskbar is re-created after we start up, we have to rebuild all of |
26 // our icons. | 27 // our icons. |
27 taskbar_created_message_ = RegisterWindowMessage(TEXT("TaskbarCreated")); | 28 taskbar_created_message_ = RegisterWindowMessage(TEXT("TaskbarCreated")); |
28 | 29 |
29 // Create an offscreen window for handling messages for the status icons. We | 30 // Create an offscreen window for handling messages for the status icons. We |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 UnregisterClass(chrome::kStatusTrayWindowClass, GetModuleHandle(NULL)); | 90 UnregisterClass(chrome::kStatusTrayWindowClass, GetModuleHandle(NULL)); |
90 } | 91 } |
91 | 92 |
92 StatusIcon* StatusTrayWin::CreatePlatformStatusIcon() { | 93 StatusIcon* StatusTrayWin::CreatePlatformStatusIcon() { |
93 return new StatusIconWin(next_icon_id_++, window_, kStatusIconMessage); | 94 return new StatusIconWin(next_icon_id_++, window_, kStatusIconMessage); |
94 } | 95 } |
95 | 96 |
96 StatusTray* StatusTray::Create() { | 97 StatusTray* StatusTray::Create() { |
97 return new StatusTrayWin(); | 98 return new StatusTrayWin(); |
98 } | 99 } |
OLD | NEW |