0

Move ColorProviderKey into its own header and make aliases

There are too many callers to migrate all at once, creating alises
in ColorProviderManager to facilitate the migration.

Many includes of color_provider_manager.h just need one of the types and
not the manager itself. Separate the Key types and declaration into its
own compilation units.

This allows targets to set ColorProviderKey values without depending
on the entirety of ui/color.

Bug: b:286952053
Change-Id: I6a5561d9c12e74f1c843de0fee262357094459eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4629411
Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Auto-Submit: Sean Kau <skau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1160856}
This commit is contained in:
Sean Kau
2023-06-21 21:07:06 +00:00
committed by Chromium LUCI CQ
parent 7ad8e47979
commit bdc63cb93b
11 changed files with 261 additions and 193 deletions

@@ -18,10 +18,10 @@ source_set("color_headers") {
"color_provider.h", "color_provider.h",
"color_provider_manager.h", "color_provider_manager.h",
"color_provider_utils.h", "color_provider_utils.h",
"system_theme.h",
] ]
public_deps = [ public_deps = [
":color_provider_key",
":mojom", ":mojom",
"//base", "//base",
"//skia", "//skia",
@@ -29,6 +29,23 @@ source_set("color_headers") {
] ]
} }
# Keep the deps on this target to a minimum so that chromeos/crosapi can depend on it.
component("color_provider_key") {
sources = [
"color_provider_key.cc",
"color_provider_key.h",
"system_theme.h",
]
defines = [ "IS_COLOR_PROVIDER_KEY_IMPL" ]
deps = [
"//base",
"//skia",
"//third_party/abseil-cpp:absl",
]
}
component("color") { component("color") {
sources = [ sources = [
"color_metrics.cc", "color_metrics.cc",
@@ -148,6 +165,7 @@ component("mixers") {
deps = [ deps = [
":color", ":color",
":color_headers", ":color_headers",
":color_provider_key",
"//skia", "//skia",
"//third_party/material_color_utilities", "//third_party/material_color_utilities",
"//ui/base:features", "//ui/base:features",

@@ -0,0 +1,55 @@
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/color/color_provider_key.h"
#include <utility>
namespace ui {
ColorProviderKey::InitializerSupplier::InitializerSupplier() = default;
ColorProviderKey::InitializerSupplier::~InitializerSupplier() = default;
ColorProviderKey::ThemeInitializerSupplier::ThemeInitializerSupplier(
ThemeType theme_type)
: theme_type_(theme_type) {}
ColorProviderKey::ColorProviderKey()
: ColorProviderKey(ColorMode::kLight,
ContrastMode::kNormal,
SystemTheme::kDefault,
FrameType::kChromium,
absl::nullopt,
absl::nullopt,
false,
nullptr) {}
ColorProviderKey::ColorProviderKey(
ColorMode color_mode,
ContrastMode contrast_mode,
SystemTheme system_theme,
FrameType frame_type,
absl::optional<SkColor> user_color,
absl::optional<SchemeVariant> scheme_variant,
bool is_grayscale,
scoped_refptr<ThemeInitializerSupplier> custom_theme)
: color_mode(color_mode),
contrast_mode(contrast_mode),
elevation_mode(ElevationMode::kLow),
system_theme(system_theme),
frame_type(frame_type),
user_color(user_color),
scheme_variant(scheme_variant),
is_grayscale(is_grayscale),
custom_theme(std::move(custom_theme)) {}
ColorProviderKey::ColorProviderKey(const ColorProviderKey&) = default;
ColorProviderKey& ColorProviderKey::operator=(const ColorProviderKey&) =
default;
ColorProviderKey::~ColorProviderKey() = default;
} // namespace ui

@@ -0,0 +1,141 @@
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_COLOR_COLOR_PROVIDER_KEY_H_
#define UI_COLOR_COLOR_PROVIDER_KEY_H_
#include "base/component_export.h"
#include "base/containers/flat_map.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/color/system_theme.h"
namespace color_utils {
struct HSL;
}
namespace ui {
class ColorProvider;
// All the information needed to seed the creation of a `ColorProvider`.
// Equivalient `ColorProviderKey`s are guaranteed to generate the same colors.
struct COMPONENT_EXPORT(COLOR_PROVIDER_KEY) ColorProviderKey {
enum class ColorMode {
kLight,
kDark,
};
enum class ContrastMode {
kNormal,
kHigh,
};
enum class ElevationMode {
kLow,
kHigh,
};
enum class FrameType {
// Chrome renders the browser frame.
kChromium,
// Native system renders the browser frame. Currently GTK only.
kNative,
};
// The type of color palette that is generated.
enum class SchemeVariant {
kTonalSpot,
kNeutral,
kVibrant,
kExpressive,
};
class COMPONENT_EXPORT(COLOR_PROVIDER_KEY) InitializerSupplier {
public:
InitializerSupplier();
// Adds any mixers necessary to represent this supplier.
virtual void AddColorMixers(ColorProvider* provider,
const ColorProviderKey& key) const = 0;
protected:
virtual ~InitializerSupplier();
};
// Threadsafe not because ColorProviderManager requires it but because a
// concrete subclass does.
class COMPONENT_EXPORT(COLOR_PROVIDER_KEY) ThemeInitializerSupplier
: public InitializerSupplier,
public base::RefCountedThreadSafe<ThemeInitializerSupplier> {
public: // NOLINT(whitespace/blank_line): Adding a newline causes Redundant
// blank line. Without the newline, we get whitespace/blankline.
enum class ThemeType {
kExtension,
kAutogenerated,
kNativeX11,
};
explicit ThemeInitializerSupplier(ThemeType theme_type);
virtual bool GetColor(int id, SkColor* color) const = 0;
virtual bool GetTint(int id, color_utils::HSL* hsl) const = 0;
virtual bool GetDisplayProperty(int id, int* result) const = 0;
virtual bool HasCustomImage(int id) const = 0;
ThemeType get_theme_type() const { return theme_type_; }
protected:
~ThemeInitializerSupplier() override = default;
private:
friend class base::RefCountedThreadSafe<ThemeInitializerSupplier>;
ThemeType theme_type_;
};
ColorProviderKey(); // For test convenience.
ColorProviderKey(
ColorMode color_mode,
ContrastMode contrast_mode,
SystemTheme system_theme,
FrameType frame_type,
absl::optional<SkColor> user_color = absl::nullopt,
absl::optional<SchemeVariant> scheme_variant = absl::nullopt,
bool is_grayscale = false,
scoped_refptr<ThemeInitializerSupplier> custom_theme = nullptr);
ColorProviderKey(const ColorProviderKey&);
ColorProviderKey& operator=(const ColorProviderKey&);
~ColorProviderKey();
ColorMode color_mode;
ContrastMode contrast_mode;
ElevationMode elevation_mode;
SystemTheme system_theme;
FrameType frame_type;
absl::optional<SkColor> user_color;
absl::optional<SchemeVariant> scheme_variant;
bool is_grayscale;
scoped_refptr<ThemeInitializerSupplier> custom_theme;
// Only dereferenced when populating the ColorMixer. After that, used to
// compare addresses during lookup.
raw_ptr<InitializerSupplier, DanglingUntriaged> app_controller =
nullptr; // unowned
bool operator<(const ColorProviderKey& other) const {
auto* lhs_app_controller = app_controller.get();
auto* rhs_app_controller = other.app_controller.get();
return std::tie(color_mode, contrast_mode, elevation_mode, system_theme,
frame_type, user_color, scheme_variant, is_grayscale,
custom_theme, lhs_app_controller) <
std::tie(other.color_mode, other.contrast_mode, other.elevation_mode,
other.system_theme, other.frame_type, other.user_color,
other.scheme_variant, other.is_grayscale,
other.custom_theme, rhs_app_controller);
}
};
} // namespace ui
#endif // UI_COLOR_COLOR_PROVIDER_KEY_H_

@@ -16,6 +16,7 @@
#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/color/color_metrics.h" #include "ui/color/color_metrics.h"
#include "ui/color/color_provider.h" #include "ui/color/color_provider.h"
#include "ui/color/color_provider_key.h"
#include "ui/color/color_provider_utils.h" #include "ui/color/color_provider_utils.h"
#if !BUILDFLAG(IS_ANDROID) #if !BUILDFLAG(IS_ANDROID)
@@ -45,50 +46,6 @@ absl::optional<GlobalManager>& GetGlobalManager() {
} // namespace } // namespace
ColorProviderManager::InitializerSupplier::InitializerSupplier() = default;
ColorProviderManager::InitializerSupplier::~InitializerSupplier() = default;
ColorProviderManager::ThemeInitializerSupplier::ThemeInitializerSupplier(
ThemeType theme_type)
: theme_type_(theme_type) {}
ColorProviderManager::Key::Key()
: Key(ColorMode::kLight,
ContrastMode::kNormal,
SystemTheme::kDefault,
FrameType::kChromium,
absl::nullopt,
absl::nullopt,
false,
nullptr) {}
ColorProviderManager::Key::Key(
ColorMode color_mode,
ContrastMode contrast_mode,
SystemTheme system_theme,
FrameType frame_type,
absl::optional<SkColor> user_color,
absl::optional<SchemeVariant> scheme_variant,
bool is_grayscale,
scoped_refptr<ThemeInitializerSupplier> custom_theme)
: color_mode(color_mode),
contrast_mode(contrast_mode),
elevation_mode(ElevationMode::kLow),
system_theme(system_theme),
frame_type(frame_type),
user_color(user_color),
scheme_variant(scheme_variant),
is_grayscale(is_grayscale),
custom_theme(std::move(custom_theme)) {}
ColorProviderManager::Key::Key(const Key&) = default;
ColorProviderManager::Key& ColorProviderManager::Key::operator=(const Key&) =
default;
ColorProviderManager::Key::~Key() = default;
ColorProviderManager::ColorProviderManager() { ColorProviderManager::ColorProviderManager() {
ResetColorProviderInitializerList(); ResetColorProviderInitializerList();
} }
@@ -142,7 +99,7 @@ void ColorProviderManager::AppendColorProviderInitializer(
initializer_list_->Add(std::move(initializer))); initializer_list_->Add(std::move(initializer)));
} }
ColorProvider* ColorProviderManager::GetColorProviderFor(Key key) { ColorProvider* ColorProviderManager::GetColorProviderFor(ColorProviderKey key) {
auto iter = color_providers_.find(key); auto iter = color_providers_.find(key);
if (iter == color_providers_.end()) { if (iter == color_providers_.end()) {
base::ElapsedTimer timer; base::ElapsedTimer timer;

@@ -16,6 +16,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/color/color_provider_key.h"
#include "ui/color/system_theme.h" #include "ui/color/system_theme.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
@@ -30,118 +31,19 @@ class ColorProvider;
// necessary to construct a ColorProviderManager manually. // necessary to construct a ColorProviderManager manually.
class COMPONENT_EXPORT(COLOR) ColorProviderManager { class COMPONENT_EXPORT(COLOR) ColorProviderManager {
public: public:
struct Key; // TODO(b/286952053): Remove these aliases once the migration is complete.
using Key = ColorProviderKey;
enum class ColorMode { using ColorMode = ColorProviderKey::ColorMode;
kLight, using ContrastMode = ColorProviderKey::ContrastMode;
kDark, using ElevationMode = ColorProviderKey::ElevationMode;
}; using FrameType = ColorProviderKey::FrameType;
enum class ContrastMode { using SchemeVariant = ColorProviderKey::SchemeVariant;
kNormal, using InitializerSupplier = ColorProviderKey::InitializerSupplier;
kHigh, using ThemeInitializerSupplier = ColorProviderKey::ThemeInitializerSupplier;
};
enum class ElevationMode {
kLow,
kHigh,
};
enum class FrameType {
// Chrome renders the browser frame.
kChromium,
// Native system renders the browser frame. Currently GTK only.
kNative,
};
// The type of color palette that is generated.
enum class SchemeVariant {
kTonalSpot,
kNeutral,
kVibrant,
kExpressive,
};
class COMPONENT_EXPORT(COLOR) InitializerSupplier {
public:
InitializerSupplier();
// Adds any mixers necessary to represent this supplier.
virtual void AddColorMixers(ColorProvider* provider,
const Key& key) const = 0;
protected:
virtual ~InitializerSupplier();
};
// Threadsafe not because ColorProviderManager requires it but because a
// concrete subclass does.
class COMPONENT_EXPORT(COLOR) ThemeInitializerSupplier
: public InitializerSupplier,
public base::RefCountedThreadSafe<ThemeInitializerSupplier> {
public:
enum class ThemeType {
kExtension,
kAutogenerated,
kNativeX11,
};
explicit ThemeInitializerSupplier(ThemeType theme_type);
virtual bool GetColor(int id, SkColor* color) const = 0;
virtual bool GetTint(int id, color_utils::HSL* hsl) const = 0;
virtual bool GetDisplayProperty(int id, int* result) const = 0;
virtual bool HasCustomImage(int id) const = 0;
ThemeType get_theme_type() const { return theme_type_; }
protected:
~ThemeInitializerSupplier() override = default;
private:
friend class base::RefCountedThreadSafe<ThemeInitializerSupplier>;
ThemeType theme_type_;
};
struct COMPONENT_EXPORT(COLOR) Key {
Key(); // For test convenience.
Key(ColorMode color_mode,
ContrastMode contrast_mode,
SystemTheme system_theme,
FrameType frame_type,
absl::optional<SkColor> user_color = absl::nullopt,
absl::optional<SchemeVariant> scheme_variant = absl::nullopt,
bool is_grayscale = false,
scoped_refptr<ThemeInitializerSupplier> custom_theme = nullptr);
Key(const Key&);
Key& operator=(const Key&);
~Key();
ColorMode color_mode;
ContrastMode contrast_mode;
ElevationMode elevation_mode;
SystemTheme system_theme;
FrameType frame_type;
absl::optional<SkColor> user_color;
absl::optional<SchemeVariant> scheme_variant;
bool is_grayscale;
scoped_refptr<ThemeInitializerSupplier> custom_theme;
// Only dereferenced when populating the ColorMixer. After that, used to
// compare addresses during lookup.
raw_ptr<InitializerSupplier, DanglingUntriaged> app_controller =
nullptr; // unowned
bool operator<(const Key& other) const {
auto* lhs_app_controller = app_controller.get();
auto* rhs_app_controller = other.app_controller.get();
return std::tie(color_mode, contrast_mode, elevation_mode, system_theme,
frame_type, user_color, scheme_variant, is_grayscale,
custom_theme, lhs_app_controller) <
std::tie(other.color_mode, other.contrast_mode,
other.elevation_mode, other.system_theme,
other.frame_type, other.user_color, other.scheme_variant,
other.is_grayscale, other.custom_theme,
rhs_app_controller);
}
};
using ColorProviderInitializerList = using ColorProviderInitializerList =
base::RepeatingCallbackList<void(ColorProvider*, const Key&)>; base::RepeatingCallbackList<void(ColorProvider*,
const ColorProviderKey&)>;
ColorProviderManager(const ColorProviderManager&) = delete; ColorProviderManager(const ColorProviderManager&) = delete;
ColorProviderManager& operator=(const ColorProviderManager&) = delete; ColorProviderManager& operator=(const ColorProviderManager&) = delete;
@@ -161,7 +63,7 @@ class COMPONENT_EXPORT(COLOR) ColorProviderManager {
ColorProviderInitializerList::CallbackType Initializer); ColorProviderInitializerList::CallbackType Initializer);
// Returns a color provider for |key|, creating one if necessary. // Returns a color provider for |key|, creating one if necessary.
ColorProvider* GetColorProviderFor(Key key); ColorProvider* GetColorProviderFor(ColorProviderKey key);
size_t num_providers_initialized() const { size_t num_providers_initialized() const {
return num_providers_initialized_; return num_providers_initialized_;
@@ -178,7 +80,8 @@ class COMPONENT_EXPORT(COLOR) ColorProviderManager {
// Holds the subscriptions for initializers in the `initializer_list_`. // Holds the subscriptions for initializers in the `initializer_list_`.
std::vector<base::CallbackListSubscription> initializer_subscriptions_; std::vector<base::CallbackListSubscription> initializer_subscriptions_;
base::flat_map<Key, std::unique_ptr<ColorProvider>> color_providers_; base::flat_map<ColorProviderKey, std::unique_ptr<ColorProvider>>
color_providers_;
// Tracks the number of ColorProviders constructed and initialized by the // Tracks the number of ColorProviders constructed and initialized by the
// manager for metrics purposes. // manager for metrics purposes.

@@ -39,10 +39,9 @@ ColorProvider* GetLightNormalColorProvider() {
/*scheme_variant=*/absl::nullopt, /*is_grayscale=*/false, nullptr}); /*scheme_variant=*/absl::nullopt, /*is_grayscale=*/false, nullptr});
} }
class TestInitializerSupplier class TestInitializerSupplier : public ColorProviderKey::InitializerSupplier {
: public ColorProviderManager::InitializerSupplier {
void AddColorMixers(ColorProvider* provider, void AddColorMixers(ColorProvider* provider,
const ColorProviderManager::Key& key) const override {} const ColorProviderKey& key) const override {}
}; };
} // namespace } // namespace
@@ -61,10 +60,9 @@ TEST_F(ColorProviderManagerTest, Persistence) {
// provider. // provider.
TEST_F(ColorProviderManagerTest, SetInitializer) { TEST_F(ColorProviderManagerTest, SetInitializer) {
ColorProviderManager::GetForTesting().AppendColorProviderInitializer( ColorProviderManager::GetForTesting().AppendColorProviderInitializer(
base::BindRepeating( base::BindRepeating([](ColorProvider* provider, const ColorProviderKey&) {
[](ColorProvider* provider, const ColorProviderManager::Key&) { provider->AddMixer()[kColorTest0] = {SK_ColorBLUE};
provider->AddMixer()[kColorTest0] = {SK_ColorBLUE}; }));
}));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
ColorProvider* provider = GetLightNormalColorProvider(); ColorProvider* provider = GetLightNormalColorProvider();
@@ -78,10 +76,9 @@ TEST_F(ColorProviderManagerTest, SetInitializer) {
// unit tests isolated from each other. // unit tests isolated from each other.
TEST_F(ColorProviderManagerTest, Reset) { TEST_F(ColorProviderManagerTest, Reset) {
ColorProviderManager::GetForTesting().AppendColorProviderInitializer( ColorProviderManager::GetForTesting().AppendColorProviderInitializer(
base::BindRepeating( base::BindRepeating([](ColorProvider* provider, const ColorProviderKey&) {
[](ColorProvider* provider, const ColorProviderManager::Key&) { provider->AddMixer()[kColorTest0] = {SK_ColorBLUE};
provider->AddMixer()[kColorTest0] = {SK_ColorBLUE}; }));
}));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
ColorProvider* provider = GetLightNormalColorProvider(); ColorProvider* provider = GetLightNormalColorProvider();
@@ -96,7 +93,7 @@ TEST_F(ColorProviderManagerTest, Reset) {
TEST_F(ColorProviderManagerTest, LookupWithDeletedMember) { TEST_F(ColorProviderManagerTest, LookupWithDeletedMember) {
ColorProviderManager& manager = ColorProviderManager::GetForTesting(); ColorProviderManager& manager = ColorProviderManager::GetForTesting();
ColorProviderManager::Key key; ColorProviderKey key;
{ {
TestInitializerSupplier supplier; TestInitializerSupplier supplier;
@@ -112,7 +109,7 @@ TEST_F(ColorProviderManagerTest, LookupWithDeletedMember) {
} }
TEST_F(ColorProviderManagerTest, KeyOrderIsStable) { TEST_F(ColorProviderManagerTest, KeyOrderIsStable) {
ColorProviderManager::Key keys[2]; ColorProviderKey keys[2];
// Allocate two suppliers. // Allocate two suppliers.
std::vector<TestInitializerSupplier> supplier(2); std::vector<TestInitializerSupplier> supplier(2);

@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/color/color_provider_source.h" #include "ui/color/color_provider_source.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "ui/color/color_provider_source_observer.h" #include "ui/color/color_provider_source_observer.h"
@@ -29,7 +30,7 @@ void ColorProviderSource::NotifyColorProviderChanged() {
observer.OnColorProviderChanged(); observer.OnColorProviderChanged();
} }
ui::ColorProviderManager::ColorMode ColorProviderSource::GetColorMode() const { ui::ColorProviderKey::ColorMode ColorProviderSource::GetColorMode() const {
return GetColorProviderKey().color_mode; return GetColorProviderKey().color_mode;
} }

@@ -9,18 +9,17 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/observer_list_types.h" #include "base/observer_list_types.h"
#include "ui/color/color_provider.h" #include "ui/color/color_provider.h"
#include "ui/color/color_provider_manager.h" #include "ui/color/color_provider_key.h"
namespace ui { namespace ui {
class ColorProviderSourceObserver; class ColorProviderSourceObserver;
// Encapsulates the theme bits that are used to uniquely identify a // Encapsulates the theme bits that are used to uniquely identify a
// ColorProvider instance (i.e. the bits that comprise the // ColorProvider instance (i.e. the bits that comprise the ColorProviderKey).
// ColorProviderManager::ColorProviderKey). Notifies observers when the // Notifies observers when the ColorProvider instance that maps to these theme
// ColorProvider instance that maps to these theme bits changes. References are // bits changes. References are managed to avoid dangling pointers in the case
// managed to avoid dangling pointers in the case the source or the observer are // the source or the observer are deleted.
// deleted.
class COMPONENT_EXPORT(COLOR) ColorProviderSource { class COMPONENT_EXPORT(COLOR) ColorProviderSource {
public: public:
ColorProviderSource(); ColorProviderSource();
@@ -40,16 +39,16 @@ class COMPONENT_EXPORT(COLOR) ColorProviderSource {
void NotifyColorProviderChanged(); void NotifyColorProviderChanged();
// Gets the ColorMode currently associated with this source. // Gets the ColorMode currently associated with this source.
ui::ColorProviderManager::ColorMode GetColorMode() const; ColorProviderKey::ColorMode GetColorMode() const;
base::ObserverList<ColorProviderSourceObserver>& observers_for_testing() { base::ObserverList<ColorProviderSourceObserver>& observers_for_testing() {
return observers_; return observers_;
} }
protected: protected:
// Implementations should return the ColorProviderManager::Key associated with // Implementations should return the ColorProviderKey associated with
// this source. // this source.
virtual ColorProviderManager::Key GetColorProviderKey() const = 0; virtual ColorProviderKey GetColorProviderKey() const = 0;
private: private:
base::ObserverList<ColorProviderSourceObserver> observers_; base::ObserverList<ColorProviderSourceObserver> observers_;

@@ -17,10 +17,7 @@ namespace {
class MockColorProviderSource : public ColorProviderSource { class MockColorProviderSource : public ColorProviderSource {
public: public:
MOCK_METHOD(ColorProviderManager::Key, MOCK_METHOD(ColorProviderKey, GetColorProviderKey, (), (const, override));
GetColorProviderKey,
(),
(const, override));
MOCK_METHOD(const ColorProvider*, GetColorProvider, (), (const, override)); MOCK_METHOD(const ColorProvider*, GetColorProvider, (), (const, override));
}; };

@@ -76,11 +76,11 @@ ColorProviderUtilsCallbacks* g_color_provider_utils_callbacks = nullptr;
ColorProviderUtilsCallbacks::~ColorProviderUtilsCallbacks() = default; ColorProviderUtilsCallbacks::~ColorProviderUtilsCallbacks() = default;
base::StringPiece ColorModeName(ColorProviderManager::ColorMode color_mode) { base::StringPiece ColorModeName(ColorProviderKey::ColorMode color_mode) {
switch (color_mode) { switch (color_mode) {
case ColorProviderManager::ColorMode::kLight: case ColorProviderKey::ColorMode::kLight:
return "kLight"; return "kLight";
case ColorProviderManager::ColorMode::kDark: case ColorProviderKey::ColorMode::kDark:
return "kDark"; return "kDark";
default: default:
return "<invalid>"; return "<invalid>";
@@ -88,11 +88,11 @@ base::StringPiece ColorModeName(ColorProviderManager::ColorMode color_mode) {
} }
base::StringPiece ContrastModeName( base::StringPiece ContrastModeName(
ColorProviderManager::ContrastMode contrast_mode) { ColorProviderKey::ContrastMode contrast_mode) {
switch (contrast_mode) { switch (contrast_mode) {
case ColorProviderManager::ContrastMode::kNormal: case ColorProviderKey::ContrastMode::kNormal:
return "kNormal"; return "kNormal";
case ColorProviderManager::ContrastMode::kHigh: case ColorProviderKey::ContrastMode::kHigh:
return "kHigh"; return "kHigh";
default: default:
return "<invalid>"; return "<invalid>";

@@ -33,11 +33,11 @@ class COMPONENT_EXPORT(COLOR) ColorProviderUtilsCallbacks {
// Converts the ColorMode. // Converts the ColorMode.
base::StringPiece COMPONENT_EXPORT(COLOR) base::StringPiece COMPONENT_EXPORT(COLOR)
ColorModeName(ColorProviderManager::ColorMode color_mode); ColorModeName(ColorProviderKey::ColorMode color_mode);
// Converts the ContrastMode. // Converts the ContrastMode.
base::StringPiece COMPONENT_EXPORT(COLOR) base::StringPiece COMPONENT_EXPORT(COLOR)
ContrastModeName(ColorProviderManager::ContrastMode contrast_mode); ContrastModeName(ColorProviderKey::ContrastMode contrast_mode);
// Converts SystemTheme. // Converts SystemTheme.
base::StringPiece COMPONENT_EXPORT(COLOR) base::StringPiece COMPONENT_EXPORT(COLOR)