#include "ui/native_theme/native_theme.h"
#include <cstring>
#include <optional>
#include "base/command_line.h"
#include "base/containers/fixed_flat_map.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "build/build_config.h"
#include "ui/base/ui_base_switches.h"
#include "ui/color/color_id.h"
#include "ui/color/color_metrics.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_key.h"
#include "ui/color/color_provider_utils.h"
#include "ui/native_theme/common_theme.h"
#include "ui/native_theme/native_theme_utils.h"
namespace ui {
namespace {
static constexpr base::TimeDelta kDefaultCaretBlinkInterval = …;
}
NativeTheme::MenuListExtraParams::MenuListExtraParams() = default;
NativeTheme::TextFieldExtraParams::TextFieldExtraParams() = default;
NativeTheme::MenuListExtraParams::MenuListExtraParams(
const NativeTheme::MenuListExtraParams&) = default;
NativeTheme::TextFieldExtraParams::TextFieldExtraParams(
const NativeTheme::TextFieldExtraParams&) = default;
NativeTheme::MenuListExtraParams& NativeTheme::MenuListExtraParams::operator=(
const NativeTheme::MenuListExtraParams&) = default;
NativeTheme::TextFieldExtraParams& NativeTheme::TextFieldExtraParams::operator=(
const NativeTheme::TextFieldExtraParams&) = default;
#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_APPLE)
bool NativeTheme::SystemDarkModeSupported() { … }
#endif
ColorProviderKey NativeTheme::GetColorProviderKey(
scoped_refptr<ColorProviderKey::ThemeInitializerSupplier> custom_theme,
bool use_custom_frame) const { … }
SkColor NativeTheme::GetSystemButtonPressedColor(SkColor base_color) const { … }
SkColor4f NativeTheme::FocusRingColorForBaseColor(SkColor4f base_color) const { … }
float NativeTheme::GetBorderRadiusForPart(Part part,
float width,
float height) const { … }
void NativeTheme::AddObserver(NativeThemeObserver* observer) { … }
void NativeTheme::RemoveObserver(NativeThemeObserver* observer) { … }
void NativeTheme::NotifyOnNativeThemeUpdated() { … }
void NativeTheme::NotifyOnCaptionStyleUpdated() { … }
void NativeTheme::NotifyOnPreferredContrastUpdated() { … }
float NativeTheme::AdjustBorderWidthByZoom(float border_width,
float zoom_level) const { … }
float NativeTheme::AdjustBorderRadiusByZoom(Part part,
float border_radius,
float zoom) const { … }
base::TimeDelta NativeTheme::GetCaretBlinkInterval() const { … }
NativeTheme::NativeTheme(bool should_use_dark_colors,
ui::SystemTheme system_theme)
: … { … }
NativeTheme::~NativeTheme() = default;
bool NativeTheme::ShouldUseDarkColors() const { … }
bool NativeTheme::UserHasContrastPreference() const { … }
bool NativeTheme::InForcedColorsMode() const { … }
NativeTheme::PlatformHighContrastColorScheme
NativeTheme::GetPlatformHighContrastColorScheme() const { … }
NativeTheme::PageColors NativeTheme::GetPageColors() const { … }
NativeTheme::PreferredColorScheme NativeTheme::CalculatePreferredColorScheme()
const { … }
std::optional<base::TimeDelta> NativeTheme::GetPlatformCaretBlinkInterval()
const { … }
NativeTheme::PreferredColorScheme NativeTheme::GetPreferredColorScheme() const { … }
bool NativeTheme::GetPrefersReducedTransparency() const { … }
bool NativeTheme::GetInvertedColors() const { … }
NativeTheme::PreferredContrast NativeTheme::GetPreferredContrast() const { … }
void NativeTheme::SetPreferredContrast(
NativeTheme::PreferredContrast preferred_contrast) { … }
bool NativeTheme::IsForcedDarkMode() { … }
bool NativeTheme::IsForcedHighContrast() { … }
NativeTheme::PreferredContrast NativeTheme::CalculatePreferredContrast() const { … }
std::optional<CaptionStyle> NativeTheme::GetSystemCaptionStyle() const { … }
const std::map<NativeTheme::SystemThemeColor, SkColor>&
NativeTheme::GetSystemColors() const { … }
std::optional<SkColor> NativeTheme::GetSystemThemeColor(
SystemThemeColor theme_color) const { … }
bool NativeTheme::HasDifferentSystemColors(
const std::map<NativeTheme::SystemThemeColor, SkColor>& colors) const { … }
void NativeTheme::set_system_colors(
const std::map<NativeTheme::SystemThemeColor, SkColor>& colors) { … }
NativeTheme::ColorSchemeNativeThemeObserver::ColorSchemeNativeThemeObserver(
NativeTheme* theme_to_update)
: … { … }
NativeTheme::ColorSchemeNativeThemeObserver::~ColorSchemeNativeThemeObserver() =
default;
void NativeTheme::ColorSchemeNativeThemeObserver::OnNativeThemeUpdated(
ui::NativeTheme* observed_theme) { … }
NativeTheme::ColorScheme NativeTheme::GetDefaultSystemColorScheme() const { … }
bool NativeTheme::UpdateContrastRelatedStates(
const NativeTheme& observed_theme) { … }
int NativeTheme::GetPaintedScrollbarTrackInset() const { … }
gfx::Insets NativeTheme::GetScrollbarSolidColorThumbInsets(Part part) const { … }
SkColor4f NativeTheme::GetScrollbarThumbColor(
const ui::ColorProvider& color_provider,
State state,
const ScrollbarThumbExtraParams& extra_params) const { … }
}