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 "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { | 353 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { |
354 ui::ThemeProvider* tp = GetThemeProvider(); | 354 ui::ThemeProvider* tp = GetThemeProvider(); |
355 | 355 |
356 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 356 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
357 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 357 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
358 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 358 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
359 toolbar_bounds.set_origin(toolbar_origin); | 359 toolbar_bounds.set_origin(toolbar_origin); |
360 int x = toolbar_bounds.x(); | 360 int x = toolbar_bounds.x(); |
361 int w = toolbar_bounds.width(); | 361 int w = toolbar_bounds.width(); |
362 | 362 |
| 363 const bool mode_material = ui::MaterialDesignController::IsModeMaterial(); |
| 364 |
363 gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); | 365 gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); |
364 gfx::ImageSkia* toolbar_center = tp->GetImageSkiaNamed( | 366 gfx::ImageSkia* toolbar_center = tp->GetImageSkiaNamed( |
365 IDR_CONTENT_TOP_CENTER); | 367 mode_material ? IDR_THEME_TOOLBAR : IDR_CONTENT_TOP_CENTER); |
366 | 368 |
367 // Tile the toolbar image starting at the frame edge on the left and where | 369 // Tile the toolbar image starting at the frame edge on the left and where |
368 // the tabstrip is on the top. | 370 // the tabstrip is on the top. |
369 int y = toolbar_bounds.y(); | 371 int y = toolbar_bounds.y(); |
370 int dest_y = browser_view()->IsTabStripVisible() | 372 int dest_y = browser_view()->IsTabStripVisible() |
371 ? y + (kFrameShadowThickness * 2) | 373 ? y + (kFrameShadowThickness * 2) |
372 : y; | 374 : y; |
373 canvas->TileImageInt(*theme_toolbar, | 375 canvas->TileImageInt(*theme_toolbar, |
374 x + GetThemeBackgroundXInset(), | 376 x + GetThemeBackgroundXInset(), |
375 dest_y - GetTopInset(), x, | 377 dest_y - GetTopInset(), x, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 toolbar_center->height()); | 413 toolbar_center->height()); |
412 | 414 |
413 // Right edge. | 415 // Right edge. |
414 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | 416 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), |
415 right_x, y); | 417 right_x, y); |
416 } else { | 418 } else { |
417 canvas->TileImageInt(*toolbar_center, x, y, w, toolbar_center->height()); | 419 canvas->TileImageInt(*toolbar_center, x, y, w, toolbar_center->height()); |
418 } | 420 } |
419 } | 421 } |
420 | 422 |
421 // Draw the content/toolbar separator. | 423 if (mode_material) { |
422 if (ui::MaterialDesignController::IsModeMaterial()) { | 424 // Draw the content/toolbar separator. |
423 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 425 toolbar_bounds.Inset(kClientEdgeThickness, 0); |
424 BrowserView::Paint1pxHorizontalLine( | 426 BrowserView::Paint1pxHorizontalLine( |
425 canvas, | 427 canvas, |
426 ThemeProperties::GetDefaultColor( | 428 ThemeProperties::GetDefaultColor( |
427 ThemeProperties::COLOR_TOOLBAR_SEPARATOR), | 429 ThemeProperties::COLOR_TOOLBAR_SEPARATOR), |
428 toolbar_bounds); | 430 toolbar_bounds); |
| 431 |
| 432 // Draw the tabstrip separator. |
| 433 BrowserView::Paint1pxHorizontalLine( |
| 434 canvas, |
| 435 ThemeProperties::GetDefaultColor( |
| 436 ThemeProperties::COLOR_TOOLBAR_SEPARATOR), |
| 437 gfx::RectF(0, toolbar_bounds.y() - 1, |
| 438 toolbar_bounds.width(), kClientEdgeThickness)); |
429 } else { | 439 } else { |
| 440 // Draw the content/toolbar separator. |
430 canvas->FillRect( | 441 canvas->FillRect( |
431 gfx::Rect(x + kClientEdgeThickness, | 442 gfx::Rect(x + kClientEdgeThickness, |
432 toolbar_bounds.bottom() - kClientEdgeThickness, | 443 toolbar_bounds.bottom() - kClientEdgeThickness, |
433 w - (2 * kClientEdgeThickness), | 444 w - (2 * kClientEdgeThickness), |
434 kClientEdgeThickness), | 445 kClientEdgeThickness), |
435 ThemeProperties::GetDefaultColor( | 446 ThemeProperties::GetDefaultColor( |
436 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 447 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
437 } | 448 } |
438 } | 449 } |
439 | 450 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 static bool initialized = false; | 645 static bool initialized = false; |
635 if (!initialized) { | 646 if (!initialized) { |
636 for (int i = 0; i < kThrobberIconCount; ++i) { | 647 for (int i = 0; i < kThrobberIconCount; ++i) { |
637 throbber_icons_[i] = | 648 throbber_icons_[i] = |
638 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 649 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
639 DCHECK(throbber_icons_[i]); | 650 DCHECK(throbber_icons_[i]); |
640 } | 651 } |
641 initialized = true; | 652 initialized = true; |
642 } | 653 } |
643 } | 654 } |
OLD | NEW |