Chromium Code Reviews| 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/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 | 471 |
| 472 void GlassBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { | 472 void GlassBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { |
| 473 // Pre-Material Design, the client edge images start below the toolbar. In MD | 473 // Pre-Material Design, the client edge images start below the toolbar. In MD |
| 474 // the client edge images start at the top of the toolbar. | 474 // the client edge images start at the top of the toolbar. |
| 475 gfx::Rect client_bounds = CalculateClientAreaBounds(); | 475 gfx::Rect client_bounds = CalculateClientAreaBounds(); |
| 476 const int x = client_bounds.x(); | 476 const int x = client_bounds.x(); |
| 477 const bool md = ui::MaterialDesignController::IsModeMaterial(); | 477 const bool md = ui::MaterialDesignController::IsModeMaterial(); |
| 478 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 478 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 479 const int y = | 479 const int y = |
| 480 client_bounds.y() + (md ? toolbar_bounds.y() : toolbar_bounds.bottom()); | 480 client_bounds.y() + (md ? toolbar_bounds.y() : toolbar_bounds.bottom()); |
| 481 const int w = client_bounds.width(); | |
| 482 const int right = client_bounds.right(); | 481 const int right = client_bounds.right(); |
| 483 const int bottom = std::max(y, height() - ClientBorderThickness(false)); | 482 const int bottom = std::max(y, height() - ClientBorderThickness(false)); |
| 484 const int height = bottom - y; | |
| 485 | 483 |
| 486 // Draw the client edge images. For non-MD, we fill the toolbar color | 484 // Draw the client edge images. For non-MD, we fill the toolbar color |
| 487 // underneath these images so they will lighten/darken it appropriately to | 485 // underneath these images so they will lighten/darken it appropriately to |
| 488 // create a "3D shaded" effect. For MD, where we want a flatter appearance, | 486 // create a "3D shaded" effect. For MD, where we want a flatter appearance, |
| 489 // we do the filling afterwards so the user sees the unmodified toolbar color. | 487 // we do the filling afterwards so the user sees the unmodified toolbar color. |
| 490 const ui::ThemeProvider* tp = GetThemeProvider(); | 488 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 491 const SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); | 489 const SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| 492 if (!md) | 490 if (!md) |
| 493 FillClientEdgeRects(x, y, right, bottom, toolbar_color, canvas); | 491 FillClientEdgeRects(x, y, right, bottom, toolbar_color, canvas); |
| 494 const gfx::ImageSkia* const right_image = | 492 if (!md || (base::win::GetVersion() < base::win::VERSION_WIN10)) { |
|
Peter Kasting
2016/06/16 20:21:26
This isn't a visible behavior change, it just turn
| |
| 495 tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); | 493 const gfx::ImageSkia* const right_image = |
| 496 const int img_w = right_image->width(); | 494 tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); |
| 497 canvas->TileImageInt(*right_image, right, y, img_w, height); | 495 const int img_w = right_image->width(); |
| 498 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), | 496 const int height = bottom - y; |
| 499 right, bottom); | 497 canvas->TileImageInt(*right_image, right, y, img_w, height); |
| 500 const gfx::ImageSkia* const bottom_image = | 498 canvas->DrawImageInt( |
| 501 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); | 499 *tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), right, bottom); |
| 502 canvas->TileImageInt(*bottom_image, x, bottom, w, bottom_image->height()); | 500 const gfx::ImageSkia* const bottom_image = |
| 503 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), | 501 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); |
| 504 x - img_w, bottom); | 502 canvas->TileImageInt(*bottom_image, x, bottom, client_bounds.width(), |
| 505 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), x - img_w, | 503 bottom_image->height()); |
| 506 y, img_w, height); | 504 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), |
| 505 x - img_w, bottom); | |
| 506 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), | |
| 507 x - img_w, y, img_w, height); | |
| 508 } | |
| 507 if (md) | 509 if (md) |
| 508 FillClientEdgeRects(x, y, right, bottom, toolbar_color, canvas); | 510 FillClientEdgeRects(x, y, right, bottom, toolbar_color, canvas); |
| 509 } | 511 } |
| 510 | 512 |
| 511 void GlassBrowserFrameView::FillClientEdgeRects(int x, | 513 void GlassBrowserFrameView::FillClientEdgeRects(int x, |
| 512 int y, | 514 int y, |
| 513 int right, | 515 int right, |
| 514 int bottom, | 516 int bottom, |
| 515 SkColor color, | 517 SkColor color, |
| 516 gfx::Canvas* canvas) const { | 518 gfx::Canvas* canvas) const { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 static bool initialized = false; | 677 static bool initialized = false; |
| 676 if (!initialized) { | 678 if (!initialized) { |
| 677 for (int i = 0; i < kThrobberIconCount; ++i) { | 679 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 678 throbber_icons_[i] = | 680 throbber_icons_[i] = |
| 679 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 681 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 680 DCHECK(throbber_icons_[i]); | 682 DCHECK(throbber_icons_[i]); |
| 681 } | 683 } |
| 682 initialized = true; | 684 initialized = true; |
| 683 } | 685 } |
| 684 } | 686 } |
| OLD | NEW |