Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: ui/views/widget/widget.cc

Issue 1310183009: Add ability for Widgets to override the DefaultThemeProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 280969a84e5e7d0067d1f10378dec9d6d15061fb..5a1a0d13207ac3a69848ac5e384e71f6372020f3 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -158,6 +158,7 @@ Widget::Widget()
: native_widget_(NULL),
widget_delegate_(NULL),
non_client_view_(NULL),
+ theme_provider_(nullptr),
dragged_view_(NULL),
ownership_(InitParams::NATIVE_WIDGET_OWNS_WIDGET),
is_secondary_widget_(true),
@@ -742,6 +743,8 @@ bool Widget::IsVisible() const {
}
ui::ThemeProvider* Widget::GetThemeProvider() const {
+ if (theme_provider_)
+ return theme_provider_;
const Widget* root_widget = GetTopLevelWidget();
if (root_widget && root_widget != this) {
// Attempt to get the theme provider, and fall back to the default theme
@@ -757,6 +760,12 @@ ui::ThemeProvider* Widget::GetThemeProvider() const {
return default_theme_provider_.get();
}
+void Widget::SetThemeProvider(ui::ThemeProvider* theme_provider) {
+ theme_provider_ = theme_provider;
sadrul 2015/08/31 17:51:07 If a Widget has a theme-provider, then there's no
jonross 2015/09/01 13:44:30 We would not need the DefaultThemeProvider if they
+ if (non_client_view_)
+ non_client_view_->Layout();
sadrul 2015/08/31 17:51:07 Should this just call ThemeChanged() instead? (the
+}
+
const ui::NativeTheme* Widget::GetNativeTheme() const {
return native_widget_->GetNativeTheme();
}
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698