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 <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 | 491 |
| 492 Windows10CaptionButton* GlassBrowserFrameView::CreateCaptionButton( | 492 Windows10CaptionButton* GlassBrowserFrameView::CreateCaptionButton( |
| 493 ViewID button_type) { | 493 ViewID button_type) { |
| 494 Windows10CaptionButton* button = | 494 Windows10CaptionButton* button = |
| 495 new Windows10CaptionButton(this, button_type); | 495 new Windows10CaptionButton(this, button_type); |
| 496 AddChildView(button); | 496 AddChildView(button); |
| 497 return button; | 497 return button; |
| 498 } | 498 } |
| 499 | 499 |
| 500 void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const { | 500 void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const { |
| 501 // This color is the same as Edge uses and closely matches the appearance of | |
| 502 // an inactive activation border. | |
| 503 SkColor inactive_border_color = 0xFFA1A1A1; | |
|
Peter Kasting
2016/10/01 05:00:14
Can't hardcode this. It works for Edge because th
Bret
2016/10/01 19:53:08
I actually think the inactive border color is fixe
Peter Kasting
2016/10/01 20:53:03
I think you're right: my normal inactive border co
| |
| 501 SkColor frame_color = 0xFFCCCCCC; | 504 SkColor frame_color = 0xFFCCCCCC; |
| 502 gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view()->tabstrip()); | 505 gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view()->tabstrip()); |
| 503 | 506 |
| 504 gfx::ScopedCanvas scoped_canvas(canvas); | 507 gfx::ScopedCanvas scoped_canvas(canvas); |
| 505 float scale = canvas->UndoDeviceScaleFactor(); | 508 float scale = canvas->UndoDeviceScaleFactor(); |
| 506 // This is the pixel-accurate version of WindowTopY(). Scaling the DIP values | 509 // This is the pixel-accurate version of WindowTopY(). Scaling the DIP values |
| 507 // here compounds precision error, which exposes the native Windows caption | 510 // here compounds precision error, which exposes the native Windows caption |
| 508 // buttons we need to draw over. (see the comment in | 511 // buttons we need to draw over. (see the comment in |
| 509 // BrowserDesktopWindowTreeHostWin::UpdateDWMFrame()). | 512 // BrowserDesktopWindowTreeHostWin::UpdateDWMFrame()). |
| 510 const int y = IsMaximized() ? FrameTopBorderThicknessPx(false) : 1; | 513 const int y = IsMaximized() ? FrameTopBorderThicknessPx(false) : 1; |
| 511 SkPaint paint; | 514 SkPaint paint; |
| 515 paint.setColor( | |
| 516 ShouldPaintAsActive() | |
| 517 ? GetThemeProvider()->GetColor(ThemeProperties::COLOR_FRAME) | |
|
Bret
2016/10/01 19:53:08
This is the wrong color for the border. A good tes
Peter Kasting
2016/10/01 20:53:02
In other words:
color_utils::AlphaBlend(Coloriz
Bret
2016/10/01 21:43:10
Ah yes, I never actually tried to write it into Ch
| |
| 518 : inactive_border_color); | |
| 519 canvas->DrawRect(gfx::RectF(0, 0, width() * scale, y), paint); | |
|
Peter Kasting
2016/10/01 05:00:14
If we want to do this, we need justification in th
Bret
2016/10/01 19:53:08
It's definitely impossible. With the insight that
Peter Kasting
2016/10/01 20:53:03
"Have to be rewritten" like, out of scope for this
Bret
2016/10/01 21:43:10
The latter, definitely the latter.
| |
| 512 paint.setColor(frame_color); | 520 paint.setColor(frame_color); |
| 513 canvas->DrawRect( | 521 canvas->DrawRect( |
| 514 gfx::RectF(0, y, width() * scale, tabstrip_bounds.bottom() * scale - y), | 522 gfx::RectF(0, y, width() * scale, tabstrip_bounds.bottom() * scale - y), |
| 515 paint); | 523 paint); |
| 516 | |
| 517 // The 1 pixel line at the top is drawn by Windows when we leave that section | |
| 518 // of the window blank because we have called DwmExtendFrameIntoClientArea() | |
| 519 // inside BrowserDesktopWindowTreeHostWin::UpdateDWMFrame(). | |
| 520 } | 524 } |
| 521 | 525 |
| 522 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { | 526 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { |
| 523 // TODO(estade): can this be shared with OpaqueBrowserFrameView? | 527 // TODO(estade): can this be shared with OpaqueBrowserFrameView? |
| 524 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 528 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 525 if (toolbar_bounds.IsEmpty()) | 529 if (toolbar_bounds.IsEmpty()) |
| 526 return; | 530 return; |
| 527 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 531 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 528 ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 532 ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| 529 toolbar_bounds.set_origin(toolbar_origin); | 533 toolbar_bounds.set_origin(toolbar_origin); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 static bool initialized = false; | 779 static bool initialized = false; |
| 776 if (!initialized) { | 780 if (!initialized) { |
| 777 for (int i = 0; i < kThrobberIconCount; ++i) { | 781 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 778 throbber_icons_[i] = | 782 throbber_icons_[i] = |
| 779 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 783 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 780 DCHECK(throbber_icons_[i]); | 784 DCHECK(throbber_icons_[i]); |
| 781 } | 785 } |
| 782 initialized = true; | 786 initialized = true; |
| 783 } | 787 } |
| 784 } | 788 } |
| OLD | NEW |