From 429fafc44932326118e4067cd88084551ac321f4 Mon Sep 17 00:00:00 2001 From: "xiyuan@chromium.org" Date: Sat, 6 Aug 2011 00:18:01 +0000 Subject: [ChromeOS] Make WebUILoginView play nicer with focus. - RequestFocus in LoadURL so that WebUILoginView is focused after window creation; - Override TabContentsDelegate::TakeFocus and forward the focus back to web contents; This gets rid of the mysterious tab stop; BUG=chromium-os:18466 TEST=Verify fix for chromium-os:18466. Review URL: http://codereview.chromium.org/7506004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95694 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chromeos/login/webui_login_view.cc | 7 +++++++ chrome/browser/chromeos/login/webui_login_view.h | 1 + 2 files changed, 8 insertions(+) diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc index ba055f9..47c0f67 100644 --- a/chrome/browser/chromeos/login/webui_login_view.cc +++ b/chrome/browser/chromeos/login/webui_login_view.cc @@ -93,6 +93,7 @@ void WebUILoginView::UpdateWindowType() { void WebUILoginView::LoadURL(const GURL & url) { webui_login_->LoadURL(url); + webui_login_->RequestFocus(); } WebUI* WebUILoginView::GetWebUI() { @@ -211,4 +212,10 @@ bool WebUILoginView::HandleContextMenu(const ContextMenuParams& params) { #endif } +bool WebUILoginView::TakeFocus(bool reverse) { + // Forward the focus back to web contents. + webui_login_->tab_contents()->FocusThroughTabTraversal(reverse); + return true; +} + } // namespace chromeos diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h index d8a6b4d..3d888c5 100644 --- a/chrome/browser/chromeos/login/webui_login_view.h +++ b/chrome/browser/chromeos/login/webui_login_view.h @@ -99,6 +99,7 @@ class WebUILoginView : public views::View, private: // Overridden from TabContentsDelegate. virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; + virtual bool TakeFocus(bool reverse) OVERRIDE; // Window that contains status area. // TODO(nkostylev): Temporary solution till we have -- cgit v1.1