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/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 749 |
750 gfx::Rect client_area_bounds = | 750 gfx::Rect client_area_bounds = |
751 layout_->CalculateClientAreaBounds(width(), height()); | 751 layout_->CalculateClientAreaBounds(width(), height()); |
752 SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); | 752 SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); |
753 | 753 |
754 if (browser_view()->IsToolbarVisible()) { | 754 if (browser_view()->IsToolbarVisible()) { |
755 // The client edge images always start below the toolbar corner images. The | 755 // The client edge images always start below the toolbar corner images. The |
756 // client edge filled rects start there or at the bottom of the toolbar, | 756 // client edge filled rects start there or at the bottom of the toolbar, |
757 // whichever is shorter. | 757 // whichever is shorter. |
758 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 758 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
759 image_top += toolbar_bounds.y() + | 759 |
760 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); | 760 gfx::ImageSkia* content_top_left_corner = |
| 761 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER); |
| 762 // TODO(oshima): Sanity checks for crbug.com/374273. Remove when it's fixed. |
| 763 CHECK(content_top_left_corner); |
| 764 CHECK(!content_top_left_corner->isNull()); |
| 765 |
| 766 image_top += toolbar_bounds.y() + content_top_left_corner->height(); |
761 client_area_top = std::min(image_top, | 767 client_area_top = std::min(image_top, |
762 client_area_top + toolbar_bounds.bottom() - kClientEdgeThickness); | 768 client_area_top + toolbar_bounds.bottom() - kClientEdgeThickness); |
763 } else if (!browser_view()->IsTabStripVisible()) { | 769 } else if (!browser_view()->IsTabStripVisible()) { |
764 // The toolbar isn't going to draw a client edge for us, so draw one | 770 // The toolbar isn't going to draw a client edge for us, so draw one |
765 // ourselves. | 771 // ourselves. |
766 gfx::ImageSkia* top_left = tp->GetImageSkiaNamed(IDR_APP_TOP_LEFT); | 772 gfx::ImageSkia* top_left = tp->GetImageSkiaNamed(IDR_APP_TOP_LEFT); |
767 gfx::ImageSkia* top_center = tp->GetImageSkiaNamed(IDR_APP_TOP_CENTER); | 773 gfx::ImageSkia* top_center = tp->GetImageSkiaNamed(IDR_APP_TOP_CENTER); |
768 gfx::ImageSkia* top_right = tp->GetImageSkiaNamed(IDR_APP_TOP_RIGHT); | 774 gfx::ImageSkia* top_right = tp->GetImageSkiaNamed(IDR_APP_TOP_RIGHT); |
769 int top_edge_y = client_area_top - top_center->height(); | 775 int top_edge_y = client_area_top - top_center->height(); |
770 int height = client_area_top - top_edge_y; | 776 int height = client_area_top - top_edge_y; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 902 |
897 int OpaqueBrowserFrameView::GetTopAreaHeight() const { | 903 int OpaqueBrowserFrameView::GetTopAreaHeight() const { |
898 gfx::ImageSkia* frame_image = GetFrameImage(); | 904 gfx::ImageSkia* frame_image = GetFrameImage(); |
899 int top_area_height = frame_image->height(); | 905 int top_area_height = frame_image->height(); |
900 if (browser_view()->IsTabStripVisible()) { | 906 if (browser_view()->IsTabStripVisible()) { |
901 top_area_height = std::max(top_area_height, | 907 top_area_height = std::max(top_area_height, |
902 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); | 908 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); |
903 } | 909 } |
904 return top_area_height; | 910 return top_area_height; |
905 } | 911 } |
OLD | NEW |