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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 40
41 namespace blink { 41 namespace blink {
42 42
43 static_assert(static_cast<NSScrollerStyle>(ScrollerStyleLegacy) == NSScrollerSty leLegacy, "ScrollerStyleLegacy must match NSScrollerStyleLegacy"); 43 static_assert(static_cast<NSScrollerStyle>(ScrollerStyleLegacy) == NSScrollerSty leLegacy, "ScrollerStyleLegacy must match NSScrollerStyleLegacy");
44 static_assert(static_cast<NSScrollerStyle>(ScrollerStyleOverlay) == NSScrollerSt yleOverlay, "ScrollerStyleOverlay must match NSScrollerStyleOverlay"); 44 static_assert(static_cast<NSScrollerStyle>(ScrollerStyleOverlay) == NSScrollerSt yleOverlay, "ScrollerStyleOverlay must match NSScrollerStyleOverlay");
45 45
46 void WebScrollbarTheme::updateScrollbars( 46 void WebScrollbarTheme::updateScrollbars(
47 float initialButtonDelay, float autoscrollButtonDelay, 47 float initialButtonDelay, float autoscrollButtonDelay,
48 ScrollerStyle preferredScrollerStyle, bool redraw) 48 ScrollerStyle preferredScrollerStyle, bool redraw)
49 { 49 {
50 // This is necessary to do until the main browser thread begins to call upda teScrollbarsWithNSDefaults method.
51 static bool animation_initialized = false;
52 static bool animation_enabled = true;
53 if (!animation_initialized) {
54 // Check setting for OS X 10.8+.
55 id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrol lAnimationEnabled"];
56 // Check setting for OS X < 10.8.
57 if (!value)
58 value = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleS crollAnimationEnabled"];
59 if (value)
60 animation_enabled = [value boolValue];
61 animation_initialized = true;
62 }
63 NSString* scrollbar_variant = [[NSUserDefaults standardUserDefaults] objectF orKey:@"AppleScrollBarVariant"];
64 updateScrollbarsWithNSDefaults(initialButtonDelay, autoscrollButtonDelay,
65 preferredScrollerStyle, redraw, animation_enab led,
66 scrollbar_variant ? [scrollbar_variant UTF8Str ing] : "");
67 }
68
69 void WebScrollbarTheme::updateScrollbarsWithNSDefaults(
70 float initialButtonDelay, float autoscrollButtonDelay,
71 ScrollerStyle preferredScrollerStyle, bool redraw, bool scrollAnimationEnabl ed, const std::string& buttonPlacement)
72 {
50 ScrollbarTheme* theme = ScrollbarTheme::theme(); 73 ScrollbarTheme* theme = ScrollbarTheme::theme();
51 if (theme->isMockTheme()) 74 if (theme->isMockTheme())
52 return; 75 return;
53 76
54 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged( 77 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged(
55 initialButtonDelay, autoscrollButtonDelay, 78 initialButtonDelay, autoscrollButtonDelay,
56 static_cast<NSScrollerStyle>(preferredScrollerStyle), redraw); 79 static_cast<NSScrollerStyle>(preferredScrollerStyle),
80 redraw, scrollAnimationEnabled, buttonPlacement);
57 } 81 }
58 82
59 } // namespace blink 83 } // namespace blink
OLDNEW
« 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