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

Unified Diff: content/browser/theme_helper_mac.mm

Issue 1642553004: Make a test not depend on system settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« content/browser/theme_helper_mac.h ('K') | « content/browser/theme_helper_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/theme_helper_mac.mm
diff --git a/content/browser/theme_helper_mac.mm b/content/browser/theme_helper_mac.mm
index aa5ebd05a0d2fadd8a334ee871dc5e5da691d395..149836316892babb621c1c6361a162300c15fa37 100644
--- a/content/browser/theme_helper_mac.mm
+++ b/content/browser/theme_helper_mac.mm
@@ -22,6 +22,9 @@ using content::ThemeHelperMac;
namespace {
+content::ScopedPreferredScrollerStyleOveride*
+ g_preferred_scroller_style_override = nullptr;
+
bool GetScrollAnimationEnabled() {
bool enabled = false;
id value = nil;
@@ -185,6 +188,18 @@ ViewMsg_SystemColorsChanged* CreateSystemColorsChangedMessage() {
namespace content {
+ScopedPreferredScrollerStyleOveride::ScopedPreferredScrollerStyleOveride(
+ blink::ScrollerStyle value) : value_(value) {
+ DCHECK(!g_preferred_scroller_style_override);
+ g_preferred_scroller_style_override = this;
+ [ScrollbarPrefsObserver notifyPrefsChangedWithRedraw:NO];
+}
+
+ScopedPreferredScrollerStyleOveride::~ScopedPreferredScrollerStyleOveride() {
+ g_preferred_scroller_style_override = nullptr;
+ [ScrollbarPrefsObserver notifyPrefsChangedWithRedraw:NO];
+}
+
// static
ThemeHelperMac* ThemeHelperMac::GetInstance() {
return base::Singleton<ThemeHelperMac,
@@ -193,6 +208,8 @@ ThemeHelperMac* ThemeHelperMac::GetInstance() {
// static
blink::ScrollerStyle ThemeHelperMac::GetPreferredScrollerStyle() {
+ if (g_preferred_scroller_style_override)
+ return g_preferred_scroller_style_override->value();
if (![NSScroller respondsToSelector:@selector(preferredScrollerStyle)])
return blink::ScrollerStyleLegacy;
return static_cast<blink::ScrollerStyle>([NSScroller preferredScrollerStyle]);
« content/browser/theme_helper_mac.h ('K') | « content/browser/theme_helper_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698