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

Side by Side Diff: chrome/browser/views/toolbar_view.cc

Issue 2817022: Small tweaks to improve toolbar keyboard accessibility: Put focus rects... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/toolbar_view.h" 5 #include "chrome/browser/views/toolbar_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 views::Event::EF_MIDDLE_BUTTON_DOWN); 142 views::Event::EF_MIDDLE_BUTTON_DOWN);
143 home_->set_tag(IDC_HOME); 143 home_->set_tag(IDC_HOME);
144 home_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_HOME)); 144 home_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_HOME));
145 home_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_HOME)); 145 home_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_HOME));
146 home_->SetID(VIEW_ID_HOME_BUTTON); 146 home_->SetID(VIEW_ID_HOME_BUTTON);
147 147
148 // Have to create this before |reload_| as |reload_|'s constructor needs it. 148 // Have to create this before |reload_| as |reload_|'s constructor needs it.
149 location_bar_ = new LocationBarView(profile, browser_->command_updater(), 149 location_bar_ = new LocationBarView(profile, browser_->command_updater(),
150 model_, this, (display_mode_ == DISPLAYMODE_LOCATION) ? 150 model_, this, (display_mode_ == DISPLAYMODE_LOCATION) ?
151 LocationBarView::POPUP : LocationBarView::NORMAL); 151 LocationBarView::POPUP : LocationBarView::NORMAL);
152 location_bar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_LOCATION));
153 152
154 reload_ = new ReloadButton(location_bar_, browser_); 153 reload_ = new ReloadButton(location_bar_, browser_);
155 reload_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN | 154 reload_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
156 views::Event::EF_MIDDLE_BUTTON_DOWN); 155 views::Event::EF_MIDDLE_BUTTON_DOWN);
157 reload_->set_tag(IDC_RELOAD); 156 reload_->set_tag(IDC_RELOAD);
158 reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD)); 157 reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD));
159 reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD)); 158 reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD));
160 reload_->SetID(VIEW_ID_RELOAD_BUTTON); 159 reload_->SetID(VIEW_ID_RELOAD_BUTTON);
161 160
162 browser_actions_ = new BrowserActionsContainer(browser_, this, true); 161 browser_actions_ = new BrowserActionsContainer(browser_, this, true);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // location bar entry view, like we do when we switch to full screen mode in 268 // location bar entry view, like we do when we switch to full screen mode in
270 // BrowserView::ProcessFullscreen. Otherwise the text view can appear floating 269 // BrowserView::ProcessFullscreen. Otherwise the text view can appear floating
271 // on top of web content. 270 // on top of web content.
272 if (collapsed_) 271 if (collapsed_)
273 location_bar_->PushForceHidden(); 272 location_bar_->PushForceHidden();
274 else 273 else
275 location_bar_->PopForceHidden(); 274 location_bar_->PopForceHidden();
276 } 275 }
277 276
278 //////////////////////////////////////////////////////////////////////////////// 277 ////////////////////////////////////////////////////////////////////////////////
278 // ToolbarView, AccessibleToolbarView overrides:
279
280 bool ToolbarView::SetToolbarFocus(
281 int view_storage_id, views::View* initial_focus) {
282 if (!AccessibleToolbarView::SetToolbarFocus(view_storage_id, initial_focus))
283 return false;
284
285 location_bar_->set_show_focus_rect(true);
286 return true;
287 }
288
289 ////////////////////////////////////////////////////////////////////////////////
279 // ToolbarView, Menu::BaseControllerDelegate overrides: 290 // ToolbarView, Menu::BaseControllerDelegate overrides:
280 291
281 bool ToolbarView::GetAcceleratorInfo(int id, menus::Accelerator* accel) { 292 bool ToolbarView::GetAcceleratorInfo(int id, menus::Accelerator* accel) {
282 return GetWidget()->GetAccelerator(id, accel); 293 return GetWidget()->GetAccelerator(id, accel);
283 } 294 }
284 295
285 //////////////////////////////////////////////////////////////////////////////// 296 ////////////////////////////////////////////////////////////////////////////////
286 // ToolbarView, views::MenuDelegate implementation: 297 // ToolbarView, views::MenuDelegate implementation:
287 298
288 void ToolbarView::RunMenu(views::View* source, const gfx::Point& pt) { 299 void ToolbarView::RunMenu(views::View* source, const gfx::Point& pt) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1); 570 canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1);
560 } 571 }
561 572
562 void ToolbarView::ThemeChanged() { 573 void ToolbarView::ThemeChanged() {
563 LoadImages(); 574 LoadImages();
564 } 575 }
565 576
566 //////////////////////////////////////////////////////////////////////////////// 577 ////////////////////////////////////////////////////////////////////////////////
567 // ToolbarView, protected: 578 // ToolbarView, protected:
568 579
580 // Override this so that when the user presses F6 to rotate toolbar panes,
581 // the location bar gets focus, not the first control in the toolbar.
569 views::View* ToolbarView::GetDefaultFocusableChild() { 582 views::View* ToolbarView::GetDefaultFocusableChild() {
570 return location_bar_; 583 return location_bar_;
571 } 584 }
572 585
586 void ToolbarView::RemoveToolbarFocus() {
587 AccessibleToolbarView::RemoveToolbarFocus();
588 location_bar_->set_show_focus_rect(false);
589 }
590
573 //////////////////////////////////////////////////////////////////////////////// 591 ////////////////////////////////////////////////////////////////////////////////
574 // ToolbarView, private: 592 // ToolbarView, private:
575 593
576 int ToolbarView::PopupTopSpacing() const { 594 int ToolbarView::PopupTopSpacing() const {
577 return GetWindow()->GetNonClientView()->UseNativeFrame() ? 595 return GetWindow()->GetNonClientView()->UseNativeFrame() ?
578 0 : kPopupTopSpacingNonGlass; 596 0 : kPopupTopSpacingNonGlass;
579 } 597 }
580 598
581 void ToolbarView::LoadImages() { 599 void ToolbarView::LoadImages() {
582 ThemeProvider* tp = GetThemeProvider(); 600 ThemeProvider* tp = GetThemeProvider();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 } 799 }
782 #endif 800 #endif
783 801
784 // Tell the menu button to activate, opening its pop-up menu. 802 // Tell the menu button to activate, opening its pop-up menu.
785 menu_button->Activate(); 803 menu_button->Activate();
786 804
787 #if defined(OS_WIN) 805 #if defined(OS_WIN)
788 SetToolbarFocus(NULL, menu_button); 806 SetToolbarFocus(NULL, menu_button);
789 #endif 807 #endif
790 } 808 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698