| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 LoadImages(); | 299 LoadImages(); |
| 300 | 300 |
| 301 // Always add children in order from left to right, for accessibility. | 301 // Always add children in order from left to right, for accessibility. |
| 302 AddChildView(back_); | 302 AddChildView(back_); |
| 303 AddChildView(forward_); | 303 AddChildView(forward_); |
| 304 AddChildView(reload_); | 304 AddChildView(reload_); |
| 305 AddChildView(home_); | 305 AddChildView(home_); |
| 306 AddChildView(browser_actions_); | 306 AddChildView(browser_actions_); |
| 307 AddChildView(app_menu_); | 307 AddChildView(app_menu_); |
| 308 | 308 |
| 309 // Put the location bar container between the home button and browser | |
| 310 // actions when doing a focus search. | |
| 311 home_->SetNextFocusableView(location_bar_container_); | |
| 312 location_bar_container_->SetNextFocusableView(browser_actions_); | |
| 313 | |
| 314 location_bar_->Init(popup_parent_view); | 309 location_bar_->Init(popup_parent_view); |
| 315 show_home_button_.Init(prefs::kShowHomeButton, | 310 show_home_button_.Init(prefs::kShowHomeButton, |
| 316 browser_->profile()->GetPrefs(), this); | 311 browser_->profile()->GetPrefs(), this); |
| 317 browser_actions_->Init(); | 312 browser_actions_->Init(); |
| 318 | 313 |
| 319 // Accessibility specific tooltip text. | 314 // Accessibility specific tooltip text. |
| 320 if (BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) { | 315 if (BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) { |
| 321 back_->SetTooltipText( | 316 back_->SetTooltipText( |
| 322 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK)); | 317 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK)); |
| 323 forward_->SetTooltipText( | 318 forward_->SetTooltipText( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 #endif | 438 #endif |
| 444 } | 439 } |
| 445 | 440 |
| 446 //////////////////////////////////////////////////////////////////////////////// | 441 //////////////////////////////////////////////////////////////////////////////// |
| 447 // ToolbarView, AccessiblePaneView overrides: | 442 // ToolbarView, AccessiblePaneView overrides: |
| 448 | 443 |
| 449 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { | 444 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { |
| 450 if (!AccessiblePaneView::SetPaneFocus(initial_focus)) | 445 if (!AccessiblePaneView::SetPaneFocus(initial_focus)) |
| 451 return false; | 446 return false; |
| 452 | 447 |
| 448 // Put the location bar container between the home button and browser |
| 449 // actions when doing a focus search. This needs to be done here rather |
| 450 // than during initialization, because the location bar container might |
| 451 // get siblings added to it after initialization of this view, which |
| 452 // breaks our override. |
| 453 home_->SetNextFocusableView(location_bar_container_); |
| 454 location_bar_container_->SetNextFocusableView(browser_actions_); |
| 455 |
| 453 location_bar_->SetShowFocusRect(true); | 456 location_bar_->SetShowFocusRect(true); |
| 454 return true; | 457 return true; |
| 455 } | 458 } |
| 456 | 459 |
| 457 void ToolbarView::GetAccessibleState(ui::AccessibleViewState* state) { | 460 void ToolbarView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 458 state->role = ui::AccessibilityTypes::ROLE_TOOLBAR; | 461 state->role = ui::AccessibilityTypes::ROLE_TOOLBAR; |
| 459 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR); | 462 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR); |
| 460 } | 463 } |
| 461 | 464 |
| 462 //////////////////////////////////////////////////////////////////////////////// | 465 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 // LocationBarContainer is not a child of the ToolbarView. | 1013 // LocationBarContainer is not a child of the ToolbarView. |
| 1011 gfx::Point origin(bounds.origin()); | 1014 gfx::Point origin(bounds.origin()); |
| 1012 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), | 1015 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
| 1013 &origin); | 1016 &origin); |
| 1014 gfx::Rect target_bounds(origin, bounds.size()); | 1017 gfx::Rect target_bounds(origin, bounds.size()); |
| 1015 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1018 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
| 1016 location_bar_container_->SetInToolbar(true); | 1019 location_bar_container_->SetInToolbar(true); |
| 1017 location_bar_container_->SetBoundsRect(target_bounds); | 1020 location_bar_container_->SetBoundsRect(target_bounds); |
| 1018 } | 1021 } |
| 1019 } | 1022 } |
| OLD | NEW |