| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |