Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4454)

Unified Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 10949005: Fix toolbar keyboard accessibility on Views (alternative impl). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux_chromeos compile Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar_view.cc
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index f2164cc786b0ca4f5fe685949952b7997be55c78..d2edce4fca4bdc18f08988102929f2ac6e58b464 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -245,6 +245,7 @@ void ToolbarView::Init(views::View* location_bar_parent,
// Have to create this before |reload_| as |reload_|'s constructor needs it.
location_bar_container_ = new LocationBarContainer(
location_bar_parent,
+ this,
chrome::search::IsInstantExtendedAPIEnabled(browser_->profile()));
location_bar_ = new LocationBarView(
browser_,
@@ -305,6 +306,11 @@ void ToolbarView::Init(views::View* location_bar_parent,
AddChildView(browser_actions_);
AddChildView(app_menu_);
+ // Put the location bar container between the home button and browser
+ // actions when doing a focus search.
+ home_->SetNextFocusableView(location_bar_container_);
+ location_bar_container_->SetNextFocusableView(browser_actions_);
+
location_bar_->Init(popup_parent_view);
show_home_button_.Init(prefs::kShowHomeButton,
browser_->profile()->GetPrefs(), this);
@@ -881,6 +887,7 @@ bool ToolbarView::IsWrenchMenuShowing() const {
// also so that it selects all content in the location bar.
bool ToolbarView::SetPaneFocusAndFocusDefault() {
if (!location_bar_->HasFocus()) {
+ SetPaneFocus(location_bar_);
location_bar_->FocusLocation(true);
return true;
}
@@ -896,6 +903,21 @@ void ToolbarView::RemovePaneFocus() {
location_bar_->SetShowFocusRect(false);
}
+views::View* ToolbarView::GetParentForFocusSearch(views::View* v) {
+ if (v == location_bar_container_)
+ return this;
+
+ return AccessiblePaneView::GetParentForFocusSearch(v);
+}
+
+bool ToolbarView::ContainsForFocusSearch(views::View* root,
+ const views::View* v) {
+ if (Contains(root) && location_bar_container_->Contains(v))
+ return true;
+
+ return AccessiblePaneView::ContainsForFocusSearch(root, v);
+}
+
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, private:

Powered by Google App Engine
This is Rietveld 408576698