Commit 2c08ec78 authored by minch's avatar minch Committed by Commit Bot

dark_mode: Get system tray buttons' color from AshColorProvider.

Bug: 982950
Change-Id: I8a0b77bfcbe4142aad80f7f0ad63eb9203ba567b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762416
Commit-Queue: Min Chen <minch@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688729}
parent 7e64654a
......@@ -22,6 +22,9 @@ constexpr SkColor kUnifiedMenuBackgroundColorWithBlur =
constexpr SkColor kNotificationBackgroundColor = SK_ColorWHITE;
constexpr SkColor kUnifiedMenuTextColor = gfx::kGoogleGrey100;
constexpr SkColor kUnifiedMenuButtonColor =
SkColorSetA(gfx::kGoogleGrey200, 0x14);
constexpr SkColor kUnifiedMenuButtonColorActive = gfx::kGoogleBlueDark600;
//----------------------------------End----------------------------------------
......
......@@ -9,8 +9,8 @@
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/accessibility/autoclick_menu_bubble_controller.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/unified/custom_shape_button.h"
#include "ash/system/unified/top_shortcut_button.h"
#include "base/macros.h"
......@@ -32,14 +32,20 @@ using AshColorMode = AshColorProvider::AshColorMode;
namespace {
// Constants for color, size and position.
constexpr SkColor kScrollpadActiveColor =
SkColorSetA(kUnifiedMenuButtonColor, 0x29);
// Constants for size and position.
constexpr int kScrollButtonCloseSizeDips = 48;
constexpr int kScrollpadStrokeWidthDips = 2;
constexpr int kScrollPadButtonHypotenuseDips = 192;
constexpr int kScrollPadIconPadding = 30;
// TODO(crbug.com/982950): Get color from AshColorProvider::GetRippleAttributes
// instead.
SkColor HoveredButtonColor() {
return AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
SkColorSetA(kUnifiedMenuButtonColor, 0x29));
}
} // namespace
// The close button for the automatic clicks scroll bubble.
......@@ -95,7 +101,7 @@ class AutoclickScrollCloseButton : public TopShortcutButton,
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setColor(kScrollpadActiveColor);
flags.setColor(HoveredButtonColor());
canvas->DrawCircle(gfx::PointF(rect.CenterPoint()),
kScrollButtonCloseSizeDips / 2, flags);
}
......@@ -254,7 +260,7 @@ class AutoclickScrollButton : public CustomShapeButton,
flags.setAntiAlias(true);
if (active_) {
flags.setColor(kScrollpadActiveColor);
flags.setColor(HoveredButtonColor());
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawPath(CreateCustomShapePath(rect), flags);
}
......
......@@ -7,8 +7,8 @@
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/audio/unified_volume_slider_controller.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "base/i18n/rtl.h"
......@@ -101,7 +101,9 @@ class MoreButton : public views::Button {
gfx::Rect rect(GetContentsBounds());
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(kUnifiedMenuButtonColor);
flags.setColor(AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor));
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawRoundRect(rect, kTrayItemSize / 2, flags);
}
......
......@@ -100,12 +100,6 @@ extern const int kTrayPopupInkDropInset;
extern const int kTrayPopupInkDropCornerRadius;
constexpr float kUnifiedMenuBackgroundBlur = 30.f;
constexpr SkColor kUnifiedMenuButtonColor =
SkColorSetA(gfx::kGoogleGrey200, 0x14);
constexpr SkColor kUnifiedMenuButtonColorActive =
SkColorSetRGB(0x25, 0x81, 0xdf);
constexpr SkColor kUnifiedMenuButtonColorDisabled =
SkColorSetA(kUnifiedMenuButtonColor, 0xa);
constexpr SkColor kUnifiedRecordingIconColor = gfx::kGoogleRed300;
constexpr gfx::Insets kUnifiedMenuItemPadding(0, 16, 16, 16);
......
......@@ -4,7 +4,8 @@
#include "ash/system/unified/custom_shape_button.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/style/ash_color_provider.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ui/compositor/paint_recorder.h"
......@@ -95,8 +96,13 @@ const char* CustomShapeButton::GetClassName() const {
void CustomShapeButton::PaintCustomShapePath(gfx::Canvas* canvas) {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(GetEnabled() ? kUnifiedMenuButtonColor
: kUnifiedMenuButtonColorDisabled);
const SkColor button_color =
AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor);
flags.setColor(GetEnabled()
? button_color
: AshColorProvider::Get()->GetDisabledColor(button_color));
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawPath(CreateCustomShapePath(GetLocalBounds()), flags);
......
......@@ -8,7 +8,6 @@
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/feature_pod_controller_base.h"
#include "ash/system/unified/unified_system_tray_view.h"
......@@ -66,12 +65,17 @@ void FeaturePodIconButton::PaintButtonContents(gfx::Canvas* canvas) {
cc::PaintFlags flags;
flags.setAntiAlias(true);
SkColor color = kUnifiedMenuButtonColor;
SkColor color = AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor);
if (GetEnabled()) {
if (toggled_)
color = kUnifiedMenuButtonColorActive;
if (toggled_) {
color = AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kActiveControlBackground,
kUnifiedMenuButtonColorActive);
}
} else {
color = kUnifiedMenuButtonColorDisabled;
color = AshColorProvider::Get()->GetDisabledColor(color);
}
flags.setColor(color);
......
......@@ -5,7 +5,6 @@
#include "ash/system/unified/notification_hidden_view.h"
#include "ash/login/login_screen_controller.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
......@@ -51,8 +50,11 @@ NotificationHiddenView::NotificationHiddenView() {
auto* container = new views::View;
container->SetBackground(views::CreateBackgroundFromPainter(
views::Painter::CreateSolidRoundRectPainter(kUnifiedMenuButtonColor,
kUnifiedTrayCornerRadius)));
views::Painter::CreateSolidRoundRectPainter(
AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor),
kUnifiedTrayCornerRadius)));
auto* layout = container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal));
......
......@@ -6,7 +6,6 @@
#include "ash/style/ash_color_provider.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ui/gfx/canvas.h"
......@@ -52,7 +51,9 @@ void RoundedLabelButton::PaintButtonContents(gfx::Canvas* canvas) {
gfx::Rect rect(GetContentsBounds());
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(kUnifiedMenuButtonColor);
flags.setColor(AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor));
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawRoundRect(rect, kTrayItemSize / 2, flags);
......
......@@ -5,7 +5,7 @@
#include "ash/system/unified/top_shortcut_button.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -71,7 +71,9 @@ gfx::Size TopShortcutButton::CalculatePreferredSize() const {
void TopShortcutButton::PaintButtonContents(gfx::Canvas* canvas) {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(kUnifiedMenuButtonColor);
flags.setColor(AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor));
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawPath(*GetProperty(views::kHighlightPathKey), flags);
......
......@@ -5,7 +5,7 @@
#include "ash/system/unified/unified_slider_view.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/style/default_color_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/top_shortcut_button.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -94,8 +94,14 @@ void UnifiedSliderButton::PaintButtonContents(gfx::Canvas* canvas) {
gfx::Rect rect(GetContentsBounds());
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(toggled_ ? kUnifiedMenuButtonColorActive
: kUnifiedMenuButtonColor);
flags.setColor(
toggled_
? AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kActiveControlBackground,
kUnifiedMenuButtonColorActive)
: AshColorProvider::Get()->DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
kUnifiedMenuButtonColor));
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawCircle(gfx::PointF(rect.CenterPoint()), kTrayItemSize / 2, flags);
......
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