| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
| 9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), | 751 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), |
| 752 MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(), | 752 MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(), |
| 753 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false); | 753 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false); |
| 754 } | 754 } |
| 755 | 755 |
| 756 void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { | 756 void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { |
| 757 ThemeProvider* tp = GetThemeProvider(); | 757 ThemeProvider* tp = GetThemeProvider(); |
| 758 int client_area_top = frame_->GetWindow()->GetClientView()->y(); | 758 int client_area_top = frame_->GetWindow()->GetClientView()->y(); |
| 759 | 759 |
| 760 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); | 760 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); |
| 761 SkColor toolbar_color = tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); |
| 762 |
| 761 if (browser_view_->IsToolbarVisible()) { | 763 if (browser_view_->IsToolbarVisible()) { |
| 762 // The client edges start below the toolbar or its corner images, whichever | 764 // The client edges start below the toolbar or its corner images, whichever |
| 763 // is shorter. | 765 // is shorter. |
| 764 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); | 766 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); |
| 765 client_area_top += browser_view_->GetToolbarBounds().y() + | 767 client_area_top += browser_view_->GetToolbarBounds().y() + |
| 766 std::min(tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(), | 768 std::min(tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(), |
| 767 toolbar_bounds.height()); | 769 toolbar_bounds.height()); |
| 768 } else { | 770 } else { |
| 769 // The toolbar isn't going to draw a client edge for us, so draw one | 771 // The toolbar isn't going to draw a client edge for us, so draw one |
| 770 // ourselves. | 772 // ourselves. |
| 771 // This next calculation is necessary because the top center bitmap is | |
| 772 // shorter than the top left and right bitmaps. We need their top edges to | |
| 773 // line up, and we need the left and right edges to start below the corners' | |
| 774 // bottoms. | |
| 775 SkBitmap* top_left = tp->GetBitmapNamed(IDR_APP_TOP_LEFT); | 773 SkBitmap* top_left = tp->GetBitmapNamed(IDR_APP_TOP_LEFT); |
| 776 SkBitmap* top_center = tp->GetBitmapNamed(IDR_APP_TOP_CENTER); | 774 SkBitmap* top_center = tp->GetBitmapNamed(IDR_APP_TOP_CENTER); |
| 777 SkBitmap* top_right = tp->GetBitmapNamed(IDR_APP_TOP_RIGHT); | 775 SkBitmap* top_right = tp->GetBitmapNamed(IDR_APP_TOP_RIGHT); |
| 778 int top_edge_y = client_area_top - top_center->height(); | 776 int top_edge_y = client_area_top - top_center->height(); |
| 777 int height = client_area_top - top_edge_y; |
| 779 | 778 |
| 780 client_area_top = std::min(top_edge_y + top_left->height(), | |
| 781 height() - NonClientBorderThickness()); | |
| 782 int height = client_area_top - top_edge_y; | |
| 783 canvas->DrawBitmapInt(*top_left, 0, 0, top_left->width(), height, | 779 canvas->DrawBitmapInt(*top_left, 0, 0, top_left->width(), height, |
| 784 client_area_bounds.x() - top_left->width(), top_edge_y, | 780 client_area_bounds.x() - top_left->width(), top_edge_y, |
| 785 top_left->width(), height, false); | 781 top_left->width(), height, false); |
| 786 canvas->TileImageInt(*top_center, 0, 0, client_area_bounds.x(), top_edge_y, | 782 canvas->TileImageInt(*top_center, 0, 0, client_area_bounds.x(), top_edge_y, |
| 787 client_area_bounds.width(), std::min(height, top_center->height())); | 783 client_area_bounds.width(), std::min(height, top_center->height())); |
| 788 canvas->DrawBitmapInt(*top_right, 0, 0, top_right->width(), height, | 784 canvas->DrawBitmapInt(*top_right, 0, 0, top_right->width(), height, |
| 789 client_area_bounds.right(), top_edge_y, | 785 client_area_bounds.right(), top_edge_y, |
| 790 top_right->width(), height, false); | 786 top_right->width(), height, false); |
| 787 |
| 788 // Draw the toolbar color across the top edge. |
| 789 canvas->DrawLineInt(toolbar_color, |
| 790 client_area_bounds.x() - kClientEdgeThickness, |
| 791 client_area_top - kClientEdgeThickness, |
| 792 client_area_bounds.right() + kClientEdgeThickness, |
| 793 client_area_top - kClientEdgeThickness); |
| 791 } | 794 } |
| 792 | 795 |
| 793 int client_area_bottom = | 796 int client_area_bottom = |
| 794 std::max(client_area_top, height() - NonClientBorderThickness()); | 797 std::max(client_area_top, height() - NonClientBorderThickness()); |
| 795 int client_area_height = client_area_bottom - client_area_top; | 798 int client_area_height = client_area_bottom - client_area_top; |
| 796 | 799 |
| 797 // Draw the toolbar color so that the one pixel areas down the sides | 800 // Draw the toolbar color so that the one pixel areas down the sides |
| 798 // show the right color even if not covered by the toolbar image. | 801 // show the right color even if not covered by the toolbar image. |
| 799 SkColor toolbar_color = tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); | |
| 800 canvas->DrawLineInt(toolbar_color, | 802 canvas->DrawLineInt(toolbar_color, |
| 801 client_area_bounds.x() - kClientEdgeThickness, | 803 client_area_bounds.x() - kClientEdgeThickness, |
| 802 client_area_top, | 804 client_area_top, |
| 803 client_area_bounds.x() - kClientEdgeThickness, | 805 client_area_bounds.x() - kClientEdgeThickness, |
| 804 client_area_bottom - 1 + kClientEdgeThickness); | 806 client_area_bottom - 1 + kClientEdgeThickness); |
| 805 canvas->DrawLineInt(toolbar_color, | 807 canvas->DrawLineInt(toolbar_color, |
| 806 client_area_bounds.x() - kClientEdgeThickness, | 808 client_area_bounds.x() - kClientEdgeThickness, |
| 807 client_area_bottom - 1 + kClientEdgeThickness, | 809 client_area_bottom - 1 + kClientEdgeThickness, |
| 808 client_area_bounds.right() + kClientEdgeThickness, | 810 client_area_bounds.right() + kClientEdgeThickness, |
| 809 client_area_bottom - 1 + kClientEdgeThickness); | 811 client_area_bottom - 1 + kClientEdgeThickness); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 if (!initialized) { | 982 if (!initialized) { |
| 981 #if defined(OS_WIN) | 983 #if defined(OS_WIN) |
| 982 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); | 984 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); |
| 983 #else | 985 #else |
| 984 NOTIMPLEMENTED(); | 986 NOTIMPLEMENTED(); |
| 985 title_font_ = new gfx::Font(); | 987 title_font_ = new gfx::Font(); |
| 986 #endif | 988 #endif |
| 987 initialized = true; | 989 initialized = true; |
| 988 } | 990 } |
| 989 } | 991 } |
| OLD | NEW |