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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 browser_actions_->Layout(); | 756 browser_actions_->Layout(); |
757 | 757 |
758 // Extend the app menu to the screen's right edge in maximized mode just like | 758 // Extend the app menu to the screen's right edge in maximized mode just like |
759 // we extend the back button to the left edge. | 759 // we extend the back button to the left edge. |
760 if (maximized) | 760 if (maximized) |
761 app_menu_width += kRightEdgeSpacing; | 761 app_menu_width += kRightEdgeSpacing; |
762 app_menu_->SetBounds(browser_actions_->x() + browser_actions_width, child_y, | 762 app_menu_->SetBounds(browser_actions_->x() + browser_actions_width, child_y, |
763 app_menu_width, child_height); | 763 app_menu_width, child_height); |
764 } | 764 } |
765 | 765 |
766 bool ToolbarView::HitTest(const gfx::Point& point) const { | 766 bool ToolbarView::HitTestRect(const gfx::Rect& rect) const { |
767 // Don't take hits in our top shadow edge. Let them fall through to the | 767 // Don't take hits in our top shadow edge. Let them fall through to the |
768 // tab strip above us. | 768 // tab strip above us. |
769 if (point.y() < kContentShadowHeight) | 769 if (rect.y() < kContentShadowHeight) |
770 return false; | 770 return false; |
771 // Otherwise let our superclass take care of it. | 771 // Otherwise let our superclass take care of it. |
772 return AccessiblePaneView::HitTest(point); | 772 return AccessiblePaneView::HitTestRect(rect); |
773 } | 773 } |
774 | 774 |
775 void ToolbarView::OnPaint(gfx::Canvas* canvas) { | 775 void ToolbarView::OnPaint(gfx::Canvas* canvas) { |
776 View::OnPaint(canvas); | 776 View::OnPaint(canvas); |
777 | 777 |
778 if (is_display_mode_normal()) | 778 if (is_display_mode_normal()) |
779 return; | 779 return; |
780 | 780 |
781 // In maximized mode, we don't draw the endcaps on the location bar, because | 781 // In maximized mode, we don't draw the endcaps on the location bar, because |
782 // when they're flush against the edge of the screen they just look glitchy. | 782 // when they're flush against the edge of the screen they just look glitchy. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 // LocationBarContainer is not a child of the ToolbarView. | 1012 // LocationBarContainer is not a child of the ToolbarView. |
1013 gfx::Point origin(bounds.origin()); | 1013 gfx::Point origin(bounds.origin()); |
1014 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1014 views::View::ConvertPointToView(this, location_bar_container_->parent(), |
1015 &origin); | 1015 &origin); |
1016 gfx::Rect target_bounds(origin, bounds.size()); | 1016 gfx::Rect target_bounds(origin, bounds.size()); |
1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1018 location_bar_container_->SetInToolbar(true); | 1018 location_bar_container_->SetInToolbar(true); |
1019 location_bar_container_->SetBoundsRect(target_bounds); | 1019 location_bar_container_->SetBoundsRect(target_bounds); |
1020 } | 1020 } |
1021 } | 1021 } |
OLD | NEW |