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

Side by Side Diff: Source/web/mac/WebScrollbarTheme.mm

Issue 1245323002: Pass scroll bar placement as an enum instead of std::string (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updates per code review 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 if (!animation_initialized) { 53 if (!animation_initialized) {
54 // Check setting for OS X 10.8+. 54 // Check setting for OS X 10.8+.
55 id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrol lAnimationEnabled"]; 55 id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrol lAnimationEnabled"];
56 // Check setting for OS X < 10.8. 56 // Check setting for OS X < 10.8.
57 if (!value) 57 if (!value)
58 value = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleS crollAnimationEnabled"]; 58 value = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleS crollAnimationEnabled"];
59 if (value) 59 if (value)
60 animation_enabled = [value boolValue]; 60 animation_enabled = [value boolValue];
61 animation_initialized = true; 61 animation_initialized = true;
62 } 62 }
63 // More temporary logic used until the browser begins to call updateScrollba rsWithNSDefaults method.
63 NSString* scrollbar_variant = [[NSUserDefaults standardUserDefaults] objectF orKey:@"AppleScrollBarVariant"]; 64 NSString* scrollbar_variant = [[NSUserDefaults standardUserDefaults] objectF orKey:@"AppleScrollBarVariant"];
65 ScrollbarButtonsPlacement buttons_placement;
66 if ([scrollbar_variant isEqualToString:@"Single"])
67 buttons_placement = ScrollbarButtonsPlacementSingle;
68 else if ([scrollbar_variant isEqualToString:@"DoubleMin"])
69 buttons_placement = ScrollbarButtonsPlacementDoubleStart;
70 else if ([scrollbar_variant isEqualToString:@"DoubleBoth"])
71 buttons_placement = ScrollbarButtonsPlacementDoubleBoth;
72 else
73 buttons_placement = ScrollbarButtonsPlacementDoubleEnd;
64 updateScrollbarsWithNSDefaults(initialButtonDelay, autoscrollButtonDelay, 74 updateScrollbarsWithNSDefaults(initialButtonDelay, autoscrollButtonDelay,
65 preferredScrollerStyle, redraw, animation_enab led, 75 preferredScrollerStyle, redraw, animation_enab led,
66 scrollbar_variant ? [scrollbar_variant UTF8Str ing] : ""); 76 buttons_placement);
67 } 77 }
68 78
69 void WebScrollbarTheme::updateScrollbarsWithNSDefaults( 79 void WebScrollbarTheme::updateScrollbarsWithNSDefaults(
70 float initialButtonDelay, float autoscrollButtonDelay, 80 float initialButtonDelay, float autoscrollButtonDelay,
71 ScrollerStyle preferredScrollerStyle, bool redraw, bool scrollAnimationEnabl ed, const std::string& buttonPlacement) 81 ScrollerStyle preferredScrollerStyle, bool redraw, bool scrollAnimationEnabl ed, ScrollbarButtonsPlacement buttonPlacement)
72 { 82 {
73 ScrollbarTheme* theme = ScrollbarTheme::theme(); 83 ScrollbarTheme* theme = ScrollbarTheme::theme();
74 if (theme->isMockTheme()) 84 if (theme->isMockTheme())
75 return; 85 return;
76 86
77 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged( 87 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged(
78 initialButtonDelay, autoscrollButtonDelay, 88 initialButtonDelay, autoscrollButtonDelay,
79 static_cast<NSScrollerStyle>(preferredScrollerStyle), 89 static_cast<NSScrollerStyle>(preferredScrollerStyle),
80 redraw, scrollAnimationEnabled, buttonPlacement); 90 redraw, scrollAnimationEnabled, buttonPlacement);
81 } 91 }
82 92
83 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm ('k') | public/platform/mac/MacScrollTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698