| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 PaintRestoredFrameBorder(canvas); | 442 PaintRestoredFrameBorder(canvas); |
| 443 | 443 |
| 444 // The window icon and title are painted by their respective views. | 444 // The window icon and title are painted by their respective views. |
| 445 /* TODO(pkasting): If this window is active, we should also draw a drop | 445 /* TODO(pkasting): If this window is active, we should also draw a drop |
| 446 * shadow on the title. This is tricky, because we don't want to hardcode a | 446 * shadow on the title. This is tricky, because we don't want to hardcode a |
| 447 * shadow color (since we want to work with various themes), but we can't | 447 * shadow color (since we want to work with various themes), but we can't |
| 448 * alpha-blend either (since the Windows text APIs don't really do this). | 448 * alpha-blend either (since the Windows text APIs don't really do this). |
| 449 * So we'd need to sample the background color at the right location and | 449 * So we'd need to sample the background color at the right location and |
| 450 * synthesize a good shadow color. */ | 450 * synthesize a good shadow color. */ |
| 451 | 451 |
| 452 if (IsToolbarVisible()) | 452 if (IsToolbarVisible() && IsTabStripVisible()) |
| 453 PaintToolbarBackground(canvas); | 453 PaintToolbarBackground(canvas); |
| 454 PaintClientEdge(canvas); | 454 PaintClientEdge(canvas); |
| 455 } | 455 } |
| 456 | 456 |
| 457 // BrowserNonClientFrameView: | 457 // BrowserNonClientFrameView: |
| 458 bool OpaqueBrowserFrameView::ShouldPaintAsThemed() const { | 458 bool OpaqueBrowserFrameView::ShouldPaintAsThemed() const { |
| 459 // Theme app and popup windows if |platform_observer_| wants it. | 459 // Theme app and popup windows if |platform_observer_| wants it. |
| 460 return browser_view()->IsBrowserTypeNormal() || | 460 return browser_view()->IsBrowserTypeNormal() || |
| 461 platform_observer_->IsUsingSystemTheme(); | 461 platform_observer_->IsUsingSystemTheme(); |
| 462 } | 462 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 frame_background_->PaintMaximized(canvas, this); | 615 frame_background_->PaintMaximized(canvas, this); |
| 616 } | 616 } |
| 617 | 617 |
| 618 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { | 618 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { |
| 619 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 619 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 620 if (toolbar_bounds.IsEmpty()) | 620 if (toolbar_bounds.IsEmpty()) |
| 621 return; | 621 return; |
| 622 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 622 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 623 ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 623 ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| 624 toolbar_bounds.set_origin(toolbar_origin); | 624 toolbar_bounds.set_origin(toolbar_origin); |
| 625 |
| 626 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 627 gfx::ImageSkia* bg = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); |
| 628 int x = toolbar_bounds.x(); |
| 629 const int y = toolbar_bounds.y(); |
| 630 const int bg_y = |
| 631 GetTopInset(false) + Tab::GetYInsetForActiveTabBackground(); |
| 632 const int w = toolbar_bounds.width(); |
| 625 const int h = toolbar_bounds.height(); | 633 const int h = toolbar_bounds.height(); |
| 626 const bool md = ui::MaterialDesignController::IsModeMaterial(); | |
| 627 const ui::ThemeProvider* tp = GetThemeProvider(); | |
| 628 const SkColor separator_color = | 634 const SkColor separator_color = |
| 629 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); | 635 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); |
| 636 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 637 // Background. The top stroke is drawn above the toolbar bounds, so |
| 638 // unlike in the non-Material Design code below, we don't need to exclude |
| 639 // any region from having the background image drawn over it. |
| 640 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { |
| 641 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), y - bg_y, x, y, |
| 642 w, h); |
| 643 } else { |
| 644 canvas->FillRect(toolbar_bounds, |
| 645 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); |
| 646 } |
| 630 | 647 |
| 631 if (browser_view()->IsTabStripVisible()) { | 648 // Material Design has no corners to mask out. |
| 632 gfx::ImageSkia* bg = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); | |
| 633 int x = toolbar_bounds.x(); | |
| 634 const int y = toolbar_bounds.y(); | |
| 635 const int bg_y = | |
| 636 GetTopInset(false) + Tab::GetYInsetForActiveTabBackground(); | |
| 637 const int w = toolbar_bounds.width(); | |
| 638 | 649 |
| 639 if (md) { | 650 // Top stroke. For Material Design, the toolbar has no side strokes. |
| 640 // Background. The top stroke is drawn above the toolbar bounds, so | 651 gfx::Rect separator_rect(x, y, w, 0); |
| 641 // unlike in the non-Material Design code below, we don't need to exclude | 652 gfx::ScopedCanvas scoped_canvas(canvas); |
| 642 // any region from having the background image drawn over it. | 653 gfx::Rect tabstrip_bounds(GetBoundsForTabStrip(browser_view()->tabstrip())); |
| 643 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { | 654 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); |
| 644 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), y - bg_y, x, | 655 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), |
| 645 y, w, h); | 656 SkRegion::kDifference_Op); |
| 646 } else { | 657 separator_rect.set_y(tabstrip_bounds.bottom()); |
| 647 canvas->FillRect(toolbar_bounds, | 658 BrowserView::Paint1pxHorizontalLine( |
| 648 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); | 659 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), |
| 649 } | 660 separator_rect, true); |
| 650 | 661 |
| 651 // Material Design has no corners to mask out. | 662 // Toolbar/content separator. |
| 663 toolbar_bounds.Inset(kClientEdgeThickness, 0); |
| 664 BrowserView::Paint1pxHorizontalLine(canvas, separator_color, toolbar_bounds, |
| 665 true); |
| 666 } else { |
| 667 const int kContentEdgeShadowThickness = |
| 668 OpaqueBrowserFrameViewLayout::kContentEdgeShadowThickness; |
| 652 | 669 |
| 653 // Top stroke. For Material Design, the toolbar has no side strokes. | 670 // Background. We need to create a separate layer so we can mask off the |
| 654 gfx::Rect separator_rect(x, y, w, 0); | 671 // corners before compositing onto the frame. |
| 655 gfx::ScopedCanvas scoped_canvas(canvas); | 672 canvas->sk_canvas()->saveLayer( |
| 656 gfx::Rect tabstrip_bounds( | 673 gfx::RectToSkRect(gfx::Rect(x - kContentEdgeShadowThickness, y, |
| 657 GetBoundsForTabStrip(browser_view()->tabstrip())); | 674 w + kContentEdgeShadowThickness * 2, h)), |
| 658 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); | 675 nullptr); |
| 659 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), | |
| 660 SkRegion::kDifference_Op); | |
| 661 separator_rect.set_y(tabstrip_bounds.bottom()); | |
| 662 BrowserView::Paint1pxHorizontalLine( | |
| 663 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), | |
| 664 separator_rect, true); | |
| 665 } else { | |
| 666 const int kContentEdgeShadowThickness = | |
| 667 OpaqueBrowserFrameViewLayout::kContentEdgeShadowThickness; | |
| 668 | 676 |
| 669 // Background. We need to create a separate layer so we can mask off the | 677 // The top stroke is drawn using the IDR_CONTENT_TOP_XXX images, which |
| 670 // corners before compositing onto the frame. | 678 // overlay the toolbar. The top 2 px of these images is the actual top |
| 671 canvas->sk_canvas()->saveLayer( | 679 // stroke + shadow, and is partly transparent, so the toolbar background |
| 672 gfx::RectToSkRect(gfx::Rect(x - kContentEdgeShadowThickness, y, | 680 // shouldn't be drawn over it. |
| 673 w + kContentEdgeShadowThickness * 2, h)), | 681 const int bg_dest_y = y + kContentEdgeShadowThickness; |
| 674 nullptr); | 682 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), bg_dest_y - bg_y, |
| 683 x, bg_dest_y, w, h - kContentEdgeShadowThickness); |
| 675 | 684 |
| 676 // The top stroke is drawn using the IDR_CONTENT_TOP_XXX images, which | 685 // Mask out the corners. |
| 677 // overlay the toolbar. The top 2 px of these images is the actual top | 686 gfx::ImageSkia* left = tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER); |
| 678 // stroke + shadow, and is partly transparent, so the toolbar background | 687 const int img_w = left->width(); |
| 679 // shouldn't be drawn over it. | 688 x -= kContentEdgeShadowThickness; |
| 680 const int split_point = std::min(kContentEdgeShadowThickness, h); | 689 SkPaint paint; |
| 681 if (h > split_point) { | 690 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 682 const int split_y = y + split_point; | 691 canvas->DrawImageInt( |
| 683 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), | 692 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK), 0, 0, img_w, |
| 684 split_y - bg_y, x, split_y, w, h - split_point); | 693 h, x, y, img_w, h, false, paint); |
| 685 } | 694 const int right_x = |
| 695 toolbar_bounds.right() + kContentEdgeShadowThickness - img_w; |
| 696 canvas->DrawImageInt( |
| 697 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK), 0, 0, img_w, |
| 698 h, right_x, y, img_w, h, false, paint); |
| 699 canvas->Restore(); |
| 686 | 700 |
| 687 // Mask out the corners. | 701 // Corner and side strokes. |
| 688 gfx::ImageSkia* left = tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER); | 702 canvas->DrawImageInt(*left, 0, 0, img_w, h, x, y, img_w, h, false); |
| 689 const int img_w = left->width(); | 703 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), |
| 690 x -= kContentEdgeShadowThickness; | 704 0, 0, img_w, h, right_x, y, img_w, h, false); |
| 691 SkPaint paint; | |
| 692 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | |
| 693 canvas->DrawImageInt( | |
| 694 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK), 0, 0, img_w, | |
| 695 h, x, y, img_w, h, false, paint); | |
| 696 const int right_x = | |
| 697 toolbar_bounds.right() + kContentEdgeShadowThickness - img_w; | |
| 698 canvas->DrawImageInt( | |
| 699 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK), 0, 0, | |
| 700 img_w, h, right_x, y, img_w, h, false, paint); | |
| 701 canvas->Restore(); | |
| 702 | 705 |
| 703 // Corner and side strokes. | 706 // Top stroke. |
| 704 canvas->DrawImageInt(*left, 0, 0, img_w, h, x, y, img_w, h, false); | 707 x += img_w; |
| 705 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | 708 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER), x, y, |
| 706 0, 0, img_w, h, right_x, y, img_w, h, false); | 709 right_x - x, kContentEdgeShadowThickness); |
| 707 | 710 |
| 708 // Top stroke. | 711 // Toolbar/content separator. |
| 709 x += img_w; | 712 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, |
| 710 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER), x, y, | 713 kClientEdgeThickness, 0); |
| 711 right_x - x, split_point); | |
| 712 } | |
| 713 } | |
| 714 | |
| 715 // Toolbar/content separator. | |
| 716 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | |
| 717 kClientEdgeThickness, 0); | |
| 718 if (md) { | |
| 719 BrowserView::Paint1pxHorizontalLine(canvas, separator_color, | |
| 720 toolbar_bounds, true); | |
| 721 } else { | |
| 722 canvas->FillRect(toolbar_bounds, separator_color); | 714 canvas->FillRect(toolbar_bounds, separator_color); |
| 723 } | 715 } |
| 724 } | 716 } |
| 725 | 717 |
| 726 void OpaqueBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { | 718 void OpaqueBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { |
| 727 gfx::Rect client_bounds = | 719 gfx::Rect client_bounds = |
| 728 layout_->CalculateClientAreaBounds(width(), height()); | 720 layout_->CalculateClientAreaBounds(width(), height()); |
| 729 const int x = client_bounds.x(); | 721 const int x = client_bounds.x(); |
| 730 int y = client_bounds.y(); | 722 int y = client_bounds.y(); |
| 731 const int w = client_bounds.width(); | 723 const int w = client_bounds.width(); |
| 732 const int right = client_bounds.right(); | 724 const int right = client_bounds.right(); |
| 725 |
| 733 const bool tabstrip_visible = browser_view()->IsTabStripVisible(); | 726 const bool tabstrip_visible = browser_view()->IsTabStripVisible(); |
| 727 SkColor toolbar_color; |
| 728 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 734 const bool md = ui::MaterialDesignController::IsModeMaterial(); | 729 const bool md = ui::MaterialDesignController::IsModeMaterial(); |
| 735 const ui::ThemeProvider* tp = GetThemeProvider(); | |
| 736 const SkColor toolbar_color = | |
| 737 tabstrip_visible | |
| 738 ? tp->GetColor(ThemeProperties::COLOR_TOOLBAR) | |
| 739 : ThemeProperties::GetDefaultColor(ThemeProperties::COLOR_TOOLBAR, | |
| 740 browser_view()->IsOffTheRecord()); | |
| 741 | |
| 742 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 730 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 731 const bool incognito = browser_view()->IsOffTheRecord(); |
| 732 const bool toolbar_visible = IsToolbarVisible(); |
| 743 int img_y_offset = 0; | 733 int img_y_offset = 0; |
| 744 if (tabstrip_visible) { | 734 if (tabstrip_visible) { |
| 735 toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| 736 |
| 745 // Pre-Material Design, the client edge images start below the toolbar. In | 737 // Pre-Material Design, the client edge images start below the toolbar. In |
| 746 // MD the client edge images start at the top of the toolbar. | 738 // MD the client edge images start at the top of the toolbar. |
| 747 y += md ? toolbar_bounds.y() : toolbar_bounds.bottom(); | 739 y += md ? toolbar_bounds.y() : toolbar_bounds.bottom(); |
| 748 } else { | 740 } else { |
| 741 toolbar_color = ThemeProperties::GetDefaultColor( |
| 742 ThemeProperties::COLOR_TOOLBAR, incognito); |
| 743 |
| 749 // The toolbar isn't going to draw a top edge for us, so draw one ourselves. | 744 // The toolbar isn't going to draw a top edge for us, so draw one ourselves. |
| 750 if (IsToolbarVisible()) { | |
| 751 y += toolbar_bounds.y() + kClientEdgeThickness; | |
| 752 } | |
| 753 client_bounds.set_y(y); | |
| 754 client_bounds.Inset(-kClientEdgeThickness, -kClientEdgeThickness, | |
| 755 -kClientEdgeThickness, client_bounds.height()); | |
| 756 if (md) { | 745 if (md) { |
| 757 img_y_offset = -kClientEdgeThickness; | 746 client_bounds.Inset(-kClientEdgeThickness, -1, -kClientEdgeThickness, |
| 758 | 747 client_bounds.height()); |
| 759 // Edge. | |
| 760 BrowserView::Paint1pxHorizontalLine(canvas, toolbar_color, client_bounds, | |
| 761 false); | |
| 762 | 748 |
| 763 // Shadow. | 749 // Shadow. |
| 764 client_bounds.Offset(0, img_y_offset); | |
| 765 BrowserView::Paint1pxHorizontalLine( | 750 BrowserView::Paint1pxHorizontalLine( |
| 766 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), | 751 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), |
| 767 client_bounds, true); | 752 client_bounds, true); |
| 768 } else { | 753 } else { |
| 769 // Edge. | 754 // Ensure the client edge rects are drawn to the top of the location bar. |
| 770 canvas->FillRect(client_bounds, toolbar_color); | 755 img_y_offset = kClientEdgeThickness; |
| 771 | 756 |
| 772 // Shadow. | 757 // Shadow. |
| 773 gfx::ImageSkia* top_left = tp->GetImageSkiaNamed(IDR_APP_TOP_LEFT); | 758 gfx::ImageSkia* top_left = tp->GetImageSkiaNamed(IDR_APP_TOP_LEFT); |
| 774 const int img_w = top_left->width(); | 759 const int img_w = top_left->width(); |
| 775 const int height = top_left->height(); | 760 const int height = top_left->height(); |
| 776 const int top_y = y - height; | 761 const int top_y = y + img_y_offset - height; |
| 777 canvas->DrawImageInt(*top_left, 0, 0, img_w, height, x - img_w, top_y, | 762 canvas->DrawImageInt(*top_left, 0, 0, img_w, height, x - img_w, top_y, |
| 778 img_w, height, false); | 763 img_w, height, false); |
| 779 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_APP_TOP_CENTER), 0, 0, x, | 764 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_APP_TOP_CENTER), 0, 0, x, |
| 780 top_y, w, height); | 765 top_y, w, height); |
| 781 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_APP_TOP_RIGHT), 0, 0, | 766 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_APP_TOP_RIGHT), 0, 0, |
| 782 img_w, height, right, top_y, img_w, height, false); | 767 img_w, height, right, top_y, img_w, height, false); |
| 783 } | 768 } |
| 784 } | 769 } |
| 785 | 770 |
| 786 // In maximized mode, the only edge to draw is the top one, so we're done. | 771 // In maximized mode, the only edge to draw is the top one, so we're done. |
| 787 if (layout_->IsTitleBarCondensed()) | 772 if (layout_->IsTitleBarCondensed()) |
| 788 return; | 773 return; |
| 789 | 774 |
| 790 const int img_y = y + img_y_offset; | 775 const int img_y = y + img_y_offset; |
| 791 const int bottom = std::max(y, height() - NonClientBorderThickness()); | 776 const int bottom = std::max(y, height() - NonClientBorderThickness()); |
| 792 const int height = bottom - y; | 777 const int height = bottom - y; |
| 793 const int img_h = bottom - img_y; | 778 const int img_h = bottom - img_y; |
| 794 | 779 |
| 795 // Draw the client edge images. For non-MD, we fill the toolbar color | 780 // Draw the client edge images. For non-MD, we fill the toolbar color |
| 796 // underneath these images so they will lighten/darken it appropriately to | 781 // underneath these images so they will lighten/darken it appropriately to |
| 797 // create a "3D shaded" effect. For MD, where we want a flatter appearance, | 782 // create a "3D shaded" effect. For MD, where we want a flatter appearance, |
| 798 // we do the filling afterwards so the user sees the unmodified toolbar color. | 783 // we do the filling afterwards so the user sees the unmodified toolbar color. |
| 799 if (!md) | 784 if (!md) |
| 800 FillClientEdgeRects(x, y, w, height, toolbar_color, canvas); | 785 FillClientEdgeRects(x, y, w, height, true, toolbar_color, canvas); |
| 801 gfx::ImageSkia* right_image = tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); | 786 gfx::ImageSkia* right_image = tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); |
| 802 const int img_w = right_image->width(); | 787 const int img_w = right_image->width(); |
| 803 canvas->TileImageInt(*right_image, right, img_y, img_w, img_h); | 788 canvas->TileImageInt(*right_image, right, img_y, img_w, img_h); |
| 804 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), | 789 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), |
| 805 right, bottom); | 790 right, bottom); |
| 806 gfx::ImageSkia* bottom_image = | 791 gfx::ImageSkia* bottom_image = |
| 807 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); | 792 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); |
| 808 canvas->TileImageInt(*bottom_image, x, bottom, w, bottom_image->height()); | 793 canvas->TileImageInt(*bottom_image, x, bottom, w, bottom_image->height()); |
| 809 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), | 794 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), |
| 810 x - img_w, bottom); | 795 x - img_w, bottom); |
| 811 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), x - img_w, | 796 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), x - img_w, |
| 812 img_y, img_w, img_h); | 797 img_y, img_w, img_h); |
| 813 if (md) | 798 if (md) |
| 814 FillClientEdgeRects(x, y, w, height, toolbar_color, canvas); | 799 FillClientEdgeRects(x, y, w, height, true, toolbar_color, canvas); |
| 800 |
| 801 |
| 802 // For popup windows, draw location bar sides. |
| 803 if (!tabstrip_visible && toolbar_visible) { |
| 804 FillClientEdgeRects( |
| 805 x, y, w, toolbar_bounds.height(), false, |
| 806 LocationBarView::GetBorderColor(incognito), canvas); |
| 807 } |
| 815 } | 808 } |
| 816 | 809 |
| 817 void OpaqueBrowserFrameView::FillClientEdgeRects(int x, | 810 void OpaqueBrowserFrameView::FillClientEdgeRects(int x, |
| 818 int y, | 811 int y, |
| 819 int w, | 812 int w, |
| 820 int h, | 813 int h, |
| 814 bool draw_bottom, |
| 821 SkColor color, | 815 SkColor color, |
| 822 gfx::Canvas* canvas) const { | 816 gfx::Canvas* canvas) const { |
| 823 x -= kClientEdgeThickness; | 817 x -= kClientEdgeThickness; |
| 824 gfx::Rect side(x, y, kClientEdgeThickness, h); | 818 gfx::Rect side(x, y, kClientEdgeThickness, h); |
| 825 canvas->FillRect(side, color); | 819 canvas->FillRect(side, color); |
| 826 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), | 820 if (draw_bottom) { |
| 827 kClientEdgeThickness), | 821 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), |
| 828 color); | 822 kClientEdgeThickness), |
| 823 color); |
| 824 } |
| 829 side.Offset(w + kClientEdgeThickness, 0); | 825 side.Offset(w + kClientEdgeThickness, 0); |
| 830 canvas->FillRect(side, color); | 826 canvas->FillRect(side, color); |
| 831 } | 827 } |
| OLD | NEW |