diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 19:09:38 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 19:09:38 +0000 |
commit | dfe9d1d2de7fd8d244599b79a22898cce8df7c81 (patch) | |
tree | bbc7eadc945e6b217b922f875092fd2ee7a89cba /chrome/browser/views | |
parent | a9da4c46a446de3912465fb58339f6b16725dc53 (diff) | |
download | chromium_src-dfe9d1d2de7fd8d244599b79a22898cce8df7c81.zip chromium_src-dfe9d1d2de7fd8d244599b79a22898cce8df7c81.tar.gz chromium_src-dfe9d1d2de7fd8d244599b79a22898cce8df7c81.tar.bz2 |
Focus fix for compact navigation bar.
* Make focusable so that focus can be moved to compact navigation bar by tab.
* Ctrl-L should focus the compact navigation bar (and select all texts)
BUG=51 (chrome-os)
TEST=switch to compact navigation bar mode, hit tab or ctrl-L to move focus to compact navigation bar.
Review URL: http://codereview.chromium.org/384079
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/frame/browser_extender.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 7 | ||||
-rw-r--r-- | chrome/browser/views/frame/standard_extender.cc | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/views/frame/browser_extender.h b/chrome/browser/views/frame/browser_extender.h index a40dad7..b33d173 100644 --- a/chrome/browser/views/frame/browser_extender.h +++ b/chrome/browser/views/frame/browser_extender.h @@ -56,6 +56,10 @@ class BrowserExtender { // to use the regular logic to decide. virtual bool ShouldForceHideToolbar() = 0; + // Returns true if the compact navigation bar is focusable and got + // focus, false otherwise. + virtual bool SetFocusToCompactNavigationBar() = 0; + // Toggles the visibility of CompactNavigationBar. virtual void ToggleCompactNavigationBar() = 0; diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index f50e6a1..dd241d1 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -934,9 +934,14 @@ LocationBar* BrowserView::GetLocationBar() const { void BrowserView::SetFocusToLocationBar() { LocationBarView* location_bar = toolbar_->location_bar(); - if (location_bar->IsFocusable()) { + if (browser_extender_->SetFocusToCompactNavigationBar()) { + // Compact navigation bar got focus. + } else if (location_bar->IsFocusable()) { + // Location bar got focus. location_bar->FocusLocation(); } else { + // If none of location bar/compact navigation bar got focus, + // then clear focus. views::FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager); focus_manager->ClearFocus(); diff --git a/chrome/browser/views/frame/standard_extender.cc b/chrome/browser/views/frame/standard_extender.cc index 1fe41d1..b03a572 100644 --- a/chrome/browser/views/frame/standard_extender.cc +++ b/chrome/browser/views/frame/standard_extender.cc @@ -27,6 +27,7 @@ class StandardExtender : public BrowserExtender { virtual void UpdateTitleBar() {} virtual void ActivationChanged() {} virtual bool ShouldForceHideToolbar() { return false; } + virtual bool SetFocusToCompactNavigationBar() { return false; } virtual void ToggleCompactNavigationBar() {} virtual void OnMouseEnteredToTab(Tab* tab) {} virtual void OnMouseMovedOnTab(Tab* tab) {} |