| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index 7345e71a3ec6e14d61efad8e537f6efe64b9b80e..48f3fbbe8f5bd85201cfcfdd559426442cc25ef9 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_)
|
| + return native_theme_;
|
| +
|
| + 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::SetNativeTheme(ui::NativeTheme* theme) {
|
| + ui::NativeTheme* original_native_theme = GetNativeTheme();
|
| + native_theme_ = theme;
|
| + if (native_theme_ != 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_ && native_theme_ != theme)
|
| + return;
|
| +
|
| {
|
| internal::ScopedChildrenLock lock(this);
|
| for (auto* child : children_)
|
|
|