Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_layout_constants.h" | 9 #include "ash/ash_layout_constants.h" |
| 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
| 23 #include "chrome/browser/ui/layout_constants.h" | 23 #include "chrome/browser/ui/layout_constants.h" |
| 24 #include "chrome/browser/ui/views/frame/browser_frame.h" | 24 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 25 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 25 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
| 26 #include "chrome/browser/ui/views/frame/browser_view.h" | 26 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 28 #include "chrome/browser/ui/views/frame/web_app_left_header_view_ash.h" | 28 #include "chrome/browser/ui/views/frame/web_app_left_header_view_ash.h" |
| 29 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 29 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 30 #include "chrome/browser/ui/views/tab_icon_view.h" | 30 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 31 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 31 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 32 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | |
| 32 #include "chrome/browser/web_applications/web_app.h" | 33 #include "chrome/browser/web_applications/web_app.h" |
| 33 #include "components/signin/core/common/profile_management_switches.h" | 34 #include "components/signin/core/common/profile_management_switches.h" |
| 34 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 35 #include "extensions/browser/extension_registry.h" | 36 #include "extensions/browser/extension_registry.h" |
| 36 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
| 37 #include "ui/accessibility/ax_view_state.h" | 38 #include "ui/accessibility/ax_view_state.h" |
| 38 #include "ui/aura/client/aura_constants.h" | 39 #include "ui/aura/client/aura_constants.h" |
| 39 #include "ui/aura/window.h" | 40 #include "ui/aura/window.h" |
| 40 #include "ui/base/hit_test.h" | 41 #include "ui/base/hit_test.h" |
| 41 #include "ui/base/layout.h" | 42 #include "ui/base/layout.h" |
| 42 #include "ui/base/material_design/material_design_controller.h" | 43 #include "ui/base/material_design/material_design_controller.h" |
| 43 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
| 44 #include "ui/base/theme_provider.h" | 45 #include "ui/base/theme_provider.h" |
| 45 #include "ui/compositor/layer_animator.h" | 46 #include "ui/compositor/layer_animator.h" |
| 46 #include "ui/gfx/canvas.h" | 47 #include "ui/gfx/canvas.h" |
| 47 #include "ui/gfx/geometry/rect_conversions.h" | 48 #include "ui/gfx/geometry/rect_conversions.h" |
| 48 #include "ui/gfx/image/image_skia.h" | 49 #include "ui/gfx/image/image_skia.h" |
| 49 #include "ui/gfx/scoped_canvas.h" | 50 #include "ui/gfx/scoped_canvas.h" |
| 50 #include "ui/views/controls/label.h" | 51 #include "ui/views/controls/label.h" |
| 51 #include "ui/views/layout/layout_constants.h" | 52 #include "ui/views/layout/layout_constants.h" |
| 52 #include "ui/views/widget/widget.h" | 53 #include "ui/views/widget/widget.h" |
| 53 #include "ui/views/widget/widget_delegate.h" | 54 #include "ui/views/widget/widget_delegate.h" |
| 54 | 55 |
| 55 namespace { | 56 namespace { |
| 56 | 57 |
| 57 // Space between right edge of tabstrip and maximize button. | 58 // Space between right edge of tabstrip and maximize button. |
| 58 const int kTabstripRightSpacing = 10; | 59 const int kTabstripRightSpacing = 10; |
| 60 // The content edge images have a shadow built into them. | |
| 61 const int kContentEdgeShadowThickness = 2; | |
| 59 // Height of the shadow of the content area, at the top of the toolbar. | 62 // Height of the shadow of the content area, at the top of the toolbar. |
| 60 const int kContentShadowHeight = 1; | 63 const int kContentShadowHeight = 1; |
| 61 // Space between top of window and top of tabstrip for tall headers, such as | 64 // Space between top of window and top of tabstrip for tall headers, such as |
| 62 // for restored windows, apps, etc. | 65 // for restored windows, apps, etc. |
| 63 const int kTabstripTopSpacingTall = 7; | 66 const int kTabstripTopSpacingTall = 7; |
| 64 // Space between top of window and top of tabstrip for short headers, such as | 67 // Space between top of window and top of tabstrip for short headers, such as |
| 65 // for maximized windows, pop-ups, etc. | 68 // for maximized windows, pop-ups, etc. |
| 66 const int kTabstripTopSpacingShort = 0; | 69 const int kTabstripTopSpacingShort = 0; |
| 67 // Height of the shadow in the tab image, used to ensure clicks in the shadow | 70 // Height of the shadow in the tab image, used to ensure clicks in the shadow |
| 68 // area still drag restored windows. This keeps the clickable area large enough | 71 // area still drag restored windows. This keeps the clickable area large enough |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 return ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored) ? | 185 return ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored) ? |
| 183 kTabstripTopSpacingShort : kTabstripTopSpacingTall; | 186 kTabstripTopSpacingShort : kTabstripTopSpacingTall; |
| 184 } | 187 } |
| 185 | 188 |
| 186 if (UsePackagedAppHeaderStyle() || UseWebAppHeaderStyle()) | 189 if (UsePackagedAppHeaderStyle() || UseWebAppHeaderStyle()) |
| 187 return header_painter_->GetHeaderHeight(); | 190 return header_painter_->GetHeaderHeight(); |
| 188 | 191 |
| 189 int caption_buttons_bottom = caption_button_container_->bounds().bottom(); | 192 int caption_buttons_bottom = caption_button_container_->bounds().bottom(); |
| 190 | 193 |
| 191 // The toolbar partially overlaps the caption buttons. | 194 // The toolbar partially overlaps the caption buttons. |
| 192 if (browser_view()->IsToolbarVisible()) | 195 if (IsToolbarVisible()) |
| 193 return caption_buttons_bottom - kContentShadowHeight; | 196 return caption_buttons_bottom; |
|
Evan Stade
2016/02/08 20:09:39
would this break non-MD?
tdanderson
2016/02/08 20:49:22
No it doesn't, since I've changed BrowserNonClient
| |
| 194 | 197 |
| 195 return caption_buttons_bottom + kClientEdgeThickness; | 198 return caption_buttons_bottom + kClientEdgeThickness; |
| 196 } | 199 } |
| 197 | 200 |
| 198 int BrowserNonClientFrameViewAsh::GetThemeBackgroundXInset() const { | 201 int BrowserNonClientFrameViewAsh::GetThemeBackgroundXInset() const { |
| 199 return ash::HeaderPainterUtil::GetThemeBackgroundXInset(); | 202 return ash::HeaderPainterUtil::GetThemeBackgroundXInset(); |
| 200 } | 203 } |
| 201 | 204 |
| 202 void BrowserNonClientFrameViewAsh::UpdateThrobber(bool running) { | 205 void BrowserNonClientFrameViewAsh::UpdateThrobber(bool running) { |
| 203 if (window_icon_) | 206 if (window_icon_) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 return; | 302 return; |
| 300 } | 303 } |
| 301 | 304 |
| 302 caption_button_container_->SetPaintAsActive(ShouldPaintAsActive()); | 305 caption_button_container_->SetPaintAsActive(ShouldPaintAsActive()); |
| 303 if (web_app_left_header_view_) | 306 if (web_app_left_header_view_) |
| 304 web_app_left_header_view_->SetPaintAsActive(ShouldPaintAsActive()); | 307 web_app_left_header_view_->SetPaintAsActive(ShouldPaintAsActive()); |
| 305 | 308 |
| 306 ash::HeaderPainter::Mode header_mode = ShouldPaintAsActive() ? | 309 ash::HeaderPainter::Mode header_mode = ShouldPaintAsActive() ? |
| 307 ash::HeaderPainter::MODE_ACTIVE : ash::HeaderPainter::MODE_INACTIVE; | 310 ash::HeaderPainter::MODE_ACTIVE : ash::HeaderPainter::MODE_INACTIVE; |
| 308 header_painter_->PaintHeader(canvas, header_mode); | 311 header_painter_->PaintHeader(canvas, header_mode); |
| 309 if (browser_view()->IsToolbarVisible()) | 312 |
| 313 if (IsToolbarVisible()) | |
| 310 PaintToolbarBackground(canvas); | 314 PaintToolbarBackground(canvas); |
| 311 else if (!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()) | 315 if (!browser_view()->IsTabStripVisible()) |
| 312 PaintContentEdge(canvas); | 316 PaintContentEdge(canvas); |
| 313 } | 317 } |
| 314 | 318 |
| 315 void BrowserNonClientFrameViewAsh::Layout() { | 319 void BrowserNonClientFrameViewAsh::Layout() { |
| 316 // The header must be laid out before computing |painted_height| because the | 320 // The header must be laid out before computing |painted_height| because the |
| 317 // computation of |painted_height| for app and popup windows depends on the | 321 // computation of |painted_height| for app and popup windows depends on the |
| 318 // position of the window controls. | 322 // position of the window controls. |
| 319 header_painter_->LayoutHeader(); | 323 header_painter_->LayoutHeader(); |
| 320 | 324 |
| 321 int painted_height = GetTopInset(false); | 325 int painted_height = GetTopInset(false); |
| 322 if (browser_view()->IsTabStripVisible()) { | 326 if (browser_view()->IsTabStripVisible()) |
| 323 painted_height += browser_view()->tabstrip()->GetPreferredSize().height(); | 327 painted_height += browser_view()->tabstrip()->GetPreferredSize().height(); |
| 324 } else if (browser_view()->IsToolbarVisible()) { | 328 |
| 325 // Paint the header so that it overlaps with the top few pixels of the | |
| 326 // toolbar because the top few pixels of the toolbar are not opaque. | |
| 327 const int kToolbarTopEdgeExclusion = 2; | |
| 328 painted_height += kToolbarTopEdgeExclusion; | |
| 329 } | |
| 330 header_painter_->SetHeaderHeightForPainting(painted_height); | 329 header_painter_->SetHeaderHeightForPainting(painted_height); |
| 331 | 330 |
| 332 if (avatar_button()) { | 331 if (avatar_button()) { |
| 333 LayoutAvatar(); | 332 LayoutAvatar(); |
| 334 header_painter_->UpdateLeftViewXInset(avatar_button()->bounds().right()); | 333 header_painter_->UpdateLeftViewXInset(avatar_button()->bounds().right()); |
| 335 } | 334 } |
| 336 header_painter_->UpdateLeftViewXInset( | 335 header_painter_->UpdateLeftViewXInset( |
| 337 ash::HeaderPainterUtil::GetDefaultLeftViewXInset()); | 336 ash::HeaderPainterUtil::GetDefaultLeftViewXInset()); |
| 338 BrowserNonClientFrameView::Layout(); | 337 BrowserNonClientFrameView::Layout(); |
| 339 } | 338 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 } | 533 } |
| 535 | 534 |
| 536 void BrowserNonClientFrameViewAsh::PaintImmersiveLightbarStyleHeader( | 535 void BrowserNonClientFrameViewAsh::PaintImmersiveLightbarStyleHeader( |
| 537 gfx::Canvas* canvas) { | 536 gfx::Canvas* canvas) { |
| 538 // The light bar header is not themed because theming it does not look good. | 537 // The light bar header is not themed because theming it does not look good. |
| 539 canvas->FillRect( | 538 canvas->FillRect( |
| 540 gfx::Rect(width(), header_painter_->GetHeaderHeightForPainting()), | 539 gfx::Rect(width(), header_painter_->GetHeaderHeightForPainting()), |
| 541 SK_ColorBLACK); | 540 SK_ColorBLACK); |
| 542 } | 541 } |
| 543 | 542 |
| 543 bool BrowserNonClientFrameViewAsh::IsToolbarVisible() const { | |
| 544 return browser_view()->IsToolbarVisible() && | |
| 545 !browser_view()->toolbar()->GetPreferredSize().IsEmpty(); | |
| 546 } | |
| 547 | |
| 544 void BrowserNonClientFrameViewAsh::PaintToolbarBackground(gfx::Canvas* canvas) { | 548 void BrowserNonClientFrameViewAsh::PaintToolbarBackground(gfx::Canvas* canvas) { |
| 545 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 549 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 546 if (toolbar_bounds.IsEmpty()) | 550 if (toolbar_bounds.IsEmpty()) |
| 547 return; | 551 return; |
| 548 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 552 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 549 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 553 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| 550 toolbar_bounds.set_origin(toolbar_origin); | 554 toolbar_bounds.set_origin(toolbar_origin); |
| 555 const int h = toolbar_bounds.height(); | |
| 556 const bool md = ui::MaterialDesignController::IsModeMaterial(); | |
| 557 const ui::ThemeProvider* tp = GetThemeProvider(); | |
| 558 const SkColor separator_color = | |
| 559 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); | |
| 551 | 560 |
| 552 int x = toolbar_bounds.x(); | 561 if (browser_view()->IsTabStripVisible()) { |
| 553 int w = toolbar_bounds.width(); | 562 gfx::ImageSkia* bg = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); |
| 554 int y = toolbar_bounds.y(); | 563 int x = toolbar_bounds.x(); |
| 555 int h = toolbar_bounds.height(); | 564 const int y = toolbar_bounds.y(); |
| 556 const ui::ThemeProvider* tp = GetThemeProvider(); | 565 const int bg_y = |
| 566 GetTopInset(false) + Tab::GetYInsetForActiveTabBackground(); | |
| 567 const int w = toolbar_bounds.width(); | |
| 557 | 568 |
| 558 if (ui::MaterialDesignController::IsModeMaterial()) { | 569 if (md) { |
| 559 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { | 570 // Background. The top stroke is drawn above the toolbar bounds, so |
| 560 // Paint the main toolbar image. Since this image is also used to draw | 571 // unlike in the non-Material Design code below, we don't need to exclude |
| 561 // the tab background, we must use the tab strip offset to compute the | 572 // any region from having the background image drawn over it. |
| 562 // image source y position. If you have to debug this code use an image | 573 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { |
| 563 // editor to paint a diagonal line through the toolbar image and ensure it | 574 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), y - bg_y, x, |
| 564 // lines up across the tab and toolbar. | 575 y, w, h); |
| 565 gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); | 576 } else { |
| 566 canvas->TileImageInt(*theme_toolbar, x + GetThemeBackgroundXInset(), | 577 canvas->FillRect(toolbar_bounds, |
| 567 y - GetTopInset(false), x, y, w, | 578 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); |
| 568 theme_toolbar->height()); | 579 } |
| 569 } else { | |
| 570 canvas->FillRect(toolbar_bounds, | |
| 571 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); | |
| 572 } | |
| 573 | 580 |
| 574 // Draw the separator line atop the toolbar, on the left and right of the | 581 // Top stroke. |
| 575 // tabstrip. | |
| 576 // TODO(tdanderson): Draw the separator line for non-tabbed windows. | |
| 577 if (browser_view()->IsTabStripVisible()) { | |
| 578 gfx::Rect separator_rect(x, y, w, 0); | 582 gfx::Rect separator_rect(x, y, w, 0); |
| 579 gfx::ScopedCanvas scoped_canvas(canvas); | 583 gfx::ScopedCanvas scoped_canvas(canvas); |
| 580 gfx::Rect tabstrip_bounds( | 584 gfx::Rect tabstrip_bounds( |
| 581 GetBoundsForTabStrip(browser_view()->tabstrip())); | 585 GetBoundsForTabStrip(browser_view()->tabstrip())); |
| 582 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); | 586 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); |
| 583 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), | 587 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), |
| 584 SkRegion::kDifference_Op); | 588 SkRegion::kDifference_Op); |
| 585 separator_rect.set_y(tabstrip_bounds.bottom()); | 589 separator_rect.set_y(tabstrip_bounds.bottom()); |
| 586 BrowserView::Paint1pxHorizontalLine( | 590 BrowserView::Paint1pxHorizontalLine( |
| 587 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), | 591 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), |
| 588 separator_rect, true); | 592 separator_rect, true); |
| 593 } else { | |
| 594 // Background. | |
| 595 const int split_point = kContentEdgeShadowThickness; | |
| 596 const int split_y = y + split_point; | |
| 597 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), split_y - bg_y, | |
| 598 x, split_y, w, bg->height()); | |
| 599 | |
| 600 // The pre-material design content area line has a shadow that extends a | |
| 601 // couple of pixels above the toolbar bounds. | |
|
Peter Kasting
2016/02/10 02:43:58
The code in this section still doesn't make sense,
tdanderson
2016/02/10 18:22:30
OK, once this CL lands I will build the other CL a
Peter Kasting
2016/02/10 23:46:21
I wouldn't wait for this CL to land -- that CL is
tdanderson
2016/02/11 16:10:21
Acknowledged.
| |
| 602 gfx::ImageSkia* toolbar_top = | |
| 603 tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_TOP); | |
| 604 canvas->TileImageInt(*toolbar_top, 0, 0, x, | |
| 605 y - kContentEdgeShadowThickness, w, | |
| 606 toolbar_top->height()); | |
| 607 | |
| 608 // Draw the "lightening" shade line around the edges of the toolbar. | |
| 609 gfx::ImageSkia* toolbar_left = | |
| 610 tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_LEFT); | |
| 611 canvas->TileImageInt( | |
| 612 *toolbar_left, 0, 0, x + kClientEdgeThickness, | |
| 613 y + kClientEdgeThickness + kContentEdgeShadowThickness, | |
| 614 toolbar_left->width(), bg->height()); | |
| 615 gfx::ImageSkia* toolbar_right = | |
| 616 tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_RIGHT); | |
| 617 canvas->TileImageInt( | |
| 618 *toolbar_right, 0, 0, | |
| 619 w - toolbar_right->width() - 2 * kClientEdgeThickness, | |
| 620 y + kClientEdgeThickness + kContentEdgeShadowThickness, | |
| 621 toolbar_right->width(), bg->height()); | |
| 589 } | 622 } |
| 623 } | |
| 590 | 624 |
| 591 // Draw the content/toolbar separator. | 625 // Draw the toolbar/content separator. |
| 592 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 626 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, |
| 593 BrowserView::Paint1pxHorizontalLine( | 627 kClientEdgeThickness, 0); |
| 594 canvas, | 628 if (md) { |
| 595 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), | 629 BrowserView::Paint1pxHorizontalLine(canvas, separator_color, |
| 596 toolbar_bounds, true); | 630 toolbar_bounds, true); |
| 597 } else { | 631 } else { |
| 598 // Gross hack: We split the toolbar images into two pieces, since sometimes | 632 canvas->FillRect(toolbar_bounds, separator_color); |
| 599 // (popup mode) the toolbar isn't tall enough to show the whole image. The | |
| 600 // split happens between the top shadow section and the bottom gradient | |
| 601 // section so that we never break the gradient. | |
| 602 // NOTE(pkotwicz): If the computation for |bottom_y| is changed, Layout() | |
| 603 // must be changed as well. | |
| 604 int split_point = kFrameShadowThickness * 2; | |
| 605 int bottom_y = y + split_point; | |
| 606 int bottom_edge_height = h - split_point; | |
| 607 | |
| 608 canvas->FillRect(gfx::Rect(x, bottom_y, w, bottom_edge_height), | |
| 609 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); | |
| 610 | |
| 611 // Paint the main toolbar image. Since this image is also used to draw the | |
| 612 // tab background, we must use the tab strip offset to compute the image | |
| 613 // source y position. If you have to debug this code use an image editor | |
| 614 // to paint a diagonal line through the toolbar image and ensure it lines up | |
| 615 // across the tab and toolbar. | |
| 616 gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); | |
| 617 canvas->TileImageInt( | |
| 618 *theme_toolbar, | |
| 619 x + GetThemeBackgroundXInset(), | |
| 620 bottom_y - GetTopInset(false), | |
| 621 x, bottom_y, | |
| 622 w, theme_toolbar->height()); | |
| 623 | |
| 624 // The pre-material design content area line has a shadow that extends a | |
| 625 // couple of pixels above the toolbar bounds. | |
| 626 const int kContentShadowHeight = 2; | |
| 627 gfx::ImageSkia* toolbar_top = tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_TOP); | |
| 628 canvas->TileImageInt(*toolbar_top, | |
| 629 0, 0, | |
| 630 x, y - kContentShadowHeight, | |
| 631 w, split_point + kContentShadowHeight + 1); | |
| 632 | |
| 633 // Draw the "lightening" shade line around the edges of the toolbar. | |
| 634 gfx::ImageSkia* toolbar_left = | |
| 635 tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_LEFT); | |
| 636 canvas->TileImageInt(*toolbar_left, | |
| 637 0, 0, | |
| 638 x + kClientEdgeThickness, | |
| 639 y + kClientEdgeThickness + kContentShadowHeight, | |
| 640 toolbar_left->width(), theme_toolbar->height()); | |
| 641 gfx::ImageSkia* toolbar_right = | |
| 642 tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_RIGHT); | |
| 643 canvas->TileImageInt(*toolbar_right, | |
| 644 0, 0, | |
| 645 w - toolbar_right->width() - 2 * kClientEdgeThickness, | |
| 646 y + kClientEdgeThickness + kContentShadowHeight, | |
| 647 toolbar_right->width(), theme_toolbar->height()); | |
| 648 | |
| 649 // Draw the content/toolbar separator. | |
| 650 canvas->FillRect( | |
| 651 gfx::Rect(x + kClientEdgeThickness, | |
| 652 toolbar_bounds.bottom() - kClientEdgeThickness, | |
| 653 w - (2 * kClientEdgeThickness), kClientEdgeThickness), | |
| 654 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | |
| 655 } | 633 } |
| 656 } | 634 } |
| 657 | 635 |
| 658 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 636 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 659 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 637 // The content separator is drawn by DefaultHeaderPainter in these cases. |
| 660 canvas->FillRect( | 638 if (UsePackagedAppHeaderStyle() || UseWebAppHeaderStyle()) |
| 661 gfx::Rect(0, caption_button_container_->bounds().bottom(), width(), | 639 return; |
| 662 kClientEdgeThickness), | 640 |
| 641 gfx::Rect separator_rect( | |
| 642 0, caption_button_container_->bounds().bottom(), width(), 0); | |
| 643 BrowserView::Paint1pxHorizontalLine( | |
| 644 canvas, | |
| 663 GetThemeProvider()->GetColor( | 645 GetThemeProvider()->GetColor( |
| 664 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 646 ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR), |
| 647 separator_rect, true); | |
| 665 } | 648 } |
| OLD | NEW |