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

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: Rebase Created 5 years, 3 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 154d107a63b298fbb7f6d0eb764d924ecc1a734b..7f120cf45a2f6408951a4ff0841735a816a50ac8 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -123,7 +123,8 @@ Widget::InitParams::InitParams()
desktop_window_tree_host(NULL),
layer_type(ui::LAYER_TEXTURED),
context(NULL),
- force_show_in_taskbar(false) {
+ force_show_in_taskbar(false),
+ theme_provider(nullptr) {
}
Widget::InitParams::InitParams(Type type)
@@ -146,7 +147,8 @@ Widget::InitParams::InitParams(Type type)
desktop_window_tree_host(NULL),
layer_type(ui::LAYER_TEXTURED),
context(NULL),
- force_show_in_taskbar(false) {
+ force_show_in_taskbar(false),
+ theme_provider(nullptr) {
}
Widget::InitParams::~InitParams() {
@@ -159,6 +161,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),
@@ -352,7 +355,10 @@ void Widget::Init(const InitParams& in_params) {
native_widget_ = CreateNativeWidget(params.native_widget, this)->
AsNativeWidgetPrivate();
root_view_.reset(CreateRootView());
- default_theme_provider_.reset(new ui::DefaultThemeProvider);
+ if (in_params.theme_provider)
+ theme_provider_ = in_params.theme_provider;
+ else
+ default_theme_provider_.reset(new ui::DefaultThemeProvider);
if (params.type == InitParams::TYPE_MENU) {
is_mouse_button_pressed_ =
internal::NativeWidgetPrivate::IsMouseButtonDown();
@@ -743,6 +749,8 @@ bool Widget::IsVisible() const {
}
ui::ThemeProvider* Widget::GetThemeProvider() const {
+ if (theme_provider_)
+ return theme_provider_;
Peter Kasting 2015/09/02 21:44:14 It seems strange that we prefer root widget's defa
jonross 2015/09/02 22:02:26 I had debated that approach, and am still open to
jonross 2015/09/09 14:54:36 I've updated the change to only apply the desired
const Widget* root_widget = GetTopLevelWidget();
if (root_widget && root_widget != this) {
// Attempt to get the theme provider, and fall back to the default theme
« 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