LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * Copyright (C) 2014-2016 Apple Inc. All rights reserved. | 2 * Copyright (C) 2014-2016 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 static NSString * const LargeImageAsyncDecodingEnabledPreferenceKey = @"LargeIma
geAsyncDecodingEnabled"; | 65 static NSString * const LargeImageAsyncDecodingEnabledPreferenceKey = @"LargeIma
geAsyncDecodingEnabled"; |
66 static NSString * const AnimatedImageAsyncDecodingEnabledPreferenceKey = @"Anima
tedImageAsyncDecodingEnabled"; | 66 static NSString * const AnimatedImageAsyncDecodingEnabledPreferenceKey = @"Anima
tedImageAsyncDecodingEnabled"; |
67 | 67 |
68 // This default name intentionally overlaps with the key that WebKit2 checks whe
n creating a view. | 68 // This default name intentionally overlaps with the key that WebKit2 checks whe
n creating a view. |
69 static NSString * const UseRemoteLayerTreeDrawingAreaPreferenceKey = @"WebKit2Us
eRemoteLayerTreeDrawingArea"; | 69 static NSString * const UseRemoteLayerTreeDrawingAreaPreferenceKey = @"WebKit2Us
eRemoteLayerTreeDrawingArea"; |
70 | 70 |
71 static NSString * const PerWindowWebProcessesDisabledKey = @"PerWindowWebProcess
esDisabled"; | 71 static NSString * const PerWindowWebProcessesDisabledKey = @"PerWindowWebProcess
esDisabled"; |
72 static NSString * const NetworkCacheSpeculativeRevalidationDisabledKey = @"Netwo
rkCacheSpeculativeRevalidationDisabled"; | 72 static NSString * const NetworkCacheSpeculativeRevalidationDisabledKey = @"Netwo
rkCacheSpeculativeRevalidationDisabled"; |
73 static NSString * const ProcessSwapOnNavigationKey = @"ProcessSwapOnNavigation"; | 73 static NSString * const ProcessSwapOnNavigationKey = @"ProcessSwapOnNavigation"; |
74 static NSString * const ProcessSwapOnWindowOpenWithOpenerKey = @"ProcessSwapOnWi
ndowOpenWithOpener"; | 74 static NSString * const ProcessSwapOnWindowOpenWithOpenerKey = @"ProcessSwapOnWi
ndowOpenWithOpener"; |
| 75 static NSString * const SafeBrowsingEnabledPreferenceKey = @"SafeBrowsingEnabled
"; |
75 | 76 |
76 typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) { | 77 typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) { |
77 NonFastScrollableRegionOverlayTag = 100, | 78 NonFastScrollableRegionOverlayTag = 100, |
78 WheelEventHandlerRegionOverlayTag, | 79 WheelEventHandlerRegionOverlayTag, |
79 #if WK_API_ENABLED | 80 #if WK_API_ENABLED |
80 ExperimentalFeatureTag, | 81 ExperimentalFeatureTag, |
81 #endif | 82 #endif |
82 }; | 83 }; |
83 | 84 |
84 @implementation SettingsController | 85 @implementation SettingsController |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 [self _addItemWithTitle:@"Reserve Space For Banners" action:@selector(toggle
ReserveSpaceForBanners:) indented:YES]; | 177 [self _addItemWithTitle:@"Reserve Space For Banners" action:@selector(toggle
ReserveSpaceForBanners:) indented:YES]; |
177 [self _addItemWithTitle:@"Show Tiled Scrolling Indicator" action:@selector(t
oggleShowTiledScrollingIndicator:) indented:YES]; | 178 [self _addItemWithTitle:@"Show Tiled Scrolling Indicator" action:@selector(t
oggleShowTiledScrollingIndicator:) indented:YES]; |
178 [self _addItemWithTitle:@"Use UI-Side Compositing" action:@selector(toggleUs
eUISideCompositing:) indented:YES]; | 179 [self _addItemWithTitle:@"Use UI-Side Compositing" action:@selector(toggleUs
eUISideCompositing:) indented:YES]; |
179 [self _addItemWithTitle:@"Disable Per-Window Web Processes" action:@selector
(togglePerWindowWebProcessesDisabled:) indented:YES]; | 180 [self _addItemWithTitle:@"Disable Per-Window Web Processes" action:@selector
(togglePerWindowWebProcessesDisabled:) indented:YES]; |
180 [self _addItemWithTitle:@"Show Resource Usage Overlay" action:@selector(togg
leShowResourceUsageOverlay:) indented:YES]; | 181 [self _addItemWithTitle:@"Show Resource Usage Overlay" action:@selector(togg
leShowResourceUsageOverlay:) indented:YES]; |
181 [self _addItemWithTitle:@"Load All Site Icons Per-Page" action:@selector(tog
gleLoadsAllSiteIcons:) indented:YES]; | 182 [self _addItemWithTitle:@"Load All Site Icons Per-Page" action:@selector(tog
gleLoadsAllSiteIcons:) indented:YES]; |
182 [self _addItemWithTitle:@"Use GameController.framework on macOS (Restart req
uired)" action:@selector(toggleUsesGameControllerFramework:) indented:YES]; | 183 [self _addItemWithTitle:@"Use GameController.framework on macOS (Restart req
uired)" action:@selector(toggleUsesGameControllerFramework:) indented:YES]; |
183 [self _addItemWithTitle:@"Disable network cache speculative revalidation" ac
tion:@selector(toggleNetworkCacheSpeculativeRevalidationDisabled:) indented:YES]
; | 184 [self _addItemWithTitle:@"Disable network cache speculative revalidation" ac
tion:@selector(toggleNetworkCacheSpeculativeRevalidationDisabled:) indented:YES]
; |
184 [self _addItemWithTitle:@"Enable Process Swap on Navigation" action:@selecto
r(toggleProcessSwapOnNavigation:) indented:YES]; | 185 [self _addItemWithTitle:@"Enable Process Swap on Navigation" action:@selecto
r(toggleProcessSwapOnNavigation:) indented:YES]; |
185 [self _addItemWithTitle:@"Enable Process Swap on window.open() with an opene
r" action:@selector(toggleProcessSwapOnWindowOpenWithOpener:) indented:YES]; | 186 [self _addItemWithTitle:@"Enable Process Swap on window.open() with an opene
r" action:@selector(toggleProcessSwapOnWindowOpenWithOpener:) indented:YES]; |
| 187 [self _addItemWithTitle:@"Enable SafeBrowsing" action:@selector(toggleSafeBr
owsingEnabled:) indented:YES]; |
186 | 188 |
187 NSMenuItem *debugOverlaysSubmenuItem = [[NSMenuItem alloc] initWithTitle:@"D
ebug Overlays" action:nil keyEquivalent:@""]; | 189 NSMenuItem *debugOverlaysSubmenuItem = [[NSMenuItem alloc] initWithTitle:@"D
ebug Overlays" action:nil keyEquivalent:@""]; |
188 NSMenu *debugOverlaysMenu = [[NSMenu alloc] initWithTitle:@"Debug Overlays"]
; | 190 NSMenu *debugOverlaysMenu = [[NSMenu alloc] initWithTitle:@"Debug Overlays"]
; |
189 [debugOverlaysSubmenuItem setSubmenu:debugOverlaysMenu]; | 191 [debugOverlaysSubmenuItem setSubmenu:debugOverlaysMenu]; |
190 | 192 |
191 NSMenuItem *nonFastScrollableRegionItem = [[NSMenuItem alloc] initWithTitle:
@"Non-fast Scrollable Region" action:@selector(toggleDebugOverlay:) keyEquivalen
t:@""]; | 193 NSMenuItem *nonFastScrollableRegionItem = [[NSMenuItem alloc] initWithTitle:
@"Non-fast Scrollable Region" action:@selector(toggleDebugOverlay:) keyEquivalen
t:@""]; |
192 [nonFastScrollableRegionItem setTag:NonFastScrollableRegionOverlayTag]; | 194 [nonFastScrollableRegionItem setTag:NonFastScrollableRegionOverlayTag]; |
193 [nonFastScrollableRegionItem setTarget:self]; | 195 [nonFastScrollableRegionItem setTarget:self]; |
194 [debugOverlaysMenu addItem:[nonFastScrollableRegionItem autorelease]]; | 196 [debugOverlaysMenu addItem:[nonFastScrollableRegionItem autorelease]]; |
195 | 197 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 else if (action == @selector(toggleLoadsAllSiteIcons:)) | 273 else if (action == @selector(toggleLoadsAllSiteIcons:)) |
272 [menuItem setState:[self loadsAllSiteIcons] ? NSControlStateValueOn : NS
ControlStateValueOff]; | 274 [menuItem setState:[self loadsAllSiteIcons] ? NSControlStateValueOn : NS
ControlStateValueOff]; |
273 else if (action == @selector(toggleUsesGameControllerFramework:)) | 275 else if (action == @selector(toggleUsesGameControllerFramework:)) |
274 [menuItem setState:[self usesGameControllerFramework] ? NSControlStateVa
lueOn : NSControlStateValueOff]; | 276 [menuItem setState:[self usesGameControllerFramework] ? NSControlStateVa
lueOn : NSControlStateValueOff]; |
275 else if (action == @selector(toggleNetworkCacheSpeculativeRevalidationDisabl
ed:)) | 277 else if (action == @selector(toggleNetworkCacheSpeculativeRevalidationDisabl
ed:)) |
276 [menuItem setState:[self networkCacheSpeculativeRevalidationDisabled] ?
NSControlStateValueOn : NSControlStateValueOff]; | 278 [menuItem setState:[self networkCacheSpeculativeRevalidationDisabled] ?
NSControlStateValueOn : NSControlStateValueOff]; |
277 else if (action == @selector(toggleProcessSwapOnNavigation:)) | 279 else if (action == @selector(toggleProcessSwapOnNavigation:)) |
278 [menuItem setState:[self processSwapOnNavigationEnabled] ? NSControlStat
eValueOn : NSControlStateValueOff]; | 280 [menuItem setState:[self processSwapOnNavigationEnabled] ? NSControlStat
eValueOn : NSControlStateValueOff]; |
279 else if (action == @selector(toggleProcessSwapOnWindowOpenWithOpener:)) | 281 else if (action == @selector(toggleProcessSwapOnWindowOpenWithOpener:)) |
280 [menuItem setState:[self processSwapOnWindowOpenWithOpenerEnabled] ? NSC
ontrolStateValueOn : NSControlStateValueOff]; | 282 [menuItem setState:[self processSwapOnWindowOpenWithOpenerEnabled] ? NSC
ontrolStateValueOn : NSControlStateValueOff]; |
| 283 else if (action == @selector(toggleSafeBrowsingEnabled:)) |
| 284 [menuItem setState:[self safeBrowsingEnabled] ? NSControlStateValueOn :
NSControlStateValueOff]; |
281 else if (action == @selector(toggleUseUISideCompositing:)) | 285 else if (action == @selector(toggleUseUISideCompositing:)) |
282 [menuItem setState:[self useUISideCompositing] ? NSControlStateValueOn :
NSControlStateValueOff]; | 286 [menuItem setState:[self useUISideCompositing] ? NSControlStateValueOn :
NSControlStateValueOff]; |
283 else if (action == @selector(togglePerWindowWebProcessesDisabled:)) | 287 else if (action == @selector(togglePerWindowWebProcessesDisabled:)) |
284 [menuItem setState:[self perWindowWebProcessesDisabled] ? NSControlState
ValueOn : NSControlStateValueOff]; | 288 [menuItem setState:[self perWindowWebProcessesDisabled] ? NSControlState
ValueOn : NSControlStateValueOff]; |
285 else if (action == @selector(toggleEnableSubPixelCSSOMMetrics:)) | 289 else if (action == @selector(toggleEnableSubPixelCSSOMMetrics:)) |
286 [menuItem setState:[self subPixelCSSOMMetricsEnabled] ? NSControlStateVa
lueOn : NSControlStateValueOff]; | 290 [menuItem setState:[self subPixelCSSOMMetricsEnabled] ? NSControlStateVa
lueOn : NSControlStateValueOff]; |
287 else if (action == @selector(toggleDebugOverlay:)) | 291 else if (action == @selector(toggleDebugOverlay:)) |
288 [menuItem setState:[self debugOverlayVisible:menuItem] ? NSControlStateV
alueOn : NSControlStateValueOff]; | 292 [menuItem setState:[self debugOverlayVisible:menuItem] ? NSControlStateV
alueOn : NSControlStateValueOff]; |
289 | 293 |
290 #if WK_API_ENABLED | 294 #if WK_API_ENABLED |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 - (BOOL)processSwapOnWindowOpenWithOpenerEnabled | 510 - (BOOL)processSwapOnWindowOpenWithOpenerEnabled |
507 { | 511 { |
508 return [[NSUserDefaults standardUserDefaults] boolForKey:ProcessSwapOnWindow
OpenWithOpenerKey]; | 512 return [[NSUserDefaults standardUserDefaults] boolForKey:ProcessSwapOnWindow
OpenWithOpenerKey]; |
509 } | 513 } |
510 | 514 |
511 - (void)toggleProcessSwapOnWindowOpenWithOpener:(id)sender | 515 - (void)toggleProcessSwapOnWindowOpenWithOpener:(id)sender |
512 { | 516 { |
513 [self _toggleBooleanDefault:ProcessSwapOnWindowOpenWithOpenerKey]; | 517 [self _toggleBooleanDefault:ProcessSwapOnWindowOpenWithOpenerKey]; |
514 } | 518 } |
515 | 519 |
| 520 - (BOOL)safeBrowsingEnabled |
| 521 { |
| 522 return [[NSUserDefaults standardUserDefaults] boolForKey:SafeBrowsingEnabled
PreferenceKey]; |
| 523 } |
| 524 |
| 525 - (void)toggleSafeBrowsingEnabled:(id)sender |
| 526 { |
| 527 [self _toggleBooleanDefault:SafeBrowsingEnabledPreferenceKey]; |
| 528 } |
| 529 |
516 - (BOOL)isSpaceReservedForBanners | 530 - (BOOL)isSpaceReservedForBanners |
517 { | 531 { |
518 return [[NSUserDefaults standardUserDefaults] boolForKey:ReserveSpaceForBann
ersPreferenceKey]; | 532 return [[NSUserDefaults standardUserDefaults] boolForKey:ReserveSpaceForBann
ersPreferenceKey]; |
519 } | 533 } |
520 | 534 |
521 - (BOOL)tiledScrollingIndicatorVisible | 535 - (BOOL)tiledScrollingIndicatorVisible |
522 { | 536 { |
523 return [[NSUserDefaults standardUserDefaults] boolForKey:TiledScrollingIndic
atorVisiblePreferenceKey]; | 537 return [[NSUserDefaults standardUserDefaults] boolForKey:TiledScrollingIndic
atorVisiblePreferenceKey]; |
524 } | 538 } |
525 | 539 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 NSString *customDefaultURL = nil; | 657 NSString *customDefaultURL = nil; |
644 | 658 |
645 if ([windowController isKindOfClass:[BrowserWindowController class]]) | 659 if ([windowController isKindOfClass:[BrowserWindowController class]]) |
646 customDefaultURL = [[(BrowserWindowController *)windowController current
URL] absoluteString]; | 660 customDefaultURL = [[(BrowserWindowController *)windowController current
URL] absoluteString]; |
647 | 661 |
648 if (customDefaultURL) | 662 if (customDefaultURL) |
649 [[NSUserDefaults standardUserDefaults] setObject:customDefaultURL forKey
:DefaultURLPreferenceKey]; | 663 [[NSUserDefaults standardUserDefaults] setObject:customDefaultURL forKey
:DefaultURLPreferenceKey]; |
650 } | 664 } |
651 | 665 |
652 @end | 666 @end |
LEFT | RIGHT |