summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-25 23:35:35 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-25 23:35:35 +0000
commit13f351535a767ab35ea91b74eb6909612786de1a (patch)
tree455bf9599791d31f08e233a80d22633bbd1eaba4 /chrome/browser
parentf0a644290dfd2c869765737850ab463cbf18c12d (diff)
downloadchromium_src-13f351535a767ab35ea91b74eb6909612786de1a.zip
chromium_src-13f351535a767ab35ea91b74eb6909612786de1a.tar.gz
chromium_src-13f351535a767ab35ea91b74eb6909612786de1a.tar.bz2
When restoring a session, the browser is shown after a tab is selected causing the focus to be on the location bar (not tab contents for web pages).
This CL ensures the tab decides where the focus should be after the browser is shown. BUG=6000 TEST=See bug R=sky Review URL: http://codereview.chromium.org/28152 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sessions/session_restore.cc3
-rw-r--r--chrome/browser/tab_contents/tab_contents.h12
2 files changed, 9 insertions, 6 deletions
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index ced5e90..bff9a74 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -359,6 +359,9 @@ class SessionRestoreImpl : public NotificationObserver {
std::min(initial_tab_count + std::max(0, selected_session_index),
browser->tab_count() - 1), true);
browser->window()->Show();
+ // Showing the browser focuses the location bar, let the tab decide where
+ // it wants the focus to be.
+ browser->GetSelectedTabContents()->SetInitialFocus();
}
void AppendURLsToBrowser(Browser* browser, const std::vector<GURL>& urls) {
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 13f8f34..bfd4310 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -446,6 +446,12 @@ class TabContents : public PageNavigator,
// Called when a ConstrainedWindow we own is moved or resized.
void DidMoveOrResize(ConstrainedWindow* window);
+ // Sets focus to the tab contents window, but doesn't actually set focus to
+ // a particular element in it (see also SetInitialFocus(bool) which does
+ // that in different circumstances).
+ // FIXME(brettw) having two SetInitialFocus that do different things is silly.
+ virtual void SetInitialFocus();
+
protected:
// NotificationObserver implementation:
virtual void Observe(NotificationType type,
@@ -470,12 +476,6 @@ class TabContents : public PageNavigator,
// Protected so that others don't try to delete this directly.
virtual ~TabContents();
- // Sets focus to the tab contents window, but doesn't actuall set focus to
- // a particular element in it (see also SetInitialFocus(bool) which does
- // that in different circumstances).
- // FIXME(brettw) having two SetInitialFocus that do different things is silly.
- virtual void SetInitialFocus();
-
// Changes the IsLoading state and notifies delegate as needed
// |details| is used to provide details on the load that just finished
// (but can be null if not applicable). Can be overridden.