diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 22:58:02 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 22:58:02 +0000 |
commit | 5076008b85807c1059f0451abd406ebc747ffe6c (patch) | |
tree | bbf918a2febf48cba0110f0e6aff11e69e774142 /chrome/browser/ui/login | |
parent | eb93b619bebd38510f21d3f04d8f2641bf71af35 (diff) | |
download | chromium_src-5076008b85807c1059f0451abd406ebc747ffe6c.zip chromium_src-5076008b85807c1059f0451abd406ebc747ffe6c.tar.gz chromium_src-5076008b85807c1059f0451abd406ebc747ffe6c.tar.bz2 |
Focus on collected cookie contrained window when a TabContents gets focus.
- On Linux, use "hierarchy-changed" to set initial focus as other constrained
dialogs do;
- On ChromeOS, set initial focus as the following:
FocusManager::RestoreFocusedView (after info bubble dismiss) ->
... ->
NativeTabContentsContainerGtk::Focus ->
TabContentsViewGtk::Focus ->
ConstrainedWindowGtk::FocusConstrainedWindow ->
ConstrainedWindowGtkDelegate::Focus (overridden by CollectedCookiesGtk)
BUG=chromium:72592
TEST=Verify fix for chromium:72592.
Review URL: http://codereview.chromium.org/6475013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/login')
-rw-r--r-- | chrome/browser/ui/login/login_prompt_gtk.cc | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/chrome/browser/ui/login/login_prompt_gtk.cc b/chrome/browser/ui/login/login_prompt_gtk.cc index e6487a5..990ab1f 100644 --- a/chrome/browser/ui/login/login_prompt_gtk.cc +++ b/chrome/browser/ui/login/login_prompt_gtk.cc @@ -121,6 +121,10 @@ class LoginHandlerGtk : public LoginHandler, return root_.get(); } + virtual GtkWidget* GetFocusWidget() { + return username_entry_; + } + virtual void DeleteDelegate() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -172,23 +176,6 @@ void LoginHandlerGtk::OnPromptHierarchyChanged(GtkWidget* sender, // button the default action and mess with the focus. GTK_WIDGET_SET_FLAGS(ok_, GTK_CAN_DEFAULT); gtk_widget_grab_default(ok_); - - TabContents* contents = GetTabContentsForLogin(); - - // The user may have focused another tab. In this case do not grab focus - // until this tab is refocused. - if ((!contents->delegate() || - contents->delegate()->ShouldFocusConstrainedWindow()) && - gtk_util::IsWidgetAncestryVisible(username_entry_)) { - gtk_widget_grab_focus(username_entry_); - } else { - // TODO(estade): this define should not need to be here because this class - // should not be used on linux/views. -#if defined(TOOLKIT_GTK) - static_cast<TabContentsViewGtk*>(contents->view())-> - SetFocusedWidget(username_entry_); -#endif - } } // static |