Index: chrome/browser/themes/theme_service_win.cc |
diff --git a/chrome/browser/themes/theme_service_win.cc b/chrome/browser/themes/theme_service_win.cc |
index defcb6368baabda0a2c2e3c8fdf53e61935b6692..52890c3da7ea3f739cf0dd238c44a6680446a52e 100644 |
--- a/chrome/browser/themes/theme_service_win.cc |
+++ b/chrome/browser/themes/theme_service_win.cc |
@@ -43,12 +43,28 @@ SkColor ThemeServiceWin::GetDefaultColor(int id, bool incognito) const { |
if (id == ThemeProperties::COLOR_ACCENT_BORDER) |
return dwm_accent_border_color_; |
- if (use_dwm_frame_color_) { |
- // Incognito frame is the same as normal when we're using DWM colors. |
- if (id == ThemeProperties::COLOR_FRAME) |
+ // When we're custom-drawing the titlebar we want to use either the colors |
+ // we calculated in OnDwmKeyUpdated() or the default colors. When we're not |
+ // custom-drawing the titlebar we want to match the color Windows actually |
+ // uses because some things (like the incognito icon) use this color to |
+ // decide whether they should draw in light or dark mode. Incognito colors |
+ // should be the same as non-incognito in all cases here. |
+ if (id == ThemeProperties::COLOR_FRAME) { |
+ if (use_dwm_frame_color_) |
return dwm_frame_color_; |
- if (id == ThemeProperties::COLOR_FRAME_INACTIVE) |
+ if (!ShouldCustomDrawSystemTitlebar()) |
+ return SK_ColorWHITE; |
+ // Fallthrough and use default. |
Evan Stade
2016/12/29 16:34:07
nit: "Fall through"
Bret
2017/01/03 22:49:53
Done.
|
+ } |
+ if (id == ThemeProperties::COLOR_FRAME_INACTIVE) { |
+ if (!ShouldCustomDrawSystemTitlebar()) { |
+ if (inactive_frame_color_from_registry_) |
Evan Stade
2016/12/29 16:34:07
nit: ternary?
Bret
2017/01/03 22:49:53
Done.
|
+ return dwm_inactive_frame_color_; |
+ return SK_ColorWHITE; |
+ } |
+ if (use_dwm_frame_color_) |
return dwm_inactive_frame_color_; |
+ // Fallthrough and use default. |
} |
} |
@@ -67,6 +83,7 @@ void ThemeServiceWin::OnDwmKeyUpdated() { |
dwm_key_->ReadValueDW(L"ColorPrevalence", &color_prevalence) == |
ERROR_SUCCESS && |
color_prevalence == 1; |
+ inactive_frame_color_from_registry_ = false; |
if (use_dwm_frame_color_) { |
dwm_frame_color_ = skia::COLORREFToSkColor(accent_color); |
DWORD accent_color_inactive; |
@@ -74,6 +91,7 @@ void ThemeServiceWin::OnDwmKeyUpdated() { |
ERROR_SUCCESS) { |
dwm_inactive_frame_color_ = |
skia::COLORREFToSkColor(accent_color_inactive); |
+ inactive_frame_color_from_registry_ = true; |
} else { |
// Tint to create inactive color. Always use the non-incognito version of |
// the tint, since the frame should look the same in both modes. |