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

Unified Diff: Source/web/mac/WebScrollbarTheme.mm

Issue 1234783005: Add API to send NSUserDefault values over IPC, while preserving current behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm ('k') | public/web/mac/WebScrollbarTheme.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/mac/WebScrollbarTheme.mm
diff --git a/Source/web/mac/WebScrollbarTheme.mm b/Source/web/mac/WebScrollbarTheme.mm
index 9fa7115dd84ec5320ddd283f220d5137b06aac34..08aa8d77801a7bab4360c0b30eca691c467460e4 100644
--- a/Source/web/mac/WebScrollbarTheme.mm
+++ b/Source/web/mac/WebScrollbarTheme.mm
@@ -47,13 +47,37 @@ void WebScrollbarTheme::updateScrollbars(
float initialButtonDelay, float autoscrollButtonDelay,
ScrollerStyle preferredScrollerStyle, bool redraw)
{
+ // This is necessary to do until the main browser thread begins to call updateScrollbarsWithNSDefaults method.
+ static bool animation_initialized = false;
+ static bool animation_enabled = true;
+ if (!animation_initialized) {
+ // Check setting for OS X 10.8+.
+ id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrollAnimationEnabled"];
+ // Check setting for OS X < 10.8.
+ if (!value)
+ value = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollAnimationEnabled"];
+ if (value)
+ animation_enabled = [value boolValue];
+ animation_initialized = true;
+ }
+ NSString* scrollbar_variant = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollBarVariant"];
+ updateScrollbarsWithNSDefaults(initialButtonDelay, autoscrollButtonDelay,
+ preferredScrollerStyle, redraw, animation_enabled,
+ scrollbar_variant ? [scrollbar_variant UTF8String] : "");
+}
+
+void WebScrollbarTheme::updateScrollbarsWithNSDefaults(
+ float initialButtonDelay, float autoscrollButtonDelay,
+ ScrollerStyle preferredScrollerStyle, bool redraw, bool scrollAnimationEnabled, const std::string& buttonPlacement)
+{
ScrollbarTheme* theme = ScrollbarTheme::theme();
if (theme->isMockTheme())
return;
static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesChanged(
initialButtonDelay, autoscrollButtonDelay,
- static_cast<NSScrollerStyle>(preferredScrollerStyle), redraw);
+ static_cast<NSScrollerStyle>(preferredScrollerStyle),
+ redraw, scrollAnimationEnabled, buttonPlacement);
}
} // namespace blink
« no previous file with comments | « Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm ('k') | public/web/mac/WebScrollbarTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698