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