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/chromeos | |
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/chromeos')
-rw-r--r-- | chrome/browser/chromeos/browser_extenders.cc | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/compact_location_bar.h | 1 | ||||
-rw-r--r-- | chrome/browser/chromeos/compact_navigation_bar.cc | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/compact_navigation_bar.h | 4 |
4 files changed, 28 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/browser_extenders.cc b/chrome/browser/chromeos/browser_extenders.cc index 0c902c3..0e21d98 100644 --- a/chrome/browser/chromeos/browser_extenders.cc +++ b/chrome/browser/chromeos/browser_extenders.cc @@ -170,8 +170,18 @@ class NormalExtender : public BrowserExtender, return compact_navigation_bar_enabled_; } + virtual bool SetFocusToCompactNavigationBar() { + if (compact_navigation_bar_->IsFocusable()) { + compact_navigation_bar_->FocusLocation(); + return true; + } else { + return false; + } + } + virtual void ToggleCompactNavigationBar() { compact_navigation_bar_enabled_ = !compact_navigation_bar_enabled_; + compact_navigation_bar_->SetFocusable(compact_navigation_bar_enabled_); status_area_->Update(); } @@ -308,6 +318,10 @@ class PopupExtender : public BrowserExtender { return true; } + virtual bool SetFocusToCompactNavigationBar() { + return false; + } + virtual void ToggleCompactNavigationBar() {} virtual void OnMouseEnteredToTab(Tab* tab) {} diff --git a/chrome/browser/chromeos/compact_location_bar.h b/chrome/browser/chromeos/compact_location_bar.h index 599cb44..83c46e6 100644 --- a/chrome/browser/chromeos/compact_location_bar.h +++ b/chrome/browser/chromeos/compact_location_bar.h @@ -112,4 +112,3 @@ class CompactLocationBar : public views::View, } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_H_ - diff --git a/chrome/browser/chromeos/compact_navigation_bar.cc b/chrome/browser/chromeos/compact_navigation_bar.cc index 16a33b9..7d16b86 100644 --- a/chrome/browser/chromeos/compact_navigation_bar.cc +++ b/chrome/browser/chromeos/compact_navigation_bar.cc @@ -49,6 +49,7 @@ static const int kURLPadding = 2; CompactNavigationBar::CompactNavigationBar(Browser* browser) : browser_(browser), initialized_(false) { + SetFocusable(true); } CompactNavigationBar::~CompactNavigationBar() { @@ -114,6 +115,15 @@ void CompactNavigationBar::Init() { location_entry_view_->Attach(location_entry_->widget()); } +void CompactNavigationBar::Focus() { + location_entry_->SetFocus(); +} + +void CompactNavigationBar::FocusLocation() { + location_entry_->SetFocus(); + location_entry_->SelectAll(true); +} + gfx::Size CompactNavigationBar::GetPreferredSize() { int width = 0; diff --git a/chrome/browser/chromeos/compact_navigation_bar.h b/chrome/browser/chromeos/compact_navigation_bar.h index aa4b86a..7a689e9 100644 --- a/chrome/browser/chromeos/compact_navigation_bar.h +++ b/chrome/browser/chromeos/compact_navigation_bar.h @@ -40,10 +40,14 @@ class CompactNavigationBar : public views::View, // widget. void Init(); + // Set focus to the location entry in the compact navigation bar. + void FocusLocation(); + // views::View overrides. virtual gfx::Size GetPreferredSize(); virtual void Layout(); virtual void Paint(gfx::Canvas* canvas); + virtual void Focus(); private: // views::ButtonListener implementation. |