| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/themes/theme_service_factory.h" | 9 #include "chrome/browser/themes/theme_service_factory.h" |
| 10 #include "chrome/browser/ui/layout_constants.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_frame.h" | 11 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 12 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" | 13 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| 13 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_speci
fic.h" | 14 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_speci
fic.h" |
| 14 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" | 15 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
| 15 #include "chrome/browser/ui/views/tab_icon_view.h" | 16 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 16 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 17 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 18 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 19 #include "chrome/grit/theme_resources.h" | 20 #include "chrome/grit/theme_resources.h" |
| 20 #include "components/strings/grit/components_strings.h" | 21 #include "components/strings/grit/components_strings.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "ui/accessibility/ax_view_state.h" | 23 #include "ui/accessibility/ax_view_state.h" |
| 23 #include "ui/base/hit_test.h" | 24 #include "ui/base/hit_test.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/material_design/material_design_controller.h" | |
| 26 #include "ui/base/theme_provider.h" | 26 #include "ui/base/theme_provider.h" |
| 27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 28 #include "ui/gfx/font_list.h" | 28 #include "ui/gfx/font_list.h" |
| 29 #include "ui/gfx/geometry/rect_conversions.h" | 29 #include "ui/gfx/geometry/rect_conversions.h" |
| 30 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
| 31 #include "ui/gfx/image/image_skia.h" | 31 #include "ui/gfx/image/image_skia.h" |
| 32 #include "ui/gfx/path.h" | 32 #include "ui/gfx/path.h" |
| 33 #include "ui/gfx/scoped_canvas.h" | 33 #include "ui/gfx/scoped_canvas.h" |
| 34 #include "ui/views/controls/button/image_button.h" | 34 #include "ui/views/controls/button/image_button.h" |
| 35 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 int OpaqueBrowserFrameView::GetTabStripHeight() const { | 399 int OpaqueBrowserFrameView::GetTabStripHeight() const { |
| 400 return browser_view()->GetTabStripHeight(); | 400 return browser_view()->GetTabStripHeight(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 gfx::Size OpaqueBrowserFrameView::GetTabstripPreferredSize() const { | 403 gfx::Size OpaqueBrowserFrameView::GetTabstripPreferredSize() const { |
| 404 gfx::Size s = browser_view()->tabstrip()->GetPreferredSize(); | 404 gfx::Size s = browser_view()->tabstrip()->GetPreferredSize(); |
| 405 return s; | 405 return s; |
| 406 } | 406 } |
| 407 | 407 |
| 408 int OpaqueBrowserFrameView::GetToolbarLeadingCornerClientWidth() const { | |
| 409 return browser_view()->GetToolbarBounds().x() - | |
| 410 OpaqueBrowserFrameViewLayout::kContentEdgeShadowThickness + | |
| 411 GetThemeProvider()->GetImageSkiaNamed( | |
| 412 IDR_CONTENT_TOP_LEFT_CORNER)->width(); | |
| 413 } | |
| 414 | |
| 415 /////////////////////////////////////////////////////////////////////////////// | 408 /////////////////////////////////////////////////////////////////////////////// |
| 416 // OpaqueBrowserFrameView, protected: | 409 // OpaqueBrowserFrameView, protected: |
| 417 | 410 |
| 418 // views::View: | 411 // views::View: |
| 419 void OpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) { | 412 void OpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) { |
| 420 if (frame()->IsFullscreen()) | 413 if (frame()->IsFullscreen()) |
| 421 return; // Nothing is visible, so don't bother to paint. | 414 return; // Nothing is visible, so don't bother to paint. |
| 422 | 415 |
| 423 if (layout_->IsTitleBarCondensed()) | 416 if (layout_->IsTitleBarCondensed()) |
| 424 PaintMaximizedFrameBorder(canvas); | 417 PaintMaximizedFrameBorder(canvas); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 frame_background_->set_frame_color(GetFrameColor()); | 546 frame_background_->set_frame_color(GetFrameColor()); |
| 554 frame_background_->set_theme_image(GetFrameImage()); | 547 frame_background_->set_theme_image(GetFrameImage()); |
| 555 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); | 548 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); |
| 556 frame_background_->set_top_area_height(GetTopAreaHeight()); | 549 frame_background_->set_top_area_height(GetTopAreaHeight()); |
| 557 frame_background_->set_maximized_top_inset( | 550 frame_background_->set_maximized_top_inset( |
| 558 GetTopInset(true) - GetTopInset(false)); | 551 GetTopInset(true) - GetTopInset(false)); |
| 559 frame_background_->PaintMaximized(canvas, this); | 552 frame_background_->PaintMaximized(canvas, this); |
| 560 } | 553 } |
| 561 | 554 |
| 562 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { | 555 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { |
| 556 // TODO(estade): can this be shared with OpaqueBrowserFrameView? |
| 563 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 557 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 564 if (toolbar_bounds.IsEmpty()) | 558 if (toolbar_bounds.IsEmpty()) |
| 565 return; | 559 return; |
| 566 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 560 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 567 ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 561 ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| 568 toolbar_bounds.set_origin(toolbar_origin); | 562 toolbar_bounds.set_origin(toolbar_origin); |
| 569 | 563 |
| 570 const ui::ThemeProvider* tp = GetThemeProvider(); | 564 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 571 const gfx::ImageSkia* const bg = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); | 565 const int x = toolbar_bounds.x(); |
| 572 int x = toolbar_bounds.x(); | |
| 573 const int y = toolbar_bounds.y(); | 566 const int y = toolbar_bounds.y(); |
| 574 const int bg_y = | |
| 575 GetTopInset(false) + Tab::GetYInsetForActiveTabBackground(); | |
| 576 const int w = toolbar_bounds.width(); | 567 const int w = toolbar_bounds.width(); |
| 577 const int h = toolbar_bounds.height(); | |
| 578 const SkColor separator_color = | |
| 579 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); | |
| 580 if (ui::MaterialDesignController::IsModeMaterial()) { | |
| 581 // Background. The top stroke is drawn above the toolbar bounds, so | |
| 582 // unlike in the non-Material Design code below, we don't need to exclude | |
| 583 // any region from having the background image drawn over it. | |
| 584 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { | |
| 585 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), y - bg_y, x, y, | |
| 586 w, h); | |
| 587 } else { | |
| 588 canvas->FillRect(toolbar_bounds, | |
| 589 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); | |
| 590 } | |
| 591 | 568 |
| 592 // Material Design has no corners to mask out. | 569 // Background. |
| 570 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { |
| 571 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), |
| 572 x + GetThemeBackgroundXInset(), |
| 573 y - GetTopInset(false) - GetLayoutInsets(TAB).top(), x, |
| 574 y, w, toolbar_bounds.height()); |
| 575 } else { |
| 576 canvas->FillRect(toolbar_bounds, |
| 577 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); |
| 578 } |
| 593 | 579 |
| 594 // Top stroke. For Material Design, the toolbar has no side strokes. | 580 // Top stroke. |
| 595 gfx::Rect separator_rect(x, y, w, 0); | 581 gfx::Rect separator_rect(x, y, w, 0); |
| 596 gfx::ScopedCanvas scoped_canvas(canvas); | 582 gfx::ScopedCanvas scoped_canvas(canvas); |
| 597 gfx::Rect tabstrip_bounds(GetBoundsForTabStrip(browser_view()->tabstrip())); | 583 gfx::Rect tabstrip_bounds(GetBoundsForTabStrip(browser_view()->tabstrip())); |
| 598 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); | 584 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); |
| 599 canvas->ClipRect(tabstrip_bounds, SkRegion::kDifference_Op); | 585 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), |
| 600 separator_rect.set_y(tabstrip_bounds.bottom()); | 586 SkRegion::kDifference_Op); |
| 601 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), | 587 separator_rect.set_y(tabstrip_bounds.bottom()); |
| 602 separator_rect, true); | 588 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), |
| 589 separator_rect, true); |
| 603 | 590 |
| 604 // Toolbar/content separator. | 591 // Toolbar/content separator. |
| 605 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 592 BrowserView::Paint1pxHorizontalLine( |
| 606 BrowserView::Paint1pxHorizontalLine(canvas, separator_color, toolbar_bounds, | 593 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), |
| 607 true); | 594 toolbar_bounds, true); |
| 608 } else { | |
| 609 const int kContentEdgeShadowThickness = | |
| 610 OpaqueBrowserFrameViewLayout::kContentEdgeShadowThickness; | |
| 611 | |
| 612 // Background. We need to create a separate layer so we can mask off the | |
| 613 // corners before compositing onto the frame. | |
| 614 canvas->sk_canvas()->saveLayer( | |
| 615 gfx::RectToSkRect(gfx::Rect(x - kContentEdgeShadowThickness, y, | |
| 616 w + kContentEdgeShadowThickness * 2, h)), | |
| 617 nullptr); | |
| 618 | |
| 619 // The top stroke is drawn using the IDR_CONTENT_TOP_XXX images, which | |
| 620 // overlay the toolbar. The top 2 px of these images is the actual top | |
| 621 // stroke + shadow, and is partly transparent, so the toolbar background | |
| 622 // shouldn't be drawn over it. | |
| 623 const int bg_dest_y = y + kContentEdgeShadowThickness; | |
| 624 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), bg_dest_y - bg_y, | |
| 625 x, bg_dest_y, w, h - kContentEdgeShadowThickness); | |
| 626 | |
| 627 // Mask out the corners. | |
| 628 const gfx::ImageSkia* const left = | |
| 629 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER); | |
| 630 const int img_w = left->width(); | |
| 631 x -= kContentEdgeShadowThickness; | |
| 632 SkPaint paint; | |
| 633 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | |
| 634 canvas->DrawImageInt( | |
| 635 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK), 0, 0, img_w, | |
| 636 h, x, y, img_w, h, false, paint); | |
| 637 const int right_x = | |
| 638 toolbar_bounds.right() + kContentEdgeShadowThickness - img_w; | |
| 639 canvas->DrawImageInt( | |
| 640 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK), 0, 0, img_w, | |
| 641 h, right_x, y, img_w, h, false, paint); | |
| 642 canvas->Restore(); | |
| 643 | |
| 644 // Corner and side strokes. | |
| 645 canvas->DrawImageInt(*left, 0, 0, img_w, h, x, y, img_w, h, false); | |
| 646 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | |
| 647 0, 0, img_w, h, right_x, y, img_w, h, false); | |
| 648 | |
| 649 // Top stroke. | |
| 650 x += img_w; | |
| 651 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER), x, y, | |
| 652 right_x - x, kContentEdgeShadowThickness); | |
| 653 | |
| 654 // Toolbar/content separator. | |
| 655 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | |
| 656 kClientEdgeThickness, 0); | |
| 657 canvas->FillRect(toolbar_bounds, separator_color); | |
| 658 } | |
| 659 } | 595 } |
| 660 | 596 |
| 661 void OpaqueBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { | 597 void OpaqueBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { |
| 598 const bool tabstrip_visible = browser_view()->IsTabStripVisible(); |
| 662 gfx::Rect client_bounds = | 599 gfx::Rect client_bounds = |
| 663 layout_->CalculateClientAreaBounds(width(), height()); | 600 layout_->CalculateClientAreaBounds(width(), height()); |
| 664 const int x = client_bounds.x(); | 601 const int x = client_bounds.x(); |
| 665 int y = client_bounds.y(); | 602 int y = client_bounds.y(); |
| 666 const int w = client_bounds.width(); | 603 const int w = client_bounds.width(); |
| 667 const int right = client_bounds.right(); | 604 // If the toolbar isn't going to draw a top edge for us, draw one ourselves. |
| 668 | 605 if (!tabstrip_visible) { |
| 669 const bool tabstrip_visible = browser_view()->IsTabStripVisible(); | 606 client_bounds.Inset(-kClientEdgeThickness, -1, -kClientEdgeThickness, |
| 670 SkColor toolbar_color; | 607 client_bounds.height()); |
| 671 const ui::ThemeProvider* tp = GetThemeProvider(); | 608 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), |
| 672 const bool md = ui::MaterialDesignController::IsModeMaterial(); | 609 client_bounds, true); |
| 673 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | |
| 674 const bool incognito = browser_view()->IsIncognito(); | |
| 675 const bool toolbar_visible = IsToolbarVisible(); | |
| 676 int img_y_offset = 0; | |
| 677 if (tabstrip_visible) { | |
| 678 toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); | |
| 679 | |
| 680 // Pre-Material Design, the client edge images start below the toolbar. In | |
| 681 // MD the client edge images start at the top of the toolbar. | |
| 682 y += md ? toolbar_bounds.y() : toolbar_bounds.bottom(); | |
| 683 } else { | |
| 684 // Note that windows without tabstrips are never themed, so we always use | |
| 685 // the default colors in this section. | |
| 686 toolbar_color = ThemeProperties::GetDefaultColor( | |
| 687 ThemeProperties::COLOR_TOOLBAR, incognito); | |
| 688 | |
| 689 // The toolbar isn't going to draw a top edge for us, so draw one ourselves. | |
| 690 if (md) { | |
| 691 client_bounds.Inset(-kClientEdgeThickness, -1, -kClientEdgeThickness, | |
| 692 client_bounds.height()); | |
| 693 | |
| 694 // Shadow. | |
| 695 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), | |
| 696 client_bounds, true); | |
| 697 } else { | |
| 698 // Ensure the client edge rects are drawn to the top of the location bar. | |
| 699 img_y_offset = kClientEdgeThickness; | |
| 700 | |
| 701 // Shadow. | |
| 702 const gfx::ImageSkia* const top_left = | |
| 703 tp->GetImageSkiaNamed(IDR_APP_TOP_LEFT); | |
| 704 const int img_w = top_left->width(); | |
| 705 const int height = top_left->height(); | |
| 706 const int top_y = y + img_y_offset - height; | |
| 707 canvas->DrawImageInt(*top_left, 0, 0, img_w, height, x - img_w, top_y, | |
| 708 img_w, height, false); | |
| 709 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_APP_TOP_CENTER), 0, 0, x, | |
| 710 top_y, w, height); | |
| 711 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_APP_TOP_RIGHT), 0, 0, | |
| 712 img_w, height, right, top_y, img_w, height, false); | |
| 713 } | |
| 714 } | 610 } |
| 715 | 611 |
| 716 // In maximized mode, the only edge to draw is the top one, so we're done. | 612 // In maximized mode, the only edge to draw is the top one, so we're done. |
| 717 if (layout_->IsTitleBarCondensed()) | 613 if (layout_->IsTitleBarCondensed()) |
| 718 return; | 614 return; |
| 719 | 615 |
| 720 const int img_y = y + img_y_offset; | 616 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 721 const int bottom = std::max(y, height() - NonClientBorderThickness()); | 617 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 722 const int height = bottom - y; | 618 const bool incognito = browser_view()->IsIncognito(); |
| 723 const int img_h = bottom - img_y; | 619 SkColor toolbar_color; |
| 620 if (tabstrip_visible) { |
| 621 toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| 724 | 622 |
| 725 // Draw the client edge images. For non-MD, we fill the toolbar color | 623 // The client edge images start at the top of the toolbar. |
| 726 // underneath these images so they will lighten/darken it appropriately to | 624 y += toolbar_bounds.y(); |
| 727 // create a "3D shaded" effect. For MD, where we want a flatter appearance, | 625 } else { |
| 728 // we do the filling afterwards so the user sees the unmodified toolbar color. | 626 // Note that windows without tabstrips are never themed, so we always use |
| 729 if (!md) | 627 // the default colors in this section. |
| 730 FillClientEdgeRects(x, y, w, height, true, toolbar_color, canvas); | 628 toolbar_color = ThemeProperties::GetDefaultColor( |
| 629 ThemeProperties::COLOR_TOOLBAR, incognito); |
| 630 } |
| 631 |
| 632 // Draw the client edges. |
| 731 const gfx::ImageSkia* const right_image = | 633 const gfx::ImageSkia* const right_image = |
| 732 tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); | 634 tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); |
| 733 const int img_w = right_image->width(); | 635 const int img_w = right_image->width(); |
| 734 canvas->TileImageInt(*right_image, right, img_y, img_w, img_h); | 636 const int right = client_bounds.right(); |
| 637 const int bottom = std::max(y, height() - NonClientBorderThickness()); |
| 638 const int height = bottom - y; |
| 639 canvas->TileImageInt(*right_image, right, y, img_w, height); |
| 735 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), | 640 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), |
| 736 right, bottom); | 641 right, bottom); |
| 737 const gfx::ImageSkia* const bottom_image = | 642 const gfx::ImageSkia* const bottom_image = |
| 738 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); | 643 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); |
| 739 canvas->TileImageInt(*bottom_image, x, bottom, w, bottom_image->height()); | 644 canvas->TileImageInt(*bottom_image, x, bottom, w, bottom_image->height()); |
| 740 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), | 645 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), |
| 741 x - img_w, bottom); | 646 x - img_w, bottom); |
| 742 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), x - img_w, | 647 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), x - img_w, |
| 743 img_y, img_w, img_h); | 648 y, img_w, height); |
| 744 if (md) | 649 FillClientEdgeRects(x, y, w, height, true, toolbar_color, canvas); |
| 745 FillClientEdgeRects(x, y, w, height, true, toolbar_color, canvas); | |
| 746 | |
| 747 | 650 |
| 748 // For popup windows, draw location bar sides. | 651 // For popup windows, draw location bar sides. |
| 749 if (!tabstrip_visible && toolbar_visible) { | 652 if (!tabstrip_visible && IsToolbarVisible()) { |
| 750 FillClientEdgeRects( | 653 FillClientEdgeRects( |
| 751 x, y, w, toolbar_bounds.height(), false, | 654 x, y, w, toolbar_bounds.height(), false, |
| 752 LocationBarView::GetBorderColor(incognito), canvas); | 655 LocationBarView::GetBorderColor(incognito), canvas); |
| 753 } | 656 } |
| 754 } | 657 } |
| 755 | 658 |
| 756 void OpaqueBrowserFrameView::FillClientEdgeRects(int x, | 659 void OpaqueBrowserFrameView::FillClientEdgeRects(int x, |
| 757 int y, | 660 int y, |
| 758 int w, | 661 int w, |
| 759 int h, | 662 int h, |
| 760 bool draw_bottom, | 663 bool draw_bottom, |
| 761 SkColor color, | 664 SkColor color, |
| 762 gfx::Canvas* canvas) const { | 665 gfx::Canvas* canvas) const { |
| 763 x -= kClientEdgeThickness; | 666 x -= kClientEdgeThickness; |
| 764 gfx::Rect side(x, y, kClientEdgeThickness, h); | 667 gfx::Rect side(x, y, kClientEdgeThickness, h); |
| 765 canvas->FillRect(side, color); | 668 canvas->FillRect(side, color); |
| 766 if (draw_bottom) { | 669 if (draw_bottom) { |
| 767 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), | 670 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), |
| 768 kClientEdgeThickness), | 671 kClientEdgeThickness), |
| 769 color); | 672 color); |
| 770 } | 673 } |
| 771 side.Offset(w + kClientEdgeThickness, 0); | 674 side.Offset(w + kClientEdgeThickness, 0); |
| 772 canvas->FillRect(side, color); | 675 canvas->FillRect(side, color); |
| 773 } | 676 } |
| OLD | NEW |