Commit 7afb4f39 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Tint background tabs like the frame by default in refresh.

This means themes which do not set a background tab tint or image will get
background tabs that blend into the frame, just like the default theme.

Bug: 866672
Change-Id: I9ad1544f6fbc3b6bcc134312fab329d7f4554694
Reviewed-on: https://chromium-review.googlesource.com/1152522
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578935}
parent 7a680366
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
namespace { namespace {
using MD = ui::MaterialDesignController;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Defaults for properties which are stored in the browser theme pack. If you // Defaults for properties which are stored in the browser theme pack. If you
// change these defaults, you must increment the version number in // change these defaults, you must increment the version number in
...@@ -90,7 +92,8 @@ constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1}; ...@@ -90,7 +92,8 @@ constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1};
constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.75}; constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.75};
constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35}; constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35};
constexpr color_utils::HSL kDefaultTintFrameIncognitoInactive = {-1, 0.3, 0.6}; constexpr color_utils::HSL kDefaultTintFrameIncognitoInactive = {-1, 0.3, 0.6};
constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75}; constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, -1};
constexpr color_utils::HSL kPreRefreshDefaultTintBackgroundTab = {-1, -1, 0.75};
constexpr SkColor kDefaultColorTabAlertRecordingIcon = constexpr SkColor kDefaultColorTabAlertRecordingIcon =
SkColorSetRGB(0xC5, 0x39, 0x29); SkColorSetRGB(0xC5, 0x39, 0x29);
...@@ -147,7 +150,7 @@ constexpr char kTilingRepeat[] = "repeat"; ...@@ -147,7 +150,7 @@ constexpr char kTilingRepeat[] = "repeat";
// touch-optimized UI). // touch-optimized UI).
base::Optional<SkColor> MaybeGetDefaultColorForNewerMaterialUi(int id, base::Optional<SkColor> MaybeGetDefaultColorForNewerMaterialUi(int id,
bool incognito) { bool incognito) {
if (!ui::MaterialDesignController::IsNewerMaterialUi()) if (!MD::IsNewerMaterialUi())
return base::nullopt; return base::nullopt;
switch (id) { switch (id) {
...@@ -264,11 +267,13 @@ color_utils::HSL ThemeProperties::GetDefaultTint(int id, bool incognito) { ...@@ -264,11 +267,13 @@ color_utils::HSL ThemeProperties::GetDefaultTint(int id, bool incognito) {
return incognito ? kDefaultTintFrameIncognitoInactive return incognito ? kDefaultTintFrameIncognitoInactive
: kDefaultTintFrameInactive; : kDefaultTintFrameInactive;
case TINT_BUTTONS: case TINT_BUTTONS:
if (incognito && !ui::MaterialDesignController::IsRefreshUi()) if (!incognito)
return kPreRefreshDefaultTintButtonsIncognito; return kDefaultTintButtons;
return incognito ? kDefaultTintButtonsIncognito : kDefaultTintButtons; return MD::IsRefreshUi() ? kDefaultTintButtonsIncognito
: kPreRefreshDefaultTintButtonsIncognito;
case TINT_BACKGROUND_TAB: case TINT_BACKGROUND_TAB:
return kDefaultTintBackgroundTab; return MD::IsRefreshUi() ? kDefaultTintBackgroundTab
: kPreRefreshDefaultTintBackgroundTab;
case TINT_FRAME_INCOGNITO: case TINT_FRAME_INCOGNITO:
case TINT_FRAME_INCOGNITO_INACTIVE: case TINT_FRAME_INCOGNITO_INACTIVE:
NOTREACHED() << "These values should be queried via their respective " NOTREACHED() << "These values should be queried via their respective "
......
...@@ -109,7 +109,7 @@ gfx::ImageSkia BrowserNonClientFrameView::GetIncognitoAvatarIcon() const { ...@@ -109,7 +109,7 @@ gfx::ImageSkia BrowserNonClientFrameView::GetIncognitoAvatarIcon() const {
} }
SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const { SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const {
const auto color_id = const int color_id =
ShouldPaintAsActive() ShouldPaintAsActive()
? ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR ? ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR
: ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE; : ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE;
...@@ -137,7 +137,9 @@ SkColor BrowserNonClientFrameView::GetTabBackgroundColor(TabState state) const { ...@@ -137,7 +137,9 @@ SkColor BrowserNonClientFrameView::GetTabBackgroundColor(TabState state) const {
// color instead of COLOR_BACKGROUND_TAB; these will differ for single-tab // color instead of COLOR_BACKGROUND_TAB; these will differ for single-tab
// mode and custom window frame colors. // mode and custom window frame colors.
return (MD::IsRefreshUi() && !tp->HasCustomColor(color_id)) return (MD::IsRefreshUi() && !tp->HasCustomColor(color_id))
? GetFrameColor() ? color_utils::HSLShift(
GetFrameColor(),
tp->GetTint(ThemeProperties::TINT_BACKGROUND_TAB))
: GetThemeOrDefaultColor(color_id); : GetThemeOrDefaultColor(color_id);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment