| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index 7345e71a3ec6e14d61efad8e537f6efe64b9b80e..2a5e74ea8c216cc18a82a0d7472c82734f191bd4 100644
|
| --- a/ui/views/view.cc
|
| +++ b/ui/views/view.cc
|
| @@ -924,6 +924,12 @@ const ui::ThemeProvider* View::GetThemeProvider() const {
|
| }
|
|
|
| const ui::NativeTheme* View::GetNativeTheme() const {
|
| + if (native_theme_override_)
|
| + return native_theme_override_;
|
| +
|
| + if (parent())
|
| + return parent()->GetNativeTheme();
|
| +
|
| const Widget* widget = GetWidget();
|
| if (widget)
|
| return widget->GetNativeTheme();
|
| @@ -931,6 +937,13 @@ const ui::NativeTheme* View::GetNativeTheme() const {
|
| return ui::NativeTheme::GetInstanceForNativeUi();
|
| }
|
|
|
| +void View::SetNativeThemeOverride(ui::NativeTheme* theme) {
|
| + ui::NativeTheme* original_native_theme = GetNativeTheme();
|
| + native_theme_override_ = theme;
|
| + if (native_theme_override_ != original_native_theme)
|
| + PropagateNativeThemeChanged(theme);
|
| +}
|
| +
|
| // RTL painting ----------------------------------------------------------------
|
|
|
| void View::EnableCanvasFlippingForRTLUI(bool enable) {
|
| @@ -1975,6 +1988,9 @@ void View::ViewHierarchyChangedImpl(
|
| }
|
|
|
| void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) {
|
| + if (native_theme_override_ && native_theme_override_ != theme)
|
| + return;
|
| +
|
| {
|
| internal::ScopedChildrenLock lock(this);
|
| for (auto* child : children_)
|
|
|