summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:33:43 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:33:43 +0000
commit3e3f0eb47762a85110fb11b850df776b59073f8d (patch)
treeca99e9f3792485dfeb906d06633272243e0e6fb9
parent22015c33fe44a1cc36596e0b6de37a48dc13b131 (diff)
downloadchromium_src-3e3f0eb47762a85110fb11b850df776b59073f8d.zip
chromium_src-3e3f0eb47762a85110fb11b850df776b59073f8d.tar.gz
chromium_src-3e3f0eb47762a85110fb11b850df776b59073f8d.tar.bz2
By user request, focus should go to the location bar when about:blank is the default new tab page.
BUG=9966 TEST=Make "about:blank" your home page. Open a new tab. It should be showing about:blank and the location bar should be focused. Review URL: http://codereview.chromium.org/141028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18924 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_focus_uitest.cc6
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc3
2 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 3681c1b..0d95480 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -630,4 +630,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabInitialFocus) {
browser()->ShowDownloadsTab();
EXPECT_EQ(browser_view->GetTabContentsContainerView(),
focus_manager->GetFocusedView());
+
+ // Open about:blank, focus should be on the location bar.
+ browser()->AddTabWithURL(GURL("about:blank"), GURL(), PageTransition::LINK,
+ true, -1, false, NULL);
+ EXPECT_EQ(browser_view->GetLocationBarView(),
+ focus_manager->GetFocusedView());
}
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index f4a937a..53e074c 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -816,6 +816,9 @@ bool TabContents::FocusLocationBarByDefault() {
DOMUI* dom_ui = GetDOMUIForCurrentState();
if (dom_ui)
return dom_ui->focus_location_bar_by_default();
+ NavigationEntry* entry = controller_.GetActiveEntry();
+ if (entry && entry->url() == GURL("about:blank"))
+ return true;
return false;
}