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

Unified Diff: chrome/browser/ui/cocoa/gesture_utils.mm

Issue 7537003: [Mac] When the Lion gesture preferences are unset, return the intrinsic default of YES. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/gesture_utils.mm
diff --git a/chrome/browser/ui/cocoa/gesture_utils.mm b/chrome/browser/ui/cocoa/gesture_utils.mm
index ff4ebfdd002b9583ddbac14899c92adc1f7b2042..b2e2943d66c45115356ec4adb39fd2077c78a667 100644
--- a/chrome/browser/ui/cocoa/gesture_utils.mm
+++ b/chrome/browser/ui/cocoa/gesture_utils.mm
@@ -29,7 +29,17 @@ BOOL RecognizeTwoFingerGestures() {
// The two-finger gesture is controlled by the preference below and is boolean
// YES for (A, C) and NO for (B).
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
- return [defaults boolForKey:@"AppleEnableSwipeNavigateWithScrolls"];
+ [defaults synchronize];
+
+ // By default, the preference is not set. When it's not, the intrinsic Lion
+ // default (YES) should be returned.
+ NSDictionary* prefs = [defaults dictionaryRepresentation];
+ NSNumber* value = [prefs objectForKey:@"AppleEnableSwipeNavigateWithScrolls"];
+ if (!value)
+ return YES;
+
+ // If the preference is set, return the value.
+ return [value boolValue];
}
// On Lion, returns YES if the scroll direction is "natural"/inverted. All other
@@ -39,11 +49,16 @@ BOOL IsScrollDirectionInverted() {
return NO;
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
- // The defaults must be synchronized here otherwise a stale value will be
- // returned for an indeterminate amount of time. For some reason, this is
- // not necessary in |-recognizeTwoFingerGestures|.
[defaults synchronize];
- return [defaults boolForKey:@"com.apple.swipescrolldirection"];
+
+ // By default, the preference is not set. When it's not, the intrinsic Lion
+ // default (YES) should be returned.
+ NSDictionary* prefs = [defaults dictionaryRepresentation];
+ NSNumber* value = [prefs objectForKey:@"com.apple.swipescrolldirection"];
+ if (!value)
+ return YES;
+
+ return [value boolValue];
}
} // namespace gesture_utils
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698