From a109d02492863aeb537dea09bfb445eb6f5d94c5 Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Fri, 19 Jun 2009 22:57:54 +0000 Subject: Removed the last Windows specific part out of the focus manager. HWNDs are not subclassed anymore.The FocusManager is now created and owned by top-level WidgetWins.BUG=NoneTEST=Run the unit tests, UI tests, interactive UI tests. Fully test the focus behavior in the browser: activate/deactivate the browser windows, make sure focus is remembered. Switch tabs, make sure focus is remembered for each tab. make sure accelerators work as expected. Test focus traversal in a web page, in the option dialog. Review URL: http://codereview.chromium.org/125148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18872 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/menu/chrome_menu.cc | 2 +- views/controls/native_control.cc | 3 +-- views/controls/native_control_win.cc | 3 +-- views/controls/tabbed_pane.cc | 2 +- views/controls/textfield/native_textfield_win.cc | 3 +-- views/controls/tree/tree_view.cc | 4 +--- 6 files changed, 6 insertions(+), 11 deletions(-) (limited to 'views/controls') diff --git a/views/controls/menu/chrome_menu.cc b/views/controls/menu/chrome_menu.cc index b05552f..f6e3950 100644 --- a/views/controls/menu/chrome_menu.cc +++ b/views/controls/menu/chrome_menu.cc @@ -685,7 +685,7 @@ class MenuHost : public WidgetWin { const gfx::Rect& bounds, View* contents_view, bool do_capture) { - WidgetWin::Init(parent, bounds, true); + WidgetWin::Init(parent, bounds); SetContentsView(contents_view); // We don't want to take focus away from the hosting window. ShowWindow(SW_SHOWNA); diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index 2df961e..5fd8349 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -367,8 +367,7 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, return 0; } else if (message == WM_SETFOCUS) { // Let the focus manager know that the focus changed. - FocusManager* focus_manager = - FocusManager::GetFocusManager(native_control->GetNativeControlHWND()); + FocusManager* focus_manager = native_control->GetFocusManager(); if (focus_manager) { focus_manager->SetFocusedView(native_control); } else { diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index b6111fd..32c7261 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -196,8 +196,7 @@ LRESULT NativeControlWin::NativeControlWndProc(HWND window, return 0; } else if (message == WM_SETFOCUS) { // Let the focus manager know that the focus changed. - FocusManager* focus_manager = - FocusManager::GetFocusManager(native_control->native_view()); + FocusManager* focus_manager = native_control->GetFocusManager(); if (focus_manager) { focus_manager->SetFocusedView(native_control->focus_view()); } else { diff --git a/views/controls/tabbed_pane.cc b/views/controls/tabbed_pane.cc index a162131..b7c41bc 100644 --- a/views/controls/tabbed_pane.cc +++ b/views/controls/tabbed_pane.cc @@ -172,7 +172,7 @@ HWND TabbedPane::CreateNativeControl(HWND parent_container) { // Create the view container which is a child of the TabControl. content_window_ = new WidgetWin(); - content_window_->Init(tab_control_, gfx::Rect(), false); + content_window_->Init(tab_control_, gfx::Rect()); // Explicitly setting the WS_EX_LAYOUTRTL property for the HWND (see above // for a thorough explanation regarding why we waited until |content_window_| diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 1ccf651..cda6629 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -681,8 +681,7 @@ 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); + views::FocusManager* focus_manager = textfield_->GetFocusManager(); if (!focus_manager) { NOTREACHED(); return; diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 95a7210..5a2fb42 100755 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -471,13 +471,11 @@ bool TreeView::OnKeyDown(int virtual_key_code) { } else if (virtual_key_code == VK_RETURN && !process_enter_) { Widget* widget = GetWidget(); DCHECK(widget); - FocusManager* fm = FocusManager::GetFocusManager(widget->GetNativeView()); - DCHECK(fm); Accelerator accelerator(Accelerator(static_cast(virtual_key_code), win_util::IsShiftPressed(), win_util::IsCtrlPressed(), win_util::IsAltPressed())); - fm->ProcessAccelerator(accelerator); + GetFocusManager()->ProcessAccelerator(accelerator); return true; } return false; -- cgit v1.1