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/textfield | |
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/textfield')
-rw-r--r-- | views/controls/textfield/native_textfield_win.cc | 13 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index ff20496..d2044a5 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -16,6 +16,7 @@ #include "views/controls/native/native_view_host.h" #include "views/controls/textfield/native_textfield_win.h" #include "views/controls/textfield/textfield.h" +#include "views/focus/focus_manager.h" #include "views/focus/focus_util_win.h" #include "views/views_delegate.h" #include "views/widget/widget.h" @@ -667,6 +668,18 @@ void NativeTextfieldWin::OnPaste() { } } +void NativeTextfieldWin::OnSetFocus(HWND hwnd) { + SetMsgHandled(FALSE); // We still want the default processing of the message. + + views::FocusManager* focus_manager = + views::FocusManager::GetFocusManager(m_hWnd); + if (!focus_manager) { + NOTREACHED(); + return; + } + focus_manager->SetFocusedView(textfield_); +} + void NativeTextfieldWin::OnSysChar(TCHAR ch, UINT repeat_count, UINT flags) { // Nearly all alt-<xxx> combos result in beeping rather than doing something // useful, so we discard most. Exceptions: diff --git a/views/controls/textfield/native_textfield_win.h b/views/controls/textfield/native_textfield_win.h index 194614a..58034c0 100644 --- a/views/controls/textfield/native_textfield_win.h +++ b/views/controls/textfield/native_textfield_win.h @@ -74,6 +74,7 @@ class NativeTextfieldWin MSG_WM_NCPAINT(OnNCPaint) MSG_WM_RBUTTONDOWN(OnNonLButtonDown) MSG_WM_PASTE(OnPaste) + MSG_WM_SETFOCUS(OnSetFocus) MSG_WM_SYSCHAR(OnSysChar) // WM_SYSxxx == WM_xxx with ALT down MSG_WM_SYSKEYDOWN(OnKeyDown) END_MSG_MAP() @@ -122,6 +123,7 @@ class NativeTextfieldWin void OnNCPaint(HRGN region); void OnNonLButtonDown(UINT keys, const CPoint& point); void OnPaste(); + void OnSetFocus(HWND hwnd); void OnSysChar(TCHAR ch, UINT repeat_count, UINT flags); // Helper function for OnChar() and OnKeyDown() that handles keystrokes that |