⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webpreferences.mm

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 MM
📖 第 1 页 / 共 3 页
字号:
- (void)setDeveloperExtrasEnabled:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitDeveloperExtrasEnabledPreferenceKey];}- (BOOL)authorAndUserStylesEnabled{    return [self _boolValueForKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];}- (void)setAuthorAndUserStylesEnabled:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];}- (BOOL)applicationChromeModeEnabled{    return [self _boolValueForKey:WebKitApplicationChromeModeEnabledPreferenceKey];}- (void)setApplicationChromeModeEnabled:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitApplicationChromeModeEnabledPreferenceKey];}- (BOOL)webArchiveDebugModeEnabled{    return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];}- (void)setWebArchiveDebugModeEnabled:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];}- (BOOL)offlineWebApplicationCacheEnabled{    return [self _boolValueForKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];}- (void)setOfflineWebApplicationCacheEnabled:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];}- (BOOL)zoomsTextOnly{    return [self _boolValueForKey:WebKitZoomsTextOnlyPreferenceKey];}- (void)setZoomsTextOnly:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey];}- (BOOL)respectStandardStyleKeyEquivalents{    return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];}- (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];}- (BOOL)showsURLsInToolTips{    return [self _boolValueForKey:WebKitShowsURLsInToolTipsPreferenceKey];}- (void)setShowsURLsInToolTips:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitShowsURLsInToolTipsPreferenceKey];}- (BOOL)textAreasAreResizable{    return [self _boolValueForKey: WebKitTextAreasAreResizablePreferenceKey];}- (void)setTextAreasAreResizable:(BOOL)flag{    [self _setBoolValue: flag forKey: WebKitTextAreasAreResizablePreferenceKey];}- (BOOL)shrinksStandaloneImagesToFit{    return [self _boolValueForKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];}- (void)setShrinksStandaloneImagesToFit:(BOOL)flag{    [self _setBoolValue:flag forKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];}- (BOOL)automaticallyDetectsCacheModel{    return _private->automaticallyDetectsCacheModel;}- (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel{    _private->automaticallyDetectsCacheModel = automaticallyDetectsCacheModel;}- (BOOL)isWebSecurityEnabled{    return [self _boolValueForKey: WebKitWebSecurityEnabledPreferenceKey];}- (void)setWebSecurityEnabled:(BOOL)flag{    [self _setBoolValue: flag forKey: WebKitWebSecurityEnabledPreferenceKey];}- (BOOL)allowUniversalAccessFromFileURLs{    return [self _boolValueForKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];}- (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag{    [self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];}- (NSTimeInterval)_backForwardCacheExpirationInterval{    // FIXME: There's probably no good reason to read from the standard user defaults instead of self.    return (NSTimeInterval)[[NSUserDefaults standardUserDefaults] floatForKey:WebKitBackForwardCacheExpirationIntervalKey];}- (float)PDFScaleFactor{    return [self _floatValueForKey:WebKitPDFScaleFactorPreferenceKey];}- (void)setPDFScaleFactor:(float)factor{    [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];}- (PDFDisplayMode)PDFDisplayMode{    PDFDisplayMode value = [self _integerValueForKey:WebKitPDFDisplayModePreferenceKey];    if (value != kPDFDisplaySinglePage && value != kPDFDisplaySinglePageContinuous && value != kPDFDisplayTwoUp && value != kPDFDisplayTwoUpContinuous) {        // protect against new modes from future versions of OS X stored in defaults        value = kPDFDisplaySinglePageContinuous;    }    return value;}- (void)setPDFDisplayMode:(PDFDisplayMode)mode{    [self _setIntegerValue:mode forKey:WebKitPDFDisplayModePreferenceKey];}- (WebKitEditableLinkBehavior)editableLinkBehavior{    WebKitEditableLinkBehavior value = static_cast<WebKitEditableLinkBehavior> ([self _integerValueForKey:WebKitEditableLinkBehaviorPreferenceKey]);    if (value != WebKitEditableLinkDefaultBehavior &&        value != WebKitEditableLinkAlwaysLive &&        value != WebKitEditableLinkNeverLive &&        value != WebKitEditableLinkOnlyLiveWithShiftKey &&        value != WebKitEditableLinkLiveWhenNotFocused) {        // ensure that a valid result is returned        value = WebKitEditableLinkDefaultBehavior;    }        return value;}- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior{    [self _setIntegerValue:behavior forKey:WebKitEditableLinkBehaviorPreferenceKey];}- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior{    WebTextDirectionSubmenuInclusionBehavior value = static_cast<WebTextDirectionSubmenuInclusionBehavior>([self _integerValueForKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey]);    if (value != WebTextDirectionSubmenuNeverIncluded &&        value != WebTextDirectionSubmenuAutomaticallyIncluded &&        value != WebTextDirectionSubmenuAlwaysIncluded) {        // Ensure that a valid result is returned.        value = WebTextDirectionSubmenuNeverIncluded;    }    return value;}- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior{    [self _setIntegerValue:behavior forKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey];}- (BOOL)_useSiteSpecificSpoofing{    return [self _boolValueForKey:WebKitUseSiteSpecificSpoofingPreferenceKey];}- (void)_setUseSiteSpecificSpoofing:(BOOL)newValue{    [self _setBoolValue:newValue forKey:WebKitUseSiteSpecificSpoofingPreferenceKey];}- (BOOL)databasesEnabled{    return [self _boolValueForKey:WebKitDatabasesEnabledPreferenceKey];}- (void)setDatabasesEnabled:(BOOL)databasesEnabled{    [self _setBoolValue:databasesEnabled forKey:WebKitDatabasesEnabledPreferenceKey];}- (BOOL)localStorageEnabled{    return [self _boolValueForKey:WebKitLocalStorageEnabledPreferenceKey];}- (void)setLocalStorageEnabled:(BOOL)localStorageEnabled{    [self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey];}+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident{    LOG(Encoding, "requesting for %@\n", ident);    if (!ident)        return _standardPreferences;        WebPreferences *instance = [webPreferencesInstances objectForKey:[self _concatenateKeyWithIBCreatorID:ident]];    return instance;}+ (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)ident{    if (!webPreferencesInstances)        webPreferencesInstances = [[NSMutableDictionary alloc] init];    if (ident) {        [webPreferencesInstances setObject:instance forKey:[self _concatenateKeyWithIBCreatorID:ident]];        LOG(Encoding, "recording %p for %@\n", instance, [self _concatenateKeyWithIBCreatorID:ident]);    }}+ (void)_checkLastReferenceForIdentifier:(id)identifier{    // FIXME: This won't work at all under garbage collection because retainCount returns a constant.    // We may need to change WebPreferences API so there's an explicit way to end the lifetime of one.    WebPreferences *instance = [webPreferencesInstances objectForKey:identifier];    if ([instance retainCount] == 1)        [webPreferencesInstances removeObjectForKey:identifier];}+ (void)_removeReferenceForIdentifier:(NSString *)ident{    if (ident)        [self performSelector:@selector(_checkLastReferenceForIdentifier:) withObject:[self _concatenateKeyWithIBCreatorID:ident] afterDelay:0.1];}- (void)_postPreferencesChangesNotification{    [[NSNotificationCenter defaultCenter]        postNotificationName:WebPreferencesChangedNotification object:self                    userInfo:nil];}+ (CFStringEncoding)_systemCFStringEncoding{    return WKGetWebDefaultCFStringEncoding();}+ (void)_setInitialDefaultTextEncodingToSystemEncoding{    NSString *systemEncodingName = (NSString *)CFStringConvertEncodingToIANACharSetName([self _systemCFStringEncoding]);    // CFStringConvertEncodingToIANACharSetName() returns CP949 for kTextEncodingDOSKorean AKA "extended EUC-KR" AKA windows-939.    // ICU uses this name for a different encoding, so we need to change the name to a value that actually gives us windows-939.    // In addition, this value must match what is used in Safari, see <rdar://problem/5579292>.    if ([systemEncodingName isEqualToString:@"CP949"])        systemEncodingName = @"ks_c_5601-1987";    [[NSUserDefaults standardUserDefaults] registerDefaults:        [NSDictionary dictionaryWithObject:systemEncodingName forKey:WebKitDefaultTextEncodingNamePreferenceKey]];}static NSString *classIBCreatorID = nil;+ (void)_setIBCreatorID:(NSString *)string{    NSString *old = classIBCreatorID;    classIBCreatorID = [string copy];    [old release];}- (BOOL)isDOMPasteAllowed{    return [self _boolValueForKey:WebKitDOMPasteAllowedPreferenceKey];}- (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed{    [self _setBoolValue:DOMPasteAllowed forKey:WebKitDOMPasteAllowedPreferenceKey];}- (void)_setFTPDirectoryTemplatePath:(NSString *)path{    [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitFTPDirectoryTemplatePath];}- (NSString *)_localStorageDatabasePath{    return [[self _stringValueForKey:WebKitLocalStorageDatabasePathPreferenceKey] stringByStandardizingPath];}- (void)_setLocalStorageDatabasePath:(NSString *)path{    [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitLocalStorageDatabasePathPreferenceKey];}- (NSString *)_ftpDirectoryTemplatePath{    return [[self _stringValueForKey:WebKitFTPDirectoryTemplatePath] stringByStandardizingPath];}- (void)_setForceFTPDirectoryListings:(BOOL)force{    [self _setBoolValue:force forKey:WebKitForceFTPDirectoryListings];}- (BOOL)_forceFTPDirectoryListings{    return [self _boolValueForKey:WebKitForceFTPDirectoryListings];}- (void)didRemoveFromWebView{    ASSERT(_private->numWebViews);    if (--_private->numWebViews == 0)        [[NSNotificationCenter defaultCenter]            postNotificationName:WebPreferencesRemovedNotification                          object:self                        userInfo:nil];}- (void)willAddToWebView{    ++_private->numWebViews;}- (void)setFullDocumentTeardownEnabled:(BOOL)fullDocumentTeardownEnabled{    [self _setBoolValue:fullDocumentTeardownEnabled forKey:WebKitEnableFullDocumentTeardownPreferenceKey];}- (BOOL)fullDocumentTeardownEnabled{    return [self _boolValueForKey:WebKitEnableFullDocumentTeardownPreferenceKey];}@end@implementation WebPreferences (WebInternal)+ (NSString *)_IBCreatorID{    return classIBCreatorID;}+ (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key{    NSString *IBCreatorID = [WebPreferences _IBCreatorID];    if (!IBCreatorID)        return key;    return [IBCreatorID stringByAppendingString:key];}@end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -