WebKit/mac:
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2007 17:34:57 +0000 (17:34 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2007 17:34:57 +0000 (17:34 +0000)
        Reviewed by John

        Database management API tweaks

        Fleshed out "WebSecurityOrigin" to be the API object representing an origin.  This relieves some
        burden off WebDatabaseManager and allows usage/quota operations on the SecurityOrigin object itself

        Also added a new subdirectory for Storage related API - Why are we afraid to add new directories to
        the WebKit tree?

        * Misc/WebSecurityOrigin.mm: Removed.
        * Misc/WebSecurityOriginInternal.h: Removed.
        * Misc/WebSecurityOriginPrivate.h: Removed.

        * Storage/WebDatabaseManager.mm: Work in terms of WebSecurityOrigin
        * Storage/WebDatabaseManagerPrivate.h:

        * Storage/WebSecurityOrigin.mm: Added.
        (-[WebSecurityOriginPrivate initWithProtocol:domain:port:]):
        (-[WebSecurityOriginPrivate initWithWebCoreSecurityOrigin:]):
        (-[WebSecurityOriginPrivate finalize]):
        (-[WebSecurityOriginPrivate dealloc]):
        (-[WebSecurityOrigin initWithProtocol:domain:]):
        (-[WebSecurityOrigin initWithProtocol:domain:port:]):
        (-[WebSecurityOrigin protocol]):
        (-[WebSecurityOrigin domain]):
        (-[WebSecurityOrigin port]):
        (-[WebSecurityOrigin usage]):
        (-[WebSecurityOrigin quota]):
        (-[WebSecurityOrigin setQuota:]): Clients will set quotas on the WebSecurityOrigin object itself
        (-[WebSecurityOrigin dealloc]):
        (-[WebSecurityOrigin _initWithWebCoreSecurityOriginData:]):
        * Storage/WebSecurityOriginInternal.h: Added.
        * Storage/WebSecurityOriginPrivate.h: Added.

WebKit:

        Reviewed by John

        Database management API tweaks

        * WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27853 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/mac/ChangeLog
WebKit/mac/Storage/WebDatabaseManager.mm
WebKit/mac/Storage/WebDatabaseManagerPrivate.h
WebKit/mac/Storage/WebSecurityOrigin.mm [moved from WebKit/mac/Misc/WebSecurityOrigin.mm with 64% similarity]
WebKit/mac/Storage/WebSecurityOriginInternal.h [moved from WebKit/mac/Misc/WebSecurityOriginInternal.h with 91% similarity]
WebKit/mac/Storage/WebSecurityOriginPrivate.h [moved from WebKit/mac/Misc/WebSecurityOriginPrivate.h with 81% similarity]

index 265d0a3b53c83499bf986764cc2c48451dc9277b..ca085477f972e844d5dd63c2792c15780648d744 100644 (file)
@@ -1,3 +1,11 @@
+2007-11-16  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by John
+
+        Database management API tweaks
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2007-11-15  Brady Eidson  <beidson@apple.com>
 
         Reviewed by John
index 091ef51d82f4ec5bdf0b5c3c7257ff60c5116425..cd8c9051e9b4423a2e9c3f8cf1e426d07446891e 100644 (file)
                22F219CC08D236730030E078 /* WebBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; settings = {ATTRIBUTES = (); }; };
                4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; };
+               51079D170CED11B00077247D /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51079D140CED11B00077247D /* WebSecurityOrigin.mm */; };
+               51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51079D150CED11B00077247D /* WebSecurityOriginInternal.h */; };
+               51079D190CED11B00077247D /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */; };
                511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */; };
                511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */; };
                511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */; };
                511F3FD80CECC88F00852565 /* WebDatabaseTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */; };
-               512F2F670CEC3BC5006537E3 /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F2F660CEC3BC5006537E3 /* WebSecurityOriginInternal.h */; };
                51494CD60C7EBDE0004178C5 /* WebIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494CD40C7EBDE0004178C5 /* WebIconDatabaseClient.h */; };
                51494CD70C7EBDE0004178C5 /* WebIconDatabaseClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51494CD50C7EBDE0004178C5 /* WebIconDatabaseClient.mm */; };
                51494D240C7EC1B7004178C5 /* WebNSNotificationCenterExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494D220C7EC1B6004178C5 /* WebNSNotificationCenterExtras.h */; };
@@ -47,8 +49,6 @@
                51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; };
                51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };
                51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; };
-               51E9C4CB0CEC21A7004F960A /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E9C4C90CEC21A7004F960A /* WebSecurityOriginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               51E9C4CC0CEC21A7004F960A /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E9C4CA0CEC21A7004F960A /* WebSecurityOrigin.mm */; };
                51FDC4D30B0AF5C100F84EB3 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; };
                39446080020F50ED0ECA1767 /* WebHistoryItem.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebHistoryItem.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; };
                4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; };
+               51079D140CED11B00077247D /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; };
+               51079D150CED11B00077247D /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; };
+               51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; };
                511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; sourceTree = "<group>"; };
                511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerPrivate.h; sourceTree = "<group>"; };
                511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseTrackerClient.h; sourceTree = "<group>"; };
                511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseTrackerClient.mm; sourceTree = "<group>"; };
-               512F2F660CEC3BC5006537E3 /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; };
                513D422E034CF55A00CA2ACD /* WebResourceLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPolicyDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPolicyDelegate.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51E94C3506C0321200A9B09E /* WebPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51E94C6806C0347500A9B09E /* WebPDFRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPDFRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               51E9C4C90CEC21A7004F960A /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; };
-               51E9C4CA0CEC21A7004F960A /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; };
                51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; };
                5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; };
                5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; };
                                9345DDAF0365FB27008635CE /* WebNSWindowExtras.m */,
                                F560BEBC030DAF4401C1A526 /* WebSearchableTextView.h */,
                                F560BEBD030DAF4401C1A526 /* WebSearchableTextView.m */,
-                               512F2F660CEC3BC5006537E3 /* WebSecurityOriginInternal.h */,
-                               51E9C4C90CEC21A7004F960A /* WebSecurityOriginPrivate.h */,
-                               51E9C4CA0CEC21A7004F960A /* WebSecurityOrigin.mm */,
                                F59668C802AD2923018635CA /* WebStringTruncator.h */,
                                F59668C902AD2923018635CA /* WebStringTruncator.m */,
                                DD7CDEE60A23BA9E00069928 /* WebTypesInternal.h */,
                                511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
                                511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */,
                                511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */,
+                               51079D140CED11B00077247D /* WebSecurityOrigin.mm */,
+                               51079D150CED11B00077247D /* WebSecurityOriginInternal.h */,
+                               51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */,
                        );
                        path = Storage;
                        sourceTree = "<group>";
                                1C0706630A431E01001078F6 /* WebScriptDebugServer.h in Headers */,
                                1C07079A0A433E22001078F6 /* WebScriptDebugServerPrivate.h in Headers */,
                                939810260824BF01008DF038 /* WebSearchableTextView.h in Headers */,
-                               512F2F670CEC3BC5006537E3 /* WebSecurityOriginInternal.h in Headers */,
-                               51E9C4CB0CEC21A7004F960A /* WebSecurityOriginPrivate.h in Headers */,
                                939810270824BF01008DF038 /* WebStringTruncator.h in Headers */,
                                93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */,
                                DD7CDEE70A23BA9E00069928 /* WebTypesInternal.h in Headers */,
                                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
                                939810970824BF01008DF038 /* npfunctions.h in Headers */,
                                51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
+                               51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */,
+                               51079D190CED11B00077247D /* WebSecurityOriginPrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.mm in Sources */,
                                1C07073D0A433BD8001078F6 /* WebScriptDebugServer.m in Sources */,
                                939810CB0824BF01008DF038 /* WebSearchableTextView.m in Sources */,
-                               51E9C4CC0CEC21A7004F960A /* WebSecurityOrigin.mm in Sources */,
                                939810CC0824BF01008DF038 /* WebStringTruncator.m in Sources */,
                                93EB178D09F88D460091F8FF /* WebSystemInterface.m in Sources */,
                                939810BE0824BF01008DF038 /* WebURLsWithTitles.m in Sources */,
                                939811070824BF01008DF038 /* WebView.mm in Sources */,
                                939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */,
                                939810DD0824BF01008DF038 /* npapi.m in Sources */,
+                               51079D170CED11B00077247D /* WebSecurityOrigin.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ebd6a17e1c6b4296321f5a6c2436d8bf2ed31e5c..23fe43a26bec695b083d0d8e1b57b74ca761dfc8 100644 (file)
@@ -1,3 +1,40 @@
+2007-11-16  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by John
+
+        Database management API tweaks
+
+        Fleshed out "WebSecurityOrigin" to be the API object representing an origin.  This relieves some
+        burden off WebDatabaseManager and allows usage/quota operations on the SecurityOrigin object itself
+
+        Also added a new subdirectory for Storage related API - Why are we afraid to add new directories to
+        the WebKit tree?
+
+        * Misc/WebSecurityOrigin.mm: Removed.
+        * Misc/WebSecurityOriginInternal.h: Removed.
+        * Misc/WebSecurityOriginPrivate.h: Removed.
+
+        * Storage/WebDatabaseManager.mm: Work in terms of WebSecurityOrigin
+        * Storage/WebDatabaseManagerPrivate.h:
+
+        * Storage/WebSecurityOrigin.mm: Added.
+        (-[WebSecurityOriginPrivate initWithProtocol:domain:port:]):
+        (-[WebSecurityOriginPrivate initWithWebCoreSecurityOrigin:]):
+        (-[WebSecurityOriginPrivate finalize]):
+        (-[WebSecurityOriginPrivate dealloc]):
+        (-[WebSecurityOrigin initWithProtocol:domain:]):
+        (-[WebSecurityOrigin initWithProtocol:domain:port:]):
+        (-[WebSecurityOrigin protocol]):
+        (-[WebSecurityOrigin domain]):
+        (-[WebSecurityOrigin port]):
+        (-[WebSecurityOrigin usage]): 
+        (-[WebSecurityOrigin quota]):
+        (-[WebSecurityOrigin setQuota:]): Clients will set quotas on the WebSecurityOrigin object itself
+        (-[WebSecurityOrigin dealloc]):
+        (-[WebSecurityOrigin _initWithWebCoreSecurityOriginData:]):
+        * Storage/WebSecurityOriginInternal.h: Added.
+        * Storage/WebSecurityOriginPrivate.h: Added.
+
 2007-11-15  Brady Eidson  <beidson@apple.com>
 
         Reviewed by John
index 7dc949007ab69b330dc8d29ed7f6ce58bf689bd3..d61819b2eccd3cb719c717fcbf799e843e5d26f2 100644 (file)
 #import "WebSecurityOriginPrivate.h"
 
 #import <WebCore/DatabaseTracker.h>
-#import <WebCore/SecurityOriginData.h>
 
 using namespace WebCore;
 
 const NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
 
-const NSString *WebDatabaseOriginKey = @"WebDatabaseOriginKey";
-const NSString *WebDatabaseOriginQuotaKey = @"WebDatabaseOriginQuotaKey";
-const NSString *WebDatabaseOriginUsageKey = @"WebDatabaseOriginUsageKey";
-
-const NSString *WebDatabaseNameKey = @"WebDatabaseNameKey";
 const NSString *WebDatabaseDisplayNameKey = @"WebDatabaseDisplayNameKey";
 const NSString *WebDatabaseExpectedSizeKey = @"WebDatabaseExpectedSizeKey";
 const NSString *WebDatabaseUsageKey = @"WebDatabaseUsageKey";
@@ -64,11 +58,6 @@ const NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModif
     return nil;
 }
 
-- (NSDictionary *)detailsForOrigin:(WebSecurityOrigin *)origin
-{
-    return nil;
-}
-
 - (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin
 {
     return nil;
@@ -79,11 +68,6 @@ const NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModif
     return nil;
 }
 
-- (void)setQuota:(unsigned long long)quota forOrigin:(WebSecurityOrigin *)origin
-{
-
-}
-
 - (void)deleteAllDatabases
 {
     DatabaseTracker::tracker().deleteAllDatabases();
index 14173403a38f386ea4dcd1f9b6fb3dbc22233c69..a1efd9adaa1f91724ff57ada85d48279e8c5def8 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-extern const NSString *WebDatabaseOriginQuotaKey;
-extern const NSString *WebDatabaseOriginUsageKey;
-
-extern const NSString *WebDatabaseNameKey;
-extern const NSString *WebDatabaseOriginKey;
 extern const NSString *WebDatabaseDisplayNameKey;
 extern const NSString *WebDatabaseExpectedSizeKey;
 extern const NSString *WebDatabaseUsageKey;
@@ -52,20 +47,12 @@ extern const NSString *WebDatabaseDidModifyDatabaseNotification;
 // Will return an array of WebSecurityOrigins
 - (NSArray *)origins;
 
-// Will return the dictionary describing the current size and quota of the passed origin
-- (NSDictionary *)detailsForOrigin:(WebSecurityOrigin *)origin;
-
-// Will return an array of dictionaries, 1 dictionary per database in the requested origin
+// Will return an array of strings, the names of each database in the given origin
 - (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin;
 
 // Will return the dictionary describing everything about the database for the passed origin and name
 - (NSDictionary *)detailsForDatabase:(NSString *)databaseName withOrigin:(WebSecurityOrigin *)origin;
 
-// Sets the storage quota (in bytes) of the specified origin
-// 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 the origin
-- (void)setQuota:(unsigned long long)quota forOrigin:(WebSecurityOrigin *)origin;
-
 - (void)deleteAllDatabases;
 - (void)deleteDatabasesWithOrigin:(WebSecurityOrigin *)origin;
 - (void)deleteDatabase:(NSString *)databaseName withOrigin:(WebSecurityOrigin *)origin;
similarity index 64%
rename from WebKit/mac/Misc/WebSecurityOrigin.mm
rename to WebKit/mac/Storage/WebSecurityOrigin.mm
index 35916c151087bcfb2ab33ec08517220a0c029e4e..1ee49edf0dd28e68079e58afc52586b5b84de16f 100644 (file)
 #import "WebSecurityOriginPrivate.h"
 
 #import "WebSecurityOriginInternal.h"
-#import <WebCore/SecurityOriginData.h>
+#include <WebCore/SecurityOriginData.h>
 
 @interface WebSecurityOriginPrivate : NSObject {
 @public
-    NSString *protocol;
-    NSString *domain;
-    unsigned short port;
+    WebCoreSecurityOriginData* securityOriginData;
 }
 - (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain port:(unsigned short)port;
+- (id)initWithWebCoreSecurityOrigin:(WebCoreSecurityOriginData *)coreOrigin;
 @end
 
 @implementation WebSecurityOriginPrivate
     if (!self)
         return nil;
     
-    protocol = [theProtocol copy];
-    domain = [theDomain copy];
-    port = thePort;
+    securityOriginData = new WebCoreSecurityOriginData(theProtocol, theDomain, thePort);
+    return self;
+}
 
+- (id)initWithWebCoreSecurityOrigin:(WebCoreSecurityOriginData *)coreOrigin
+{
+    ASSERT(coreOrigin);
+    self = [super init];
+    if (!self)
+        return nil;
+        
+    securityOriginData = new WebCoreSecurityOriginData(*coreOrigin);
     return self;
 }
 
+- (void)finalize
+{
+    delete securityOriginData;
+    [super finalize];
+}
+
 - (void)dealloc
 {
-    [protocol release];
-    [domain release];
+    delete securityOriginData;
     [super dealloc];
 }
 
@@ -65,7 +77,6 @@
 
 @implementation WebSecurityOrigin
 
-
 - (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain
 {
     return [self initWithProtocol:protocol domain:domain port:0];
 
 - (NSString*)protocol
 {
-    return [[_private->protocol retain] autorelease];
+    return [[(NSString *)(_private->securityOriginData->protocol()) retain] autorelease];
 }
 
 - (NSString*)domain
 {
-    return [[_private->domain retain] autorelease];
+    return [[(NSString *)(_private->securityOriginData->host()) retain] autorelease];
 }
 
 - (unsigned short)port
 {
-    return _private->port;
+    return _private->securityOriginData->port();
+}
+
+- (unsigned long long)usage
+{
+    return 0;
+}
+
+- (unsigned long long)quota
+{
+    return 0;
+}
+
+// Sets the storage quota (in bytes)
+// 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
+{
+
 }
 
 - (void)dealloc
 
 @implementation WebSecurityOrigin (WebInternal)
 
-- (id)_initWithWebCoreSecurityOriginData:(WebCore::SecurityOriginData *)securityOriginData
+- (id)_initWithWebCoreSecurityOriginData:(WebCoreSecurityOriginData *)securityOriginData
 {
     ASSERT(securityOriginData);
-    return [self initWithProtocol:securityOriginData->protocol() domain:securityOriginData->host() port:securityOriginData->port()];
+    self = [super init];
+    if (!self)
+        return nil;
+        
+    _private = [[WebSecurityOriginPrivate alloc] initWithWebCoreSecurityOrigin:securityOriginData];
+    return self;
 }
 
 @end
similarity index 91%
rename from WebKit/mac/Misc/WebSecurityOriginInternal.h
rename to WebKit/mac/Storage/WebSecurityOriginInternal.h
index 106db4e9f178165867bba935a9e4aee93771fca2..9bf45e3cb8f3e54c0c9645d4a3d571a96960a1d4 100644 (file)
@@ -30,8 +30,10 @@ namespace WebCore {
     class SecurityOriginData;
 }
 
+typedef WebCore::SecurityOriginData WebCoreSecurityOriginData;
+
 @interface WebSecurityOrigin (WebInternal)
 
-- (id)_initWithWebCoreSecurityOriginData:(WebCore::SecurityOriginData *)securityOriginData;
+- (id)_initWithWebCoreSecurityOriginData:(WebCoreSecurityOriginData *)securityOriginData;
 
 @end
similarity index 81%
rename from WebKit/mac/Misc/WebSecurityOriginPrivate.h
rename to WebKit/mac/Storage/WebSecurityOriginPrivate.h
index 7424d83ddcba6f5cf3abef247c294b91b522e714..1e66f429e58debf2204c6290b4bfb2854fb773d6 100644 (file)
 
 // Returns zero if the port is the default port for the protocol, non-zero otherwise
 - (unsigned short)port;
+
+// Returns the current total usage of all databases in this security origin in bytes
+- (unsigned long long)usage;
+
+- (unsigned long long)quota;
+// Sets the storage quota (in bytes)
+// 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;
+
 @end