Commit 63a73efd authored by minch's avatar minch Committed by Commit Bot

dark_mode: Remove UnifiedSystemTrayView::GetFocusRingColor.

Get the focus ring color from AshColorProvider instead.

Bug: 1133748
Change-Id: I681a6dde5fcf635fc4cee4f0628de17eb3cdd0f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2481686Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819886}
parent d1c54b08
......@@ -10,7 +10,6 @@
#include "ash/style/ash_color_provider.h"
#include "ash/system/audio/unified_volume_slider_controller.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "base/i18n/rtl.h"
#include "base/stl_util.h"
#include "components/vector_icons/vector_icons.h"
......@@ -65,7 +64,8 @@ class MoreButton : public views::Button {
2),
2));
const SkColor icon_color = AshColorProvider::Get()->GetContentLayerColor(
auto* color_provider = AshColorProvider::Get();
const SkColor icon_color = color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kIconColorPrimary);
if (!features::IsSystemTrayMicGainSettingEnabled()) {
......@@ -89,7 +89,8 @@ class MoreButton : public views::Button {
views::InstallRoundRectHighlightPathGenerator(this, gfx::Insets(),
kTrayItemCornerRadius);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(color_provider->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
}
~MoreButton() override = default;
......
......@@ -10,7 +10,6 @@
#include "ash/style/ash_color_provider.h"
#include "ash/system/phonehub/phone_hub_tray.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "base/strings/utf_string_conversions.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "ui/views/controls/highlight_path_generator.h"
......@@ -35,8 +34,10 @@ constexpr gfx::Size kTitleViewSize(100, 40);
ContinueBrowsingChip::ContinueBrowsingChip(
const chromeos::phonehub::BrowserTabsModel::BrowserTabMetadata& metadata)
: views::Button(this), url_(metadata.url) {
auto* color_provider = AshColorProvider::Get();
SetFocusBehavior(FocusBehavior::ALWAYS);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(color_provider->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
// Install this highlight path generator to set the desired shape for
// our focus ring.
......@@ -69,7 +70,7 @@ ContinueBrowsingChip::ContinueBrowsingChip(
header_view->AddChildView(std::make_unique<views::Label>(metadata.title));
title_label->SetAutoColorReadabilityEnabled(false);
title_label->SetSubpixelRenderingEnabled(false);
title_label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
title_label->SetEnabledColor(color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label->SetMultiLine(true);
......@@ -82,7 +83,7 @@ ContinueBrowsingChip::ContinueBrowsingChip(
std::make_unique<views::Label>(base::UTF8ToUTF16(metadata.url.host())));
url_label->SetAutoColorReadabilityEnabled(false);
url_label->SetSubpixelRenderingEnabled(false);
url_label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
url_label->SetEnabledColor(color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
}
......
......@@ -4,7 +4,6 @@
#include "ash/system/tray/system_menu_button.h"
#include "ash/public/cpp/shelf_config.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_ink_drop_style.h"
......@@ -37,7 +36,8 @@ SystemMenuButton::SystemMenuButton(views::ButtonListener* listener,
TrayPopupUtils::ConfigureTrayPopupButton(this);
TrayPopupUtils::InstallHighlightPathGenerator(
this, TrayPopupInkDropStyle::HOST_CENTERED);
focus_ring()->SetColor(ShelfConfig::Get()->shelf_focus_border_color());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
}
SystemMenuButton::SystemMenuButton(views::ButtonListener* listener,
......
......@@ -170,7 +170,8 @@ TrayBackgroundView::TrayBackgroundView(Shelf* shelf)
SetLayoutManager(std::make_unique<views::FillLayout>());
SetInstallFocusRingOnFocus(true);
focus_ring()->SetColor(ShelfConfig::Get()->shelf_focus_border_color());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
focus_ring()->SetPathGenerator(std::make_unique<HighlightPathGenerator>(
this, kTrayBackgroundFocusPadding));
SetFocusPainter(nullptr);
......
......@@ -19,7 +19,6 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_item_style.h"
#include "ash/system/tray/unfocusable_label.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
......@@ -247,8 +246,9 @@ views::ToggleButton* TrayPopupUtils::CreateToggleButton(
std::unique_ptr<views::Painter> TrayPopupUtils::CreateFocusPainter() {
return views::Painter::CreateSolidFocusPainter(
UnifiedSystemTrayView::GetFocusRingColor(), kFocusBorderThickness,
gfx::InsetsF());
AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor),
kFocusBorderThickness, gfx::InsetsF());
}
void TrayPopupUtils::ConfigureTrayPopupButton(views::Button* button) {
......
......@@ -6,7 +6,6 @@
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ui/compositor/paint_recorder.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/skbitmap_operations.h"
......@@ -40,7 +39,8 @@ CustomShapeButton::CustomShapeButton(views::ButtonListener* listener)
TrayPopupUtils::ConfigureTrayPopupButton(this);
views::HighlightPathGenerator::Install(
this, std::make_unique<CustomShapeButtonHighlightPathGenerator>());
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
}
CustomShapeButton::~CustomShapeButton() = default;
......
......@@ -9,7 +9,6 @@
#include "ash/style/ash_color_provider.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"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -62,7 +61,8 @@ FeaturePodIconButton::FeaturePodIconButton(views::ButtonListener* listener,
// Focus ring is around the whole view's bounds, but the ink drop should be
// the same size as the content.
TrayPopupUtils::ConfigureTrayPopupButton(this);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
focus_ring()->SetPathGenerator(
std::make_unique<views::CircleHighlightPathGenerator>(gfx::Insets()));
views::InstallCircleHighlightPathGenerator(this,
......@@ -178,7 +178,8 @@ FeaturePodLabelButton::FeaturePodLabelButton(views::ButtonListener* listener)
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
views::InstallRoundRectHighlightPathGenerator(
this, gfx::Insets(), kUnifiedFeaturePodHoverCornerRadius);
}
......
......@@ -6,7 +6,6 @@
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ui/gfx/canvas.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_highlight.h"
......@@ -19,7 +18,8 @@ namespace ash {
RoundedLabelButton::RoundedLabelButton(views::ButtonListener* listener,
const base::string16& text)
: views::LabelButton(listener, text) {
SetEnabledTextColors(AshColorProvider::Get()->GetContentLayerColor(
auto* color_provider = AshColorProvider::Get();
SetEnabledTextColors(color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
SetHorizontalAlignment(gfx::ALIGN_CENTER);
SetBorder(views::CreateEmptyBorder(gfx::Insets()));
......@@ -31,7 +31,8 @@ RoundedLabelButton::RoundedLabelButton(views::ButtonListener* listener,
views::InstallRoundRectHighlightPathGenerator(this, gfx::Insets(),
kTrayItemSize / 2.f);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(color_provider->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
}
RoundedLabelButton::~RoundedLabelButton() = default;
......
......@@ -6,7 +6,6 @@
#include "ash/style/ash_color_provider.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"
#include "ui/gfx/canvas.h"
#include "ui/gfx/paint_vector_icon.h"
......@@ -28,8 +27,6 @@ TopShortcutButton::TopShortcutButton(const gfx::VectorIcon& icon,
AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kIconColorPrimary)));
SetEnabled(false);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
}
TopShortcutButton::TopShortcutButton(views::ButtonListener* listener,
......@@ -45,8 +42,6 @@ TopShortcutButton::TopShortcutButton(views::ButtonListener* listener,
views::Button::STATE_DISABLED,
gfx::CreateVectorIcon(icon, kTrayTopShortcutButtonIconSize,
AshColorProvider::GetDisabledColor(icon_color)));
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
}
TopShortcutButton::TopShortcutButton(views::ButtonListener* listener,
......@@ -58,10 +53,9 @@ TopShortcutButton::TopShortcutButton(views::ButtonListener* listener,
SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id));
TrayPopupUtils::ConfigureTrayPopupButton(this);
views::InstallCircleHighlightPathGenerator(this);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
}
TopShortcutButton::~TopShortcutButton() = default;
......
......@@ -14,13 +14,13 @@
#include "ash/shell.h"
#include "ash/shutdown_controller_impl.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/collapse_button.h"
#include "ash/system/unified/sign_out_button.h"
#include "ash/system/unified/top_shortcut_button.h"
#include "ash/system/unified/unified_system_tray_controller.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "ash/system/unified/user_chooser_detailed_view_controller.h"
#include "ash/system/unified/user_chooser_view.h"
#include "base/numerics/ranges.h"
......@@ -32,6 +32,7 @@
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view_class_properties.h"
namespace ash {
namespace {
......@@ -57,7 +58,8 @@ UserAvatarButton::UserAvatarButton(views::ButtonListener* listener)
SetFocusForPlatform();
views::InstallCircleHighlightPathGenerator(this);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
}
} // namespace
......
......@@ -6,7 +6,6 @@
#include "ash/style/ash_color_provider.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"
#include "ui/gfx/canvas.h"
#include "ui/gfx/paint_vector_icon.h"
......@@ -99,7 +98,8 @@ UnifiedSliderButton::UnifiedSliderButton(views::ButtonListener* listener,
// Focus ring is around the whole view's bounds, but the ink drop should be
// the same size as the content.
TrayPopupUtils::ConfigureTrayPopupButton(this);
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
focus_ring()->SetPathGenerator(
std::make_unique<views::CircleHighlightPathGenerator>(gfx::Insets()));
views::InstallCircleHighlightPathGenerator(
......
......@@ -21,7 +21,6 @@
#include "ash/system/supervised/supervised_icon_string.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/unified_system_tray_view.h"
#include "base/i18n/time_formatting.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
......@@ -95,9 +94,10 @@ DateView::DateView(UnifiedSystemTrayController* controller)
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(label_);
auto* color_provider = AshColorProvider::Get();
label_->SetAutoColorReadabilityEnabled(false);
label_->SetSubpixelRenderingEnabled(false);
label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
label_->SetEnabledColor(color_provider->GetContentLayerColor(
ContentLayerType::kTextColorPrimary));
Update();
......@@ -107,7 +107,8 @@ DateView::DateView(UnifiedSystemTrayController* controller)
SetInstallFocusRingOnFocus(true);
SetFocusForPlatform();
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(color_provider->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
SetInkDropMode(views::InkDropHostView::InkDropMode::OFF);
}
......@@ -267,17 +268,18 @@ ManagedStateView::ManagedStateView(views::ButtonListener* listener,
views::BoxLayout::Orientation::kHorizontal, gfx::Insets(),
kUnifiedSystemInfoSpacing));
auto* color_provider = AshColorProvider::Get();
auto* label = new views::Label;
label->SetAutoColorReadabilityEnabled(false);
label->SetSubpixelRenderingEnabled(false);
label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
label->SetEnabledColor(color_provider->GetContentLayerColor(
ContentLayerType::kTextColorSecondary));
label->SetText(l10n_util::GetStringUTF16(label_id));
AddChildView(label);
auto* image = new views::ImageView;
image->SetImage(
gfx::CreateVectorIcon(icon, AshColorProvider::Get()->GetContentLayerColor(
gfx::CreateVectorIcon(icon, color_provider->GetContentLayerColor(
ContentLayerType::kIconColorSecondary)));
image->SetPreferredSize(
gfx::Size(kUnifiedSystemInfoHeight, kUnifiedSystemInfoHeight));
......@@ -285,7 +287,8 @@ ManagedStateView::ManagedStateView(views::ButtonListener* listener,
SetInstallFocusRingOnFocus(true);
SetFocusForPlatform();
focus_ring()->SetColor(UnifiedSystemTrayView::GetFocusRingColor());
focus_ring()->SetColor(color_provider->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kFocusRingColor));
SetInkDropMode(views::InkDropHostView::InkDropMode::OFF);
}
......
......@@ -171,11 +171,6 @@ class UnifiedSystemTrayView::SystemTrayContainer : public views::View {
views::BoxLayout* const layout_manager_;
};
// static
SkColor UnifiedSystemTrayView::GetFocusRingColor() {
return ShelfConfig::Get()->shelf_focus_border_color();
}
UnifiedSystemTrayView::UnifiedSystemTrayView(
UnifiedSystemTrayController* controller,
bool initially_expanded)
......
......@@ -65,9 +65,6 @@ class ASH_EXPORT UnifiedSystemTrayView : public views::View,
public views::FocusTraversable,
public views::FocusChangeListener {
public:
// Get focus ring color for system tray elements.
static SkColor GetFocusRingColor();
UnifiedSystemTrayView(UnifiedSystemTrayController* controller,
bool initially_expanded);
~UnifiedSystemTrayView() override;
......
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