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

Unified Diff: content/browser/system_message_window_win.cc

Issue 10315012: Added base::win::InitializeWindowClass() wrapper to make sure that window classes are properly asso… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/system_message_window_win.cc
diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc
index 347e717d27f5e84e408ef977f8ecec6adaa2c1ac..7fb2307aa0a2db866fd53ffc452bb6e0f8870d6d 100644
--- a/content/browser/system_message_window_win.cc
+++ b/content/browser/system_message_window_win.cc
@@ -15,26 +15,25 @@ static const wchar_t* const WindowClassName = L"Chrome_SystemMessageWindow";
SystemMessageWindowWin::SystemMessageWindowWin() {
- HINSTANCE hinst = GetModuleHandle(NULL);
-
- WNDCLASSEX wc = {0};
- wc.cbSize = sizeof(wc);
- wc.lpfnWndProc =
- base::win::WrappedWindowProc<&SystemMessageWindowWin::WndProcThunk>;
- wc.hInstance = hinst;
- wc.lpszClassName = WindowClassName;
- ATOM clazz = RegisterClassEx(&wc);
+ WNDCLASSEXW window_class;
+ base::win::InitializeWindowClass(
+ WindowClassName,
+ &base::win::WrappedWindowProc<SystemMessageWindowWin::WndProcThunk>,
+ 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
+ &window_class);
+ instance_ = window_class.hInstance;
+ ATOM clazz = RegisterClassEx(&window_class);
DCHECK(clazz);
window_ = CreateWindow(WindowClassName,
- 0, 0, 0, 0, 0, 0, 0, 0, hinst, 0);
+ 0, 0, 0, 0, 0, 0, 0, 0, instance_, 0);
SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
}
SystemMessageWindowWin::~SystemMessageWindowWin() {
if (window_) {
DestroyWindow(window_);
- UnregisterClass(WindowClassName, GetModuleHandle(NULL));
+ UnregisterClass(WindowClassName, instance_);
}
}

Powered by Google App Engine
This is Rietveld 408576698