diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-12 19:14:54 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-12 19:14:54 +0000 |
commit | 7e38369f764596be0a38c0a1a7339c5ed43b67de (patch) | |
tree | 5d1c9f4bfc0e51f30cab13fbcfce40ea975a3782 /views/controls/native_control.cc | |
parent | 9fc286c694089736ee8e7b740302dc4dd080a6aa (diff) | |
download | chromium_src-7e38369f764596be0a38c0a1a7339c5ed43b67de.zip chromium_src-7e38369f764596be0a38c0a1a7339c5ed43b67de.tar.gz chromium_src-7e38369f764596be0a38c0a1a7339c5ed43b67de.tar.bz2 |
Changing the focus manager to not subclass HWNDs (but for the top-windows).Components that have HWND now need to specifically let the FocusManager know when they get the native focus.This is the reason for the new GotFocus() notification on the RenderWidgetHostViewWin class.BUG=NoneTEST=Run the interactive tests, the unit-tests. Test that the focus is remembered correctly when switching windows, switching tabs. Test that focus traversal in the browser and in the option dialog works as expected.
Review URL: http://codereview.chromium.org/122002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/native_control.cc')
-rw-r--r-- | views/controls/native_control.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index cbb375a..2df961e 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -81,8 +81,6 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer, LRESULT OnCreate(LPCREATESTRUCT create_struct) { control_ = parent_->CreateNativeControl(m_hWnd); - FocusManager::InstallFocusSubclass(control_, parent_); - // We subclass the control hwnd so we get the WM_KEYDOWN messages. WNDPROC original_handler = win_util::SetWindowProc(control_, @@ -367,6 +365,15 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { if (native_control->OnKeyDown(static_cast<int>(w_param))) return 0; + } else if (message == WM_SETFOCUS) { + // Let the focus manager know that the focus changed. + FocusManager* focus_manager = + FocusManager::GetFocusManager(native_control->GetNativeControlHWND()); + if (focus_manager) { + focus_manager->SetFocusedView(native_control); + } else { + NOTREACHED(); + } } else if (message == WM_DESTROY) { win_util::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); |