diff options
Diffstat (limited to 'WebKit/mac/Storage')
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseQuotaManager.h (renamed from WebKit/mac/Storage/WebDatabaseSecurityOrigin.h) | 7 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseQuotaManager.mm (renamed from WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm) | 53 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseTrackerClient.h | 2 |
3 files changed, 53 insertions, 9 deletions
diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h b/WebKit/mac/Storage/WebDatabaseQuotaManager.h index a06ca3d..8219da4 100644 --- a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h +++ b/WebKit/mac/Storage/WebDatabaseQuotaManager.h @@ -23,7 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#import "WebSecurityOriginInternal.h" +#import "WebQuotaManager.h" + +@interface WebDatabaseQuotaManager : NSObject <WebQuotaManager> { + WebSecurityOrigin *_origin; +} -@interface WebDatabaseSecurityOrigin : WebSecurityOrigin @end diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm b/WebKit/mac/Storage/WebDatabaseQuotaManager.mm index a0c3529..e26ae33 100644 --- a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm +++ b/WebKit/mac/Storage/WebDatabaseQuotaManager.mm @@ -23,15 +23,56 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#import "WebDatabaseSecurityOrigin.h" -#import <WebCore/SecurityOrigin.h> +#import "WebDatabaseQuotaManager.h" + +#import "WebSecurityOriginInternal.h" +#import <WebCore/DatabaseTracker.h> using namespace WebCore; -@implementation WebDatabaseSecurityOrigin +@implementation WebDatabaseQuotaManager + +- (id)initWithOrigin:(WebSecurityOrigin *)origin +{ + self = [super init]; + if (!self) + return nil; + + _origin = origin; + return self; +} + +- (WebSecurityOrigin *)origin +{ + return _origin; +} + +- (unsigned long long)usage +{ +#if ENABLE(DATABASE) + return DatabaseTracker::tracker().usageForOrigin([_origin _core]); +#else + return 0; +#endif +} + +- (unsigned long long)quota +{ +#if ENABLE(DATABASE) + return DatabaseTracker::tracker().quotaForOrigin([_origin _core]); +#else + return 0; +#endif +} -// FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627 -// Proper steps should be taken to have subclass implementations of SecurityOrigin's -// origin, quota, and setQuota methods. +// If the quota is set to a value lower than the current usage, that quota will +// "stick" but no data will be purged to meet the new quota. This will simply +// prevent new data from being added to databases in that origin. +- (void)setQuota:(unsigned long long)quota +{ +#if ENABLE(DATABASE) + DatabaseTracker::tracker().setQuota([_origin _core], quota); +#endif +} @end diff --git a/WebKit/mac/Storage/WebDatabaseTrackerClient.h b/WebKit/mac/Storage/WebDatabaseTrackerClient.h index d06cfe9..cbb5eb7 100644 --- a/WebKit/mac/Storage/WebDatabaseTrackerClient.h +++ b/WebKit/mac/Storage/WebDatabaseTrackerClient.h @@ -36,7 +36,7 @@ public: virtual ~WebDatabaseTrackerClient(); virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*); - virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WebCore::String& databaseIdentifier); + virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WTF::String& databaseIdentifier); private: WebDatabaseTrackerClient(); }; |