| Index: chrome/browser/ui/views/status_icons/status_tray_win.cc
|
| diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc
|
| index e078dcd3e9bf01981bb68a9a8f3104e72bec628f..46a32561f7625ac1a424e8affeaa77a86b48cc82 100644
|
| --- a/chrome/browser/ui/views/status_icons/status_tray_win.cc
|
| +++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc
|
| @@ -13,16 +13,20 @@
|
| static const UINT kStatusIconMessage = WM_APP + 1;
|
|
|
| StatusTrayWin::StatusTrayWin()
|
| - : next_icon_id_(1) {
|
| + : next_icon_id_(1),
|
| + atom_(0),
|
| + instance_(NULL),
|
| + window_(NULL) {
|
| // Register our window class
|
| - HINSTANCE hinst = GetModuleHandle(NULL);
|
| - WNDCLASSEX wc = {0};
|
| - wc.cbSize = sizeof(wc);
|
| - wc.lpfnWndProc = base::win::WrappedWindowProc<StatusTrayWin::WndProcStatic>;
|
| - wc.hInstance = hinst;
|
| - wc.lpszClassName = chrome::kStatusTrayWindowClass;
|
| - ATOM clazz = RegisterClassEx(&wc);
|
| - DCHECK(clazz);
|
| + WNDCLASSEX window_class;
|
| + base::win::InitializeWindowClass(
|
| + chrome::kStatusTrayWindowClass,
|
| + &base::win::WrappedWindowProc<StatusTrayWin::WndProcStatic>,
|
| + 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
|
| + &window_class);
|
| + instance_ = window_class.hInstance;
|
| + atom_ = RegisterClassEx(&window_class);
|
| + CHECK(atom_);
|
|
|
| // If the taskbar is re-created after we start up, we have to rebuild all of
|
| // our icons.
|
| @@ -32,8 +36,8 @@ StatusTrayWin::StatusTrayWin()
|
| // create a hidden WS_POPUP window instead of an HWND_MESSAGE window, because
|
| // only top-level windows such as popups can receive broadcast messages like
|
| // "TaskbarCreated".
|
| - window_ = CreateWindow(chrome::kStatusTrayWindowClass,
|
| - 0, WS_POPUP, 0, 0, 0, 0, 0, 0, hinst, 0);
|
| + window_ = CreateWindow(MAKEINTATOM(atom_),
|
| + 0, WS_POPUP, 0, 0, 0, 0, 0, 0, instance_, 0);
|
| ui::CheckWindowCreated(window_);
|
| ui::SetWindowUserData(window_, this);
|
| }
|
| @@ -88,7 +92,9 @@ LRESULT CALLBACK StatusTrayWin::WndProc(HWND hwnd,
|
| StatusTrayWin::~StatusTrayWin() {
|
| if (window_)
|
| DestroyWindow(window_);
|
| - UnregisterClass(chrome::kStatusTrayWindowClass, GetModuleHandle(NULL));
|
| +
|
| + if (atom_)
|
| + UnregisterClass(MAKEINTATOM(atom_), instance_);
|
| }
|
|
|
| StatusIcon* StatusTrayWin::CreatePlatformStatusIcon() {
|
|
|