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

Unified Diff: ui/views/view.cc

Issue 1461923002: Change name of NativeTheme::instance() to make it clear it's web only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 0fc755972d6d57de055a7ea9d31fa11733eaf13b..338afdc8d7ca460cafd3d720d9a2fada9b72adf6 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -53,6 +53,7 @@
#if defined(OS_WIN)
#include "base/win/scoped_gdi_object.h"
+#include "ui/native_theme/native_theme_win.h"
#endif
namespace views {
@@ -830,12 +831,20 @@ void View::SetBorder(scoped_ptr<Border> b) { border_ = b.Pass(); }
ui::ThemeProvider* View::GetThemeProvider() const {
const Widget* widget = GetWidget();
- return widget ? widget->GetThemeProvider() : NULL;
+ return widget ? widget->GetThemeProvider() : nullptr;
}
const ui::NativeTheme* View::GetNativeTheme() const {
+// On Windows, ui::NativeTheme::GetInstanceForWeb() returns NativeThemeWinAura
+// because that's what the renderer wants, but Views should default to
+// NativeThemeWin. TODO(estade): clean this up, see http://crbug.com/558029
+#if defined(OS_WIN)
+ const ui::NativeTheme* default_theme = ui::NativeThemeWin::instance();
+#else
+ const ui::NativeTheme* default_theme = ui::NativeTheme::GetInstanceForWeb();
+#endif
const Widget* widget = GetWidget();
- return widget ? widget->GetNativeTheme() : ui::NativeTheme::instance();
+ return widget ? widget->GetNativeTheme() : default_theme;
}
// RTL painting ----------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698