summaryrefslogtreecommitdiffstats
path: root/base/message_pump_win.cc
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 20:38:18 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 20:38:18 +0000
commit7a66b99fbf5cd967ba12e643fc0072fc20514990 (patch)
treed4bec32782951f4c63a4aca99b655222017c6002 /base/message_pump_win.cc
parentdecd4114476cb68ef734dd91cbea6d56c404bee5 (diff)
downloadchromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.zip
chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.tar.gz
chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.tar.bz2
Added base::win::InitializeWindowClass() wrapper to make sure that window classes are properly associated with the modules containing their window procedures.
TEST=win,win_rel Review URL: https://chromiumcodereview.appspot.com/10315012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_win.cc')
-rw-r--r--base/message_pump_win.cc24
1 files changed, 9 insertions, 15 deletions
diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc
index 72657dc..7dc3da3 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);
+ WNDCLASSEX window_class;
+ base::win::InitializeWindowClass(
+ class_name.c_str(),
+ &base::win::WrappedWindowProc<WndProcThunk>,
+ 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
+ &window_class);
+ 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;