Commit 895dd464 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Use bubble footer color for sync container background

After [1], the sync info container now respects the GTK theme.
However, this exposed an issue when using the Ambiance theme
(default on Ubuntu), where the sync info container appeared
dark on a light popup window.  This was caused by Ambiance using
light popups, but dark menus.

The simple fix is to use BubbleFooterBackground instead of
HighlightedMenuItemBackgroundColor.  These colors are both
SkColorSetRGB(0x32, 0x36, 0x39) in the dark theme and
gfx::kGoogleGrey050 in the light theme.  It's also makes
more logical sense to use a "Bubble" color rather than a
"MenuItem" color here anyway.

[1] https://crrev.com/744759

R=pkasting

Bug: 1056594
Change-Id: I3efb17c11bd383a84287efc1d420a12ad917a537
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080711
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746890}
parent 3c9b25b8
......@@ -779,23 +779,21 @@ void ProfileMenuViewBase::RegisterClickAction(views::View* clickable_view,
void ProfileMenuViewBase::UpdateSyncInfoContainerBackground() {
ui::NativeTheme::ColorId bg_color;
SkAlpha alpha = 16;
switch (sync_background_state_) {
case SyncInfoContainerBackgroundState::kNoError:
sync_info_container_->SetBackground(nullptr);
return;
case SyncInfoContainerBackgroundState::kPaused:
bg_color = ui::NativeTheme::kColorId_ProminentButtonColor;
bg_color = ui::NativeTheme::kColorId_SyncInfoContainerPaused;
break;
case SyncInfoContainerBackgroundState::kError:
bg_color = ui::NativeTheme::kColorId_AlertSeverityHigh;
bg_color = ui::NativeTheme::kColorId_SyncInfoContainerError;
break;
case SyncInfoContainerBackgroundState::kNoPrimaryAccount:
bg_color = ui::NativeTheme::kColorId_HighlightedMenuItemBackgroundColor;
alpha = SK_AlphaOPAQUE;
bg_color = ui::NativeTheme::kColorId_SyncInfoContainerNoPrimaryAccount;
}
sync_info_container_->SetBackground(views::CreateRoundedRectBackground(
SkColorSetA(GetNativeTheme()->GetSystemColor(bg_color), alpha),
GetNativeTheme()->GetSystemColor(bg_color),
views::LayoutProvider::Get()->GetCornerRadiusMetric(
views::EMPHASIS_HIGH)));
}
......
......@@ -479,6 +479,19 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
case NativeTheme::kColorId_DefaultIconColor:
return gfx::kGoogleGrey700;
// Sync info container
case NativeTheme::kColorId_SyncInfoContainerPaused:
return SkColorSetA(base_theme->GetSystemColor(
NativeTheme::kColorId_ProminentButtonColor),
16);
case NativeTheme::kColorId_SyncInfoContainerError:
return SkColorSetA(
base_theme->GetSystemColor(NativeTheme::kColorId_AlertSeverityHigh),
16);
case NativeTheme::kColorId_SyncInfoContainerNoPrimaryAccount:
return base_theme->GetSystemColor(
NativeTheme::kColorId_BubbleFooterBackground);
case NativeTheme::kColorId_NumColors:
break;
}
......
......@@ -75,6 +75,10 @@
OP(kColorId_SliderTroughMinimal), \
/* Separator */ \
OP(kColorId_SeparatorColor), \
/* Sync info container */ \
OP(kColorId_SyncInfoContainerPaused), \
OP(kColorId_SyncInfoContainerError), \
OP(kColorId_SyncInfoContainerNoPrimaryAccount), \
/* TabbedPane */ \
OP(kColorId_TabTitleColorActive), \
OP(kColorId_TabTitleColorInactive), \
......@@ -122,6 +126,7 @@
OP(kColorId_AlertSeverityHigh), \
/* Colors for icons in secondary UI (content settings, help button, etc). */ \
OP(kColorId_DefaultIconColor)
// clang-format on
#endif // UI_NATIVE_THEME_NATIVE_THEME_COLOR_ID_H_
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