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

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 test on linux_chromeos 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
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | chrome/browser/ui/views/toolbar_view_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c837bff29d96a41ee34b36e6bed6e49cec0f4d53 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);
@@ -863,7 +869,7 @@ std::string ToolbarView::GetClassName() const {
}
bool ToolbarView::AcceleratorPressed(const ui::Accelerator& accelerator) {
- const views::View* focused_view = focus_manager_->GetFocusedView();
+ const views::View* focused_view = focus_manager()->GetFocusedView();
if (focused_view == location_bar_)
return false; // Let location bar handle all accelerator events.
return AccessiblePaneView::AcceleratorPressed(accelerator);
@@ -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:
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | chrome/browser/ui/views/toolbar_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698