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/views | |
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/views')
3 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc index 462f5b8..04aee79 100644 --- a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc +++ b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc @@ -38,6 +38,9 @@ class ConstrainedHtmlDelegateGtk : public views::WidgetGtk, virtual GtkWidget* GetWidgetRoot() { return GetNativeView(); } + virtual GtkWidget* GetFocusWidget() { + return html_tab_contents_.GetContentNativeView(); + } virtual void DeleteDelegate() { html_delegate_->OnDialogClosed(""); tab_container_->ChangeTabContents(NULL); diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc index 2013a65..f9bffef 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc @@ -99,17 +99,8 @@ bool NativeTabContentsContainerGtk::IsFocusable() const { } void NativeTabContentsContainerGtk::Focus() { - if (container_->tab_contents()) { - // Set the native focus on the actual content of the tab, that is the - // interstitial if one is showing. - if (container_->tab_contents()->interstitial_page()) { - container_->tab_contents()->interstitial_page()->Focus(); - return; - } - GtkWidget* widget = container_->tab_contents()->GetContentNativeView(); - if (widget) - gtk_widget_grab_focus(widget); - } + if (container_->tab_contents()) + container_->tab_contents()->Focus(); } void NativeTabContentsContainerGtk::RequestFocus() { diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc index f9f5979..bc780b7 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc @@ -267,6 +267,11 @@ void TabContentsViewGtk::Focus() { return; } + if (constrained_windows_.size()) { + constrained_windows_.back()->FocusConstrainedWindow(); + return; + } + RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); gtk_widget_grab_focus(rwhv ? rwhv->GetNativeView() : GetNativeView()); } |