diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 00:21:28 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 00:21:28 +0000 |
commit | 401513c474b3520fe784c03e068a15fc6655d6e1 (patch) | |
tree | 9d5368feb8f3a668ec4523e90bc9694bcfc3a9d3 /chrome/browser/views | |
parent | a8e9b16e3e3f944d0eaf7f91e5cc96a7b2c914d3 (diff) | |
download | chromium_src-401513c474b3520fe784c03e068a15fc6655d6e1.zip chromium_src-401513c474b3520fe784c03e068a15fc6655d6e1.tar.gz chromium_src-401513c474b3520fe784c03e068a15fc6655d6e1.tar.bz2 |
Moving the storing/restoring of the focus from TabContents to WebContentsView. This makes TabContents less dependent on views.
This requires few contortions with DOMUIs (NTP, history and downloads tab) as they still need to set the initial focus specifically.
BUG=None
TEST=Run the interactive tests.
Review URL: http://codereview.chromium.org/39269
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 5836e55..e8c2a54 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -500,8 +500,8 @@ void BrowserView::Show() { // If we do find there are cases where we need to restore the focus on show, // that should be added and this should be removed. TabContents* selected_tab_contents = GetSelectedTabContents(); - if (selected_tab_contents) - selected_tab_contents->RestoreFocus(); + if (selected_tab_contents && selected_tab_contents->AsWebContents()) + selected_tab_contents->AsWebContents()->view()->RestoreFocus(); frame_->Show(); } @@ -923,8 +923,9 @@ void BrowserView::TabSelectedAt(TabContents* old_contents, // We do not store the focus when closing the tab to work-around bug 4633. // Some reports seem to show that the focus manager and/or focused view can // be garbage at that point, it is not clear why. - if (old_contents && !old_contents->is_being_destroyed()) - old_contents->StoreFocus(); + if (old_contents && !old_contents->is_being_destroyed() && + old_contents->AsWebContents()) + old_contents->AsWebContents()->view()->StoreFocus(); // Update various elements that are interested in knowing the current // TabContents. @@ -936,8 +937,9 @@ void BrowserView::TabSelectedAt(TabContents* old_contents, // etc not result in sad tab. new_contents->DidBecomeSelected(); if (BrowserList::GetLastActive() == browser_ && - !browser_->tabstrip_model()->closing_all()) { - new_contents->RestoreFocus(); + !browser_->tabstrip_model()->closing_all() && + new_contents->AsWebContents()) { + new_contents->AsWebContents()->view()->RestoreFocus(); } // Update all the UI bits. |