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

Unified Diff: remoting/host/host_service_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 and rebased. Created 8 years, 7 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 | « content/shell/shell_win.cc ('k') | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_service_win.cc
diff --git a/remoting/host/host_service_win.cc b/remoting/host/host_service_win.cc
index c96c6e07081d254210a2e04afa50190232367563..77d8cc7bba4d30f5a83bf3cc2edccda1c104e4da 100644
--- a/remoting/host/host_service_win.cc
+++ b/remoting/host/host_service_win.cc
@@ -19,7 +19,6 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/process_util.h"
#include "base/stringize_macros.h"
#include "base/stringprintf.h"
#include "base/threading/thread.h"
@@ -255,26 +254,24 @@ int HostService::RunInConsole() {
}
// Create a window for receiving session change notifications.
- LPCWSTR atom = NULL;
HWND window = NULL;
- WNDPROC window_proc =
- base::win::WrappedWindowProc<SessionChangeNotificationProc>;
- HINSTANCE instance = base::GetModuleFromAddress(window_proc);
-
- WNDCLASSEX wc = {0};
- wc.cbSize = sizeof(wc);
- wc.lpfnWndProc = window_proc;
- wc.hInstance = instance;
- wc.lpszClassName = kSessionNotificationWindowClass;
- atom = reinterpret_cast<LPCWSTR>(RegisterClassExW(&wc));
- if (atom == NULL) {
+ WNDCLASSEX window_class;
+ base::win::InitializeWindowClass(
+ kSessionNotificationWindowClass,
+ &base::win::WrappedWindowProc<SessionChangeNotificationProc>,
+ 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
+ &window_class);
+ HINSTANCE instance = window_class.hInstance;
+ ATOM atom = RegisterClassExW(&window_class);
+ if (atom == 0) {
LOG_GETLASTERROR(ERROR)
<< "Failed to register the window class '"
<< kSessionNotificationWindowClass << "'";
goto cleanup;
}
- window = CreateWindowW(atom, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, instance, 0);
+ window = CreateWindowW(MAKEINTATOM(atom), 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0,
+ instance, 0);
if (window == NULL) {
LOG_GETLASTERROR(ERROR)
<< "Failed to creat the session notificationwindow";
@@ -302,7 +299,7 @@ cleanup:
}
if (atom != 0) {
- UnregisterClass(atom, instance);
+ UnregisterClass(MAKEINTATOM(atom), instance);
}
// Unsubscribe from console events. Ignore the exit code. There is nothing
« no previous file with comments | « content/shell/shell_win.cc ('k') | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698