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

Unified Diff: ui/base/win/singleton_hwnd.cc

Issue 9965082: Change SingletonHwnd to be based on WindowImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « ui/base/win/singleton_hwnd.h ('k') | ui/base/win/window_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/singleton_hwnd.cc
===================================================================
--- ui/base/win/singleton_hwnd.cc (revision 130121)
+++ ui/base/win/singleton_hwnd.cc (working copy)
@@ -5,40 +5,7 @@
#include "ui/base/win/singleton_hwnd.h"
#include "base/memory/singleton.h"
-#include "base/process_util.h"
-#include "base/win/wrapped_window_proc.h"
-#include "ui/base/win/hwnd_util.h"
-namespace {
-
-// Windows class name to use for the listener window.
-const wchar_t kWindowClassName[] = L"Chrome_SingletonHwnd";
-
-// Windows callback for listening for WM_* messages.
-LRESULT CALLBACK ListenerWindowProc(HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam) {
- ui::SingletonHwnd::GetInstance()->OnWndProc(hwnd, message, wparam, lparam);
- return ::DefWindowProc(hwnd, message, wparam, lparam);
-}
-
-// Creates a listener window to receive WM_* messages.
-HWND CreateListenerWindow() {
- WNDCLASSEX wc = {0};
- wc.cbSize = sizeof(wc);
- wc.lpfnWndProc = base::win::WrappedWindowProc<ListenerWindowProc>;
- wc.hInstance = base::GetModuleFromAddress(&ListenerWindowProc);
- wc.lpszClassName = kWindowClassName;
- ATOM window_class = ::RegisterClassEx(&wc);
- DCHECK(window_class);
-
- return ::CreateWindow(MAKEINTATOM(window_class), 0, 0, 0, 0, 0, 0, 0, 0,
- wc.hInstance, 0);
-}
-
-} // namespace
-
namespace ui {
// static
@@ -47,10 +14,8 @@
}
void SingletonHwnd::AddObserver(Observer* observer) {
- if (!listener_window_) {
- listener_window_ = CreateListenerWindow();
- ui::CheckWindowCreated(listener_window_);
- }
+ if (!hwnd())
+ WindowImpl::Init(NULL, gfx::Rect());
observer_list_.AddObserver(observer);
}
@@ -58,24 +23,22 @@
observer_list_.RemoveObserver(observer);
}
-void SingletonHwnd::OnWndProc(HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam) {
+BOOL SingletonHwnd::ProcessWindowMessage(HWND window,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam,
+ LRESULT& result,
+ DWORD msg_map_id) {
FOR_EACH_OBSERVER(Observer,
observer_list_,
- OnWndProc(hwnd, message, wparam, lparam));
+ OnWndProc(window, message, wparam, lparam));
+ return false;
}
-SingletonHwnd::SingletonHwnd()
- : listener_window_(NULL) {
+SingletonHwnd::SingletonHwnd() {
}
SingletonHwnd::~SingletonHwnd() {
- if (listener_window_) {
- ::DestroyWindow(listener_window_);
- ::UnregisterClass(kWindowClassName, GetModuleHandle(NULL));
- }
}
} // namespace ui
« no previous file with comments | « ui/base/win/singleton_hwnd.h ('k') | ui/base/win/window_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698