summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebView/WebPreferences.mm
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-04 11:41:34 +0100
committerSteve Block <steveblock@google.com>2010-08-09 12:04:44 +0100
commitdb14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch)
tree9f793c5b0f5e1f2aca8247158920e2c4bf962bbf /WebKit/mac/WebView/WebPreferences.mm
parentbf916837aa84f1e4b00e6ed6268516c2acd27545 (diff)
downloadexternal_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
Diffstat (limited to 'WebKit/mac/WebView/WebPreferences.mm')
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm48
1 files changed, 48 insertions, 0 deletions
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index 63915dc..7ec2439 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -30,6 +30,7 @@
#import "WebPreferencesPrivate.h"
#import "WebPreferenceKeysPrivate.h"
+#import "WebApplicationCache.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
#import "WebKitSystemBits.h"
@@ -37,6 +38,7 @@
#import "WebKitVersionChecks.h"
#import "WebNSDictionaryExtras.h"
#import "WebNSURLExtras.h"
+#import <WebCore/ApplicationCacheStorage.h>
NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
@@ -170,6 +172,8 @@ static WebCacheModel cacheModelForMainBundle(void)
- (void)_setIntegerValue:(int)value forKey:(NSString *)key;
- (float)_floatValueForKey:(NSString *)key;
- (void)_setFloatValue:(float)value forKey:(NSString *)key;
+- (void)_setLongLongValue:(long long)value forKey:(NSString *)key;
+- (long long)_longLongValueForKey:(NSString *)key;
- (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key;
- (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
@end
@@ -364,6 +368,8 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:NO], WebKitHTML5TreeBuilderEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey,
+ [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
+ [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
nil];
// This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
@@ -461,6 +467,23 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _postPreferencesChangesNotification];
}
+- (long long)_longLongValueForKey:(NSString *)key
+{
+ id o = [self _valueForKey:key];
+ return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0;
+}
+
+- (void)_setLongLongValue:(long long)value forKey:(NSString *)key
+{
+ if ([self _longLongValueForKey:key] == value)
+ return;
+ NSString *_key = KEY(key);
+ [_private->values _webkit_setLongLong:value forKey:_key];
+ if (_private->autosaves)
+ [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
+ [self _postPreferencesChangesNotification];
+}
+
- (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key
{
id o = [self _valueForKey:key];
@@ -973,6 +996,31 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
}
+- (int64_t)applicationCacheTotalQuota
+{
+ ASSERT([self _longLongValueForKey:WebKitApplicationCacheTotalQuota] == [WebApplicationCache maximumSize]);
+ return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota];
+}
+
+- (void)setApplicationCacheTotalQuota:(int64_t)quota
+{
+ [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota];
+
+ // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
+ [WebApplicationCache setMaximumSize:quota];
+}
+
+- (int64_t)applicationCacheDefaultOriginQuota
+{
+ ASSERT([self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota] == [WebApplicationCache defaultOriginQuota]);
+ return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota];
+}
+
+- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota
+{
+ [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
+}
+
- (PDFDisplayMode)PDFDisplayMode
{
PDFDisplayMode value = [self _integerValueForKey:WebKitPDFDisplayModePreferenceKey];