OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/status_icons/status_tray_win.h" | 5 #include "chrome/browser/views/status_icons/status_tray_win.h" |
6 | 6 |
7 #include "base/win_util.h" | 7 #include "app/win/hwnd_util.h" |
8 #include "chrome/browser/views/status_icons/status_icon_win.h" | 8 #include "chrome/browser/views/status_icons/status_icon_win.h" |
9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
10 | 10 |
11 static const UINT kStatusIconMessage = WM_APP + 1; | 11 static const UINT kStatusIconMessage = WM_APP + 1; |
12 | 12 |
13 StatusTrayWin::StatusTrayWin() | 13 StatusTrayWin::StatusTrayWin() |
14 : next_icon_id_(1) { | 14 : next_icon_id_(1) { |
15 // Register our window class | 15 // Register our window class |
16 HINSTANCE hinst = GetModuleHandle(NULL); | 16 HINSTANCE hinst = GetModuleHandle(NULL); |
17 WNDCLASSEX wc = {0}; | 17 WNDCLASSEX wc = {0}; |
18 wc.cbSize = sizeof(wc); | 18 wc.cbSize = sizeof(wc); |
19 wc.lpfnWndProc = StatusTrayWin::WndProcStatic; | 19 wc.lpfnWndProc = StatusTrayWin::WndProcStatic; |
20 wc.hInstance = hinst; | 20 wc.hInstance = hinst; |
21 wc.lpszClassName = chrome::kStatusTrayWindowClass; | 21 wc.lpszClassName = chrome::kStatusTrayWindowClass; |
22 ATOM clazz = RegisterClassEx(&wc); | 22 ATOM clazz = RegisterClassEx(&wc); |
23 DCHECK(clazz); | 23 DCHECK(clazz); |
24 | 24 |
25 // Create an offscreen window for handling messages for the status icons. | 25 // Create an offscreen window for handling messages for the status icons. |
26 window_ = CreateWindow(chrome::kStatusTrayWindowClass, | 26 window_ = CreateWindow(chrome::kStatusTrayWindowClass, |
27 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); | 27 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); |
28 win_util::SetWindowUserData(window_, this); | 28 app::win::SetWindowUserData(window_, this); |
29 } | 29 } |
30 | 30 |
31 LRESULT CALLBACK StatusTrayWin::WndProcStatic(HWND hwnd, | 31 LRESULT CALLBACK StatusTrayWin::WndProcStatic(HWND hwnd, |
32 UINT message, | 32 UINT message, |
33 WPARAM wparam, | 33 WPARAM wparam, |
34 LPARAM lparam) { | 34 LPARAM lparam) { |
35 StatusTrayWin* msg_wnd = reinterpret_cast<StatusTrayWin*>( | 35 StatusTrayWin* msg_wnd = reinterpret_cast<StatusTrayWin*>( |
36 GetWindowLongPtr(hwnd, GWLP_USERDATA)); | 36 GetWindowLongPtr(hwnd, GWLP_USERDATA)); |
37 return msg_wnd->WndProc(hwnd, message, wparam, lparam); | 37 return msg_wnd->WndProc(hwnd, message, wparam, lparam); |
38 } | 38 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 UnregisterClass(chrome::kStatusTrayWindowClass, GetModuleHandle(NULL)); | 72 UnregisterClass(chrome::kStatusTrayWindowClass, GetModuleHandle(NULL)); |
73 } | 73 } |
74 | 74 |
75 StatusIcon* StatusTrayWin::CreatePlatformStatusIcon() { | 75 StatusIcon* StatusTrayWin::CreatePlatformStatusIcon() { |
76 return new StatusIconWin(next_icon_id_++, window_, kStatusIconMessage); | 76 return new StatusIconWin(next_icon_id_++, window_, kStatusIconMessage); |
77 } | 77 } |
78 | 78 |
79 StatusTray* StatusTray::Create() { | 79 StatusTray* StatusTray::Create() { |
80 return new StatusTrayWin(); | 80 return new StatusTrayWin(); |
81 } | 81 } |
OLD | NEW |