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

Unified Diff: base/message_pump_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: 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
« no previous file with comments | « no previous file | base/win/wrapped_window_proc.h » ('j') | base/win/wrapped_window_proc.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_win.cc
diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc
index 72657dc51710ed605de7ece4452a9a9d763b6e27..d8611167845f48d02e8b6fefa46bb2c1cbb85c5b 100644
--- a/base/message_pump_win.cc
+++ b/base/message_pump_win.cc
@@ -8,7 +8,6 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
-#include "base/process_util.h"
#include "base/stringprintf.h"
#include "base/win/wrapped_window_proc.h"
@@ -253,18 +252,14 @@ void MessagePumpForUI::DoRunLoop() {
void MessagePumpForUI::InitMessageWnd() {
// Register a unique window class for each instance of UI pump.
string16 class_name = base::StringPrintf(kWndClassFormat, this);
- WNDPROC window_procedure = &base::win::WrappedWindowProc<WndProcThunk>;
-
- // RegisterClassEx uses a handle of the module containing the window procedure
- // to distinguish identically named classes registered in different modules.
- instance_ = GetModuleFromAddress(window_procedure);
-
- WNDCLASSEXW wc = {0};
- wc.cbSize = sizeof(wc);
- wc.lpfnWndProc = window_procedure;
- wc.hInstance = instance_;
- wc.lpszClassName = class_name.c_str();
- atom_ = RegisterClassEx(&wc);
+ WNDCLASSEXW window_class;
+ base::win::InitializeWindowClass(
+ &window_class,
+ class_name.c_str(),
+ &base::win::WrappedWindowProc<WndProcThunk>,
+ 0, 0, 0, NULL, NULL, NULL, NULL, NULL);
+ instance_ = window_class.hInstance;
+ atom_ = RegisterClassEx(&window_class);
if (atom_ == 0) {
DCHECK(atom_);
return;
@@ -272,8 +267,7 @@ void MessagePumpForUI::InitMessageWnd() {
// Create the message-only window.
message_hwnd_ = CreateWindow(
- reinterpret_cast<const char16*>(atom_), 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0,
- instance_, 0);
+ MAKEINTATOM(atom_), 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, instance_, 0);
if (message_hwnd_ == NULL) {
DCHECK(message_hwnd_);
return;
« no previous file with comments | « no previous file | base/win/wrapped_window_proc.h » ('j') | base/win/wrapped_window_proc.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698