summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc76
-rw-r--r--content/browser/system_message_window_win.cc21
-rw-r--r--content/browser/system_message_window_win.h1
3 files changed, 47 insertions, 51 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index f40a284..c4f776a 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -569,31 +569,33 @@ void RenderWidgetHostViewWin::MovePluginWindows(
}
HWND RenderWidgetHostViewWin::ReparentWindow(HWND window) {
- static ATOM window_class = 0;
- if (!window_class) {
- WNDCLASSEX wcex;
- wcex.cbSize = sizeof(WNDCLASSEX);
- wcex.style = CS_DBLCLKS;
- wcex.lpfnWndProc = base::win::WrappedWindowProc<PluginWrapperWindowProc>;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = GetModuleHandle(NULL);
- wcex.hIcon = 0;
- wcex.hCursor = 0;
- wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
- wcex.lpszMenuName = 0;
- wcex.lpszClassName = webkit::npapi::kWrapperNativeWindowClassName;
- wcex.hIconSm = 0;
- window_class = RegisterClassEx(&wcex);
- }
- DCHECK(window_class);
+ static ATOM atom = 0;
+ static HMODULE instance = NULL;
+ if (!atom) {
+ WNDCLASSEX window_class;
+ base::win::InitializeWindowClass(
+ webkit::npapi::kWrapperNativeWindowClassName,
+ &base::win::WrappedWindowProc<PluginWrapperWindowProc>,
+ CS_DBLCLKS,
+ 0,
+ 0,
+ NULL,
+ reinterpret_cast<HBRUSH>(COLOR_WINDOW+1),
+ NULL,
+ NULL,
+ NULL,
+ &window_class);
+ instance = window_class.hInstance;
+ atom = RegisterClassEx(&window_class);
+ }
+ DCHECK(atom);
HWND orig_parent = ::GetParent(window);
HWND parent = CreateWindowEx(
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
- MAKEINTATOM(window_class), 0,
+ MAKEINTATOM(atom), 0,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- 0, 0, 0, 0, orig_parent, 0, GetModuleHandle(NULL), 0);
+ 0, 0, 0, 0, orig_parent, 0, instance, 0);
ui::CheckWindowCreated(parent);
// If UIPI is enabled we need to add message filters for parents with
// children that cross process boundaries.
@@ -2124,24 +2126,18 @@ gfx::GLSurfaceHandle RenderWidgetHostViewWin::GetCompositingSurface() {
if (compositor_host_window_)
return gfx::GLSurfaceHandle(compositor_host_window_, true);
- static ATOM window_class = 0;
- if (!window_class) {
- WNDCLASSEX wcex;
- wcex.cbSize = sizeof(WNDCLASSEX);
- wcex.style = 0;
- wcex.lpfnWndProc =
- base::win::WrappedWindowProc<CompositorHostWindowProc>;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = GetModuleHandle(NULL);
- wcex.hIcon = 0;
- wcex.hCursor = 0;
- wcex.hbrBackground = NULL;
- wcex.lpszMenuName = 0;
- wcex.lpszClassName = L"CompositorHostWindowClass";
- wcex.hIconSm = 0;
- window_class = RegisterClassEx(&wcex);
- DCHECK(window_class);
+ static ATOM atom = 0;
+ static HMODULE instance = NULL;
+ if (!atom) {
+ WNDCLASSEX window_class;
+ base::win::InitializeWindowClass(
+ L"CompositorHostWindowClass",
+ &base::win::WrappedWindowProc<CompositorHostWindowProc>,
+ 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
+ &window_class);
+ instance = window_class.hInstance;
+ atom = RegisterClassEx(&window_class);
+ DCHECK(atom);
}
RECT currentRect;
@@ -2156,9 +2152,9 @@ gfx::GLSurfaceHandle RenderWidgetHostViewWin::GetCompositingSurface() {
compositor_host_window_ = CreateWindowEx(
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
- MAKEINTATOM(window_class), 0,
+ MAKEINTATOM(atom), 0,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED,
- 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0);
+ 0, 0, width, height, m_hWnd, 0, instance, 0);
ui::CheckWindowCreated(compositor_host_window_);
ui::SetWindowUserData(compositor_host_window_, this);
diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc
index 347e717d..1f6fcb0 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);
+ WNDCLASSEX 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_);
}
}
diff --git a/content/browser/system_message_window_win.h b/content/browser/system_message_window_win.h
index 36c800c..fd94985 100644
--- a/content/browser/system_message_window_win.h
+++ b/content/browser/system_message_window_win.h
@@ -36,6 +36,7 @@ class CONTENT_EXPORT SystemMessageWindowWin {
return ::DefWindowProc(hwnd, message, wparam, lparam);
}
+ HMODULE instance_;
HWND window_;
DISALLOW_COPY_AND_ASSIGN(SystemMessageWindowWin);