Commit 68f009f7 authored by jcampan@chromium.org's avatar jcampan@chromium.org

This CL addresses several issues with focus in application mode:

- when started, the focus was not on the page (it was on the location bar, which is not shown)
- ALT-F4 would not work at that point since the location bar was focused but not showing
- since the location bar was focusable, tabbing through would focus it (causing the focus to go to the top window).

BUG=8124,6046,8126
TEST=See bugs.
R=sky
Review URL: http://codereview.chromium.org/28202

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10504 0039d316-1c4b-4281-b951-d872f2087c98
parent 19f7242c
...@@ -321,6 +321,9 @@ void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) { ...@@ -321,6 +321,9 @@ void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) {
Browser* browser = Browser::CreateForApp(app_name, profile); Browser* browser = Browser::CreateForApp(app_name, profile);
browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, true, NULL); browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, true, NULL);
browser->window()->Show(); browser->window()->Show();
// TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
// focus explicitly.
browser->GetSelectedTabContents()->SetInitialFocus();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -359,8 +359,8 @@ class SessionRestoreImpl : public NotificationObserver { ...@@ -359,8 +359,8 @@ class SessionRestoreImpl : public NotificationObserver {
std::min(initial_tab_count + std::max(0, selected_session_index), std::min(initial_tab_count + std::max(0, selected_session_index),
browser->tab_count() - 1), true); browser->tab_count() - 1), true);
browser->window()->Show(); browser->window()->Show();
// Showing the browser focuses the location bar, let the tab decide where // TODO(jcampan): http://crbug.com/8123 we should not need to set the
// it wants the focus to be. // initial focus explicitly.
browser->GetSelectedTabContents()->SetInitialFocus(); browser->GetSelectedTabContents()->SetInitialFocus();
} }
......
...@@ -1350,6 +1350,7 @@ int BrowserView::LayoutToolbar(int top) { ...@@ -1350,6 +1350,7 @@ int BrowserView::LayoutToolbar(int top) {
Personalization::AdjustBrowserView(personalization_, &browser_view_width); Personalization::AdjustBrowserView(personalization_, &browser_view_width);
#endif #endif
bool visible = IsToolbarVisible(); bool visible = IsToolbarVisible();
toolbar_->GetLocationBarView()->SetFocusable(visible);
int y = top - int y = top -
((visible && IsTabStripVisible()) ? kToolbarTabStripVerticalOverlap : 0); ((visible && IsTabStripVisible()) ? kToolbarTabStripVerticalOverlap : 0);
int height = visible ? toolbar_->GetPreferredSize().height() : 0; int height = visible ? toolbar_->GetPreferredSize().height() : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment