| 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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 return kViewClassName; | 832 return kViewClassName; |
| 833 } | 833 } |
| 834 | 834 |
| 835 bool ToolbarView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 835 bool ToolbarView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 836 const views::View* focused_view = focus_manager_->GetFocusedView(); | 836 const views::View* focused_view = focus_manager_->GetFocusedView(); |
| 837 if (focused_view == location_bar_) | 837 if (focused_view == location_bar_) |
| 838 return false; // Let location bar handle all accelerator events. | 838 return false; // Let location bar handle all accelerator events. |
| 839 return AccessiblePaneView::AcceleratorPressed(accelerator); | 839 return AccessiblePaneView::AcceleratorPressed(accelerator); |
| 840 } | 840 } |
| 841 | 841 |
| 842 bool ToolbarView::IsWrenchMenuShowing() const { |
| 843 return wrench_menu_.get() && wrench_menu_->IsShowing(); |
| 844 } |
| 845 |
| 842 //////////////////////////////////////////////////////////////////////////////// | 846 //////////////////////////////////////////////////////////////////////////////// |
| 843 // ToolbarView, protected: | 847 // ToolbarView, protected: |
| 844 | 848 |
| 845 // Override this so that when the user presses F6 to rotate toolbar panes, | 849 // Override this so that when the user presses F6 to rotate toolbar panes, |
| 846 // the location bar gets focus, not the first control in the toolbar - and | 850 // the location bar gets focus, not the first control in the toolbar - and |
| 847 // also so that it selects all content in the location bar. | 851 // also so that it selects all content in the location bar. |
| 848 bool ToolbarView::SetPaneFocusAndFocusDefault() { | 852 bool ToolbarView::SetPaneFocusAndFocusDefault() { |
| 849 if (!location_bar_->HasFocus()) { | 853 if (!location_bar_->HasFocus()) { |
| 850 location_bar_->FocusLocation(true); | 854 location_bar_->FocusLocation(true); |
| 851 return true; | 855 return true; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 // LocationBarContainer is not a child of the ToolbarView. | 1017 // LocationBarContainer is not a child of the ToolbarView. |
| 1014 gfx::Point origin(bounds.origin()); | 1018 gfx::Point origin(bounds.origin()); |
| 1015 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), | 1019 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
| 1016 &origin); | 1020 &origin); |
| 1017 gfx::Rect target_bounds(origin, bounds.size()); | 1021 gfx::Rect target_bounds(origin, bounds.size()); |
| 1018 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1022 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
| 1019 location_bar_container_->SetInToolbar(true); | 1023 location_bar_container_->SetInToolbar(true); |
| 1020 location_bar_container_->SetBoundsRect(target_bounds); | 1024 location_bar_container_->SetBoundsRect(target_bounds); |
| 1021 } | 1025 } |
| 1022 } | 1026 } |
| OLD | NEW |