WebCore:
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2007 22:27:14 +0000 (22:27 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2007 22:27:14 +0000 (22:27 +0000)
        Reviewed by John and Sam

        Stubbing out everything required for a WebKit API for databases

        Biggest change in WebCore is that we passed around SecurityOriginData as the representation
        of a SecurityOrigin, instead of a String or a SecurityOrigin itself (which is an opaque object
        that has a different purpose besides just hanging on to the data)

        * WebCore.base.exp:
        * WebCore.xcodeproj/project.pbxproj:

        * platform/SecurityOrigin.cpp:
        * platform/SecurityOrigin.h:
        * platform/SecurityOriginData.h: Added.  Simple object to encapsulate the 3
          pieces of data in the SecurityOrigin tuple
        (WebCore::SecurityOriginData::SecurityOriginData):
        (WebCore::SecurityOriginData::protocol):
        (WebCore::SecurityOriginData::host):
        (WebCore::SecurityOriginData::port):
        (WebCore::SecurityOriginData::toString): Simple concatenation of the 3 components,
          colon separated

        * storage/Database.cpp:
        (WebCore::Database::Database): Use SecurityOriginData instead

        * storage/DatabaseTracker.cpp:
        (WebCore::DatabaseTracker::fullPathForDatabase):
        (WebCore::DatabaseTracker::databaseNamesForOrigin):
        (WebCore::DatabaseTracker::deleteDatabasesWithOrigin):
        (WebCore::DatabaseTracker::deleteDatabase):
        * storage/DatabaseTracker.h:

        * storage/DatabaseTrackerClient.h: Added.  For dispatching notifications up to WebKit
        (WebCore::DatabaseTrackerClient::~DatabaseTrackerClient):

WebKit:

        Reviewed by John

        Stubbing out everything required for a WebKit API for databases

        * WebKit.xcodeproj/project.pbxproj:

WebKit/mac:

        Reviewed by John

        Stubbing out everything required for a WebKit API for databases

        These interfaces seem to provide everything we need for UI and management at the browser level

        * Misc/WebDatabaseManager.h: Removed.
        * Misc/WebDatabaseManager.mm: Removed.
        * Misc/WebDatabaseManagerPrivate.h: Removed.

        * Misc/WebSecurityOrigin.mm: Added. Object that acts as a container for the "SecurityOrigin tuple"
          (protocol, domain, and port)
        (-[WebSecurityOriginPrivate initWithProtocol:domain:port:]):
        (-[WebSecurityOriginPrivate dealloc]):
        (-[WebSecurityOrigin initWithProtocol:domain:]):
        (-[WebSecurityOrigin initWithProtocol:domain:port:]):
        (-[WebSecurityOrigin protocol]):
        (-[WebSecurityOrigin domain]):
        (-[WebSecurityOrigin port]):
        (-[WebSecurityOrigin dealloc]):
        (-[WebSecurityOrigin _initWithWebCoreSecurityOriginData:WebCore::]):
        * Misc/WebSecurityOriginInternal.h: Added.
        * Misc/WebSecurityOriginPrivate.h: Added.

        * Storage/WebDatabaseManager.mm: Added.
        (+[WebDatabaseManager sharedWebDatabaseManager]):
        (-[WebDatabaseManager origins]):  Get a list of all origins currently tracked
        (-[WebDatabaseManager detailsForOrigin:]): Get the current usage and current quota for the given origin
        (-[WebDatabaseManager databasesWithOrigin:]): Get all databases for a certain origin
        (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Get all details about a specific database
        (-[WebDatabaseManager setQuota:forOrigin:]): Change origin-wide quota
        (-[WebDatabaseManager deleteAllDatabases]):
        (-[WebDatabaseManager deleteAllDatabasesWithOrigin:]):
        (-[WebDatabaseManager deleteDatabase:withOrigin:]):
        * Storage/WebDatabaseManagerPrivate.h: Added.
        * Storage/WebDatabaseManagerInternal.h: Added.
        (WebKitInitializeDatabasesIfNecessary): One-time initialization of database-related things

        * Storage/WebDatabaseTrackerClient.h: Added. Stubbed out client for notifications
        * Storage/WebDatabaseTrackerClient.mm: Added.
        (WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient):
        (WebDatabaseTrackerClient::WebDatabaseTrackerClient):
        (WebDatabaseTrackerClient::~WebDatabaseTrackerClient):
        (WebDatabaseTrackerClient::dispatchDidModifyOrigin):
        (WebDatabaseTrackerClient::dispatchDidModifyDatabase):

        * WebView/WebView.mm:
        (-[WebView _commonInitializationWithFrameName:groupName:]): Do one-time initialization of
          Database-related things here

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

22 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/SecurityOrigin.cpp
WebCore/platform/SecurityOrigin.h
WebCore/platform/SecurityOriginData.h [new file with mode: 0644]
WebCore/storage/Database.cpp
WebCore/storage/DatabaseTracker.cpp
WebCore/storage/DatabaseTracker.h
WebCore/storage/DatabaseTrackerClient.h [new file with mode: 0644]
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/mac/ChangeLog
WebKit/mac/Misc/WebSecurityOrigin.mm [new file with mode: 0644]
WebKit/mac/Misc/WebSecurityOriginInternal.h [moved from WebKit/mac/Misc/WebDatabaseManager.h with 78% similarity]
WebKit/mac/Misc/WebSecurityOriginPrivate.h [new file with mode: 0644]
WebKit/mac/Storage/WebDatabaseManager.mm [moved from WebKit/mac/Misc/WebDatabaseManager.mm with 50% similarity]
WebKit/mac/Storage/WebDatabaseManagerInternal.h [moved from WebKit/mac/Misc/WebDatabaseManagerPrivate.h with 95% similarity]
WebKit/mac/Storage/WebDatabaseManagerPrivate.h [new file with mode: 0644]
WebKit/mac/Storage/WebDatabaseTrackerClient.h [new file with mode: 0644]
WebKit/mac/Storage/WebDatabaseTrackerClient.mm [new file with mode: 0644]
WebKit/mac/WebView/WebView.mm

index 976603b14b6f754e195b7a59b3a40612e20717ec..cca755d13cc4e4315d4ba9217c701de8a3098e2c 100644 (file)
@@ -1,4 +1,39 @@
-2007-11-15  Jon Honeycutt  <jhoneycutt@apple.com>
+2007-11-15  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by John and Sam
+
+        Stubbing out everything required for a WebKit API for databases
+
+        Biggest change in WebCore is that we passed around SecurityOriginData as the representation
+        of a SecurityOrigin, instead of a String or a SecurityOrigin itself (which is an opaque object
+        that has a different purpose besides just hanging on to the data)
+
+        * WebCore.base.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * platform/SecurityOrigin.cpp:
+        * platform/SecurityOrigin.h:
+        * platform/SecurityOriginData.h: Added.  Simple object to encapsulate the 3
+          pieces of data in the SecurityOrigin tuple
+        (WebCore::SecurityOriginData::SecurityOriginData):
+        (WebCore::SecurityOriginData::protocol):
+        (WebCore::SecurityOriginData::host):
+        (WebCore::SecurityOriginData::port):
+        (WebCore::SecurityOriginData::toString): Simple concatenation of the 3 components,
+          colon separated
+
+        * storage/Database.cpp:
+        (WebCore::Database::Database): Use SecurityOriginData instead
+
+        * storage/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::fullPathForDatabase):
+        (WebCore::DatabaseTracker::databaseNamesForOrigin):
+        (WebCore::DatabaseTracker::deleteDatabasesWithOrigin):
+        (WebCore::DatabaseTracker::deleteDatabase):
+        * storage/DatabaseTracker.h:
+
+        * storage/DatabaseTrackerClient.h: Added.  For dispatching notifications up to WebKit
+        (WebCore::DatabaseTrackerClient::~DatabaseTrackerClient):2007-11-15  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Reviewed by Anders.
 
index 16bef8f3d7388f411e9fc63d707820f7d0925ad3..278db9297c257770e0c1369cd43f07d28c01d055 100644 (file)
@@ -208,8 +208,8 @@ __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEb
 __ZN7WebCore12EventHandler20sendContextMenuEventERKNS_18PlatformMouseEventE
 __ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv
 __ZN7WebCore12EventHandler7mouseUpEP7NSEvent
-__ZN7WebCore12EventHandler8keyEventERKNS_21PlatformKeyboardEventE
 __ZN7WebCore12EventHandler8keyEventEP7NSEvent
+__ZN7WebCore12EventHandler8keyEventERKNS_21PlatformKeyboardEventE
 __ZN7WebCore12EventHandler9mouseDownEP7NSEvent
 __ZN7WebCore12IconDatabase10setEnabledEb
 __ZN7WebCore12IconDatabase11defaultIconERKNS_7IntSizeE
@@ -289,13 +289,13 @@ __ZN7WebCore15BackForwardList9goForwardEv
 __ZN7WebCore15BackForwardListC1EPNS_4PageE
 __ZN7WebCore15BackForwardListD1Ev
 __ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
-__ZN7WebCore15DatabaseTracker14deleteDatabaseERKNS_6StringES3_
+__ZN7WebCore15DatabaseTracker14deleteDatabaseERKNS_18SecurityOriginDataERKNS_6StringE
 __ZN7WebCore15DatabaseTracker15setDatabasePathERKNS_6StringE
 __ZN7WebCore15DatabaseTracker18deleteAllDatabasesEv
-__ZN7WebCore15DatabaseTracker22databaseNamesForOriginERKNS_6StringERN3WTF6VectorIS1_Lm0EEE
-__ZN7WebCore15DatabaseTracker27deleteAllDatabasesForOriginERKNS_6StringE
+__ZN7WebCore15DatabaseTracker25deleteDatabasesWithOriginERKNS_18SecurityOriginDataE
 __ZN7WebCore15DatabaseTracker7originsEv
 __ZN7WebCore15DatabaseTracker7trackerEv
+__ZN7WebCore15DatabaseTracker9setClientEPNS_21DatabaseTrackerClientE
 __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
 __ZN7WebCore15FocusController18focusedOrMainFrameEv
@@ -346,6 +346,7 @@ __ZN7WebCore20JavaScriptStatistics20rootObjectTypeCountsEv
 __ZN7WebCore20JavaScriptStatistics21shouldPrintExceptionsEv
 __ZN7WebCore20JavaScriptStatistics24setShouldPrintExceptionsEb
 __ZN7WebCore20JavaScriptStatistics31garbageCollectOnAlternateThreadEb
+__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
 __ZN7WebCore21ContextMenuController16clearContextMenuEv
 __ZN7WebCore21PlatformKeyboardEventC1EP7NSEventb
 __ZN7WebCore21WindowsLatin1EncodingEv
@@ -617,17 +618,16 @@ __ZNK7WebCore16DeprecatedString2atEj
 __ZNK7WebCore16DeprecatedString3midEjj
 __ZNK7WebCore16DeprecatedString8endsWithERKS0_
 __ZNK7WebCore16ResourceResponse13nsURLResponseEv
+__ZNK7WebCore19ResourceRequestBase3urlEv
+__ZNK7WebCore19ResourceRequestBase7isEmptyEv
+__ZNK7WebCore19SelectionController17isInPasswordFieldEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
 __ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
+__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
 __ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
 __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
-__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
 __ZNK7WebCore20ResourceResponseBase3urlEv
 __ZNK7WebCore20ResourceResponseBase8mimeTypeEv
-__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
-__ZNK7WebCore19ResourceRequestBase3urlEv
-__ZNK7WebCore19ResourceRequestBase7isEmptyEv
-__ZNK7WebCore19SelectionController17isInPasswordFieldEv
 __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
 __ZNK7WebCore4Font11primaryFontEv
 __ZNK7WebCore4KURL17lastPathComponentEv
index bb0f04d59997ec919e6c6809d461216f81677b90..8d0d8eee0a991a8c2393701475460f9808eee962 100644 (file)
                5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };
                5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
                5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               512F2F450CEC3516006537E3 /* SecurityOriginData.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F2F440CEC3516006537E3 /* SecurityOriginData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
                513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
                514185EE0CD65F0400763C99 /* ChangeVersionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 514185EC0CD65F0400763C99 /* ChangeVersionWrapper.h */; };
                51EC92680CE90DD400F90308 /* JSCustomSQLTransactionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC92600CE90DD400F90308 /* JSCustomSQLTransactionCallback.h */; };
                51EC92690CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EC92610CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp */; };
                51EC926A0CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC92620CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h */; };
+               51FAFE340CECBF2D00BB3F24 /* DatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
                650F53DC09D15DDA00C9B0C8 /* CSSGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */; };
                510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = "<group>"; };
                5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDatabase.cpp; sourceTree = "<group>"; };
                5126E6BA0A2E3B12005C29FA /* IconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDatabase.h; sourceTree = "<group>"; };
+               512F2F440CEC3516006537E3 /* SecurityOriginData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOriginData.h; sourceTree = "<group>"; };
                513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
                513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; };
                514185EC0CD65F0400763C99 /* ChangeVersionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChangeVersionWrapper.h; sourceTree = "<group>"; };
                51EC92620CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomSQLTransactionErrorCallback.h; sourceTree = "<group>"; };
                51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLCanvasElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseTrackerClient.h; sourceTree = "<group>"; };
                550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                55998A5A052B59CC0017A6C1 /* WebCoreAXObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreAXObject.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                519611620CAC56570010A80C /* DatabaseThread.h */,
                                1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */,
                                1AD51A120CB59CD300953D11 /* DatabaseTracker.h */,
+                               51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */,
                                51EC92570CE90DB400F90308 /* SQLError.h */,
                                51EC92580CE90DB400F90308 /* SQLError.idl */,
                                519611670CAC56570010A80C /* SQLResultSet.cpp */,
                                AB7170880B3118080017123E /* SearchPopupMenu.h */,
                                BC014C720CC5579D009C4B20 /* SecurityOrigin.cpp */,
                                BC014C730CC5579D009C4B20 /* SecurityOrigin.h */,
+                               512F2F440CEC3516006537E3 /* SecurityOriginData.h */,
                                BCFB2F3F097A24B500BA703D /* SegmentedString.cpp */,
                                BCFB2F40097A24B500BA703D /* SegmentedString.h */,
                                1A4A954B0B4EDCCB002D8C3C /* SharedBuffer.cpp */,
                                519611EA0CAC749C0010A80C /* DatabaseTask.h in Headers */,
                                519611780CAC56A80010A80C /* DatabaseThread.h in Headers */,
                                1AD51A140CB59CD300953D11 /* DatabaseTracker.h in Headers */,
+                               51FAFE340CECBF2D00BB3F24 /* DatabaseTrackerClient.h in Headers */,
                                1C4C8F660AD8655D009475CE /* DeleteButton.h in Headers */,
                                1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */,
                                93309DDF099E64920056E581 /* DeleteFromTextNodeCommand.h in Headers */,
                                BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */,
                                AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */,
                                BC014C750CC5579D009C4B20 /* SecurityOrigin.h in Headers */,
+                               512F2F450CEC3516006537E3 /* SecurityOriginData.h in Headers */,
                                BCFB2F42097A24B500BA703D /* SegmentedString.h in Headers */,
                                93309E0C099E64920056E581 /* Selection.h in Headers */,
                                93309E0E099E64920056E581 /* SelectionController.h in Headers */,
                                9305B24D098F1B6B00C28855 /* Timer.h in Headers */,
                                BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */,
                                854FE7370A2297BE0058D7AD /* Traversal.h in Headers */,
+                               1419D2C50CEA6F6100FF507A /* TreeShared.h in Headers */,
                                854FE7390A2297BE0058D7AD /* TreeWalker.h in Headers */,
                                93309E1A099E64920056E581 /* TypingCommand.h in Headers */,
                                85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,
                                BCB16C2D0979C3BD00467741 /* loader.h in Headers */,
                                93309DF8099E64920056E581 /* markup.h in Headers */,
                                93309E1E099E64920056E581 /* visible_units.h in Headers */,
-                               1419D2C50CEA6F6100FF507A /* TreeShared.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 862d8ef858323a67d400587a4af93db6d4a7cb44..6416e2003afbee091f59ded494ea01ef7285ad60 100644 (file)
@@ -35,6 +35,7 @@
 #include "FrameTree.h"
 #include "KURL.h"
 #include "PlatformString.h"
+#include "SecurityOriginData.h"
 
 namespace WebCore {
 
@@ -138,4 +139,9 @@ String SecurityOrigin::toString() const
     return m_protocol + ":" + m_host + ":" + String::number(m_port);
 }
 
+SecurityOriginData SecurityOrigin::securityOriginData() const
+{
+    return SecurityOriginData(m_protocol, m_host, m_port);
+}
+
 } // namespace WebCore
index 65354eacc9a9ad842cbe5498d48969b0222fb14a..e3d17b02071a69376238b5bd9d3e69070ae53011 100644 (file)
@@ -35,7 +35,8 @@ namespace WebCore {
 
     class Frame;
     class KURL;
-
+    class SecurityOriginData;
+    
     class SecurityOrigin {
     public:
         SecurityOrigin();
@@ -48,6 +49,8 @@ namespace WebCore {
 
         String toString() const;
         
+        SecurityOriginData securityOriginData() const;
+        
     private:
         void clear();
         bool isEmpty() const;
diff --git a/WebCore/platform/SecurityOriginData.h b/WebCore/platform/SecurityOriginData.h
new file mode 100644 (file)
index 0000000..649c37e
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SecurityOriginData_h
+#define SecurityOriginData_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class SecurityOriginData {
+public:
+    SecurityOriginData(const String& protocol, const String& host, unsigned short port)
+        : m_protocol(protocol)
+        , m_host(host)
+        , m_port(port)
+    { }
+    
+    const String& protocol() const { return m_protocol; }
+    const String& host() const { return m_host; }
+    unsigned short port() const { return m_port; }
+    
+    String stringIdentifier() const { return m_protocol + ":" + m_host + ":" + String::number(m_port); }
+private:
+    String m_protocol;
+    String m_host;
+    unsigned short m_port;
+};
+    
+} // namespace WebCore
+
+#endif // SecurityOriginData_h
index 5415300d86292abc401f7a37d4be56301f741172..0e56ca8dfe2226dc690888e8e2973b6f2403abf1 100644 (file)
@@ -42,6 +42,7 @@
 #include "Logging.h"
 #include "NotImplemented.h"
 #include "Page.h"
+#include "SecurityOriginData.h"
 #include "SQLiteDatabase.h"
 #include "SQLiteStatement.h"
 #include "SQLResultSet.h"
@@ -139,7 +140,7 @@ Database::Database(Document* document, const String& name, const String& expecte
     m_databaseThread = document->databaseThread();
     ASSERT(m_databaseThread);
 
-    m_filename = DatabaseTracker::tracker().fullPathForDatabase(m_securityOrigin.toString(), m_name);
+    m_filename = DatabaseTracker::tracker().fullPathForDatabase(m_securityOrigin.securityOriginData(), m_name);
 }
 
 Database::~Database()
index 79e755a0ec40f9e6c1ae6c230d171095dd4aaed7..49a821dbd4b0de01f98f67a82d01f2a9d178f848 100644 (file)
@@ -31,6 +31,7 @@
 #include "Database.h"
 #include "FileSystem.h"
 #include "NotImplemented.h"
+#include "SecurityOriginData.h"
 #include "SQLiteStatement.h"
 
 namespace WebCore {
@@ -81,7 +82,7 @@ void DatabaseTracker::openTrackerDatabase()
     }
 }
     
-String DatabaseTracker::fullPathForDatabase(const String& origin, const String& name)
+String DatabaseTracker::fullPathForDatabase(const SecurityOriginData& origin, const String& name)
 {
     SQLiteStatement statement(m_database, "SELECT path FROM Databases WHERE origin=? AND name=?;");
 
@@ -96,7 +97,7 @@ String DatabaseTracker::fullPathForDatabase(const String& origin, const String&
     if (result == SQLResultRow)
         return pathByAppendingComponent(m_databasePath, statement.getColumnText16(0));
     if (result != SQLResultDone) {
-        LOG_ERROR("Failed to retrieve filename from Database Tracker for origin %s, name %s", origin.ascii().data(), name.ascii().data());
+        LOG_ERROR("Failed to retrieve filename from Database Tracker for origin %s, name %s", origin.stringIdentifier().ascii().data(), name.ascii().data());
         return "";
     }
 
@@ -123,7 +124,7 @@ String DatabaseTracker::fullPathForDatabase(const String& origin, const String&
 
     sequenceStatement.finalize();
 
-    if (!addDatabase(origin, name, String::format("%016llx.db", seq)))
+    if (!addDatabase(origin.stringIdentifier(), name, String::format("%016llx.db", seq)))
         return "";
 
     return filename;
@@ -162,7 +163,7 @@ const HashSet<String>& DatabaseTracker::origins()
     return *(m_origins.get());
 }
 
-bool DatabaseTracker::databaseNamesForOrigin(const String& origin, Vector<String>& resultVector)
+bool DatabaseTracker::databaseNamesForOrigin(const SecurityOriginData& origin, Vector<String>& resultVector)
 {
     if (!m_database.isOpen())
         return false;
@@ -179,7 +180,7 @@ bool DatabaseTracker::databaseNamesForOrigin(const String& origin, Vector<String
         resultVector.append(statement.getColumnText16(0));
 
     if (result != SQLResultDone) {
-        LOG_ERROR("Failed to retrieve all database names for origin %s", origin.ascii().data());
+        LOG_ERROR("Failed to retrieve all database names for origin %s", origin.stringIdentifier().ascii().data());
         return false;
     }
 
@@ -215,14 +216,19 @@ void DatabaseTracker::deleteAllDatabases()
     notImplemented();
 }
 
-void DatabaseTracker::deleteAllDatabasesForOrigin(const String& origin)
+void DatabaseTracker::deleteDatabasesWithOrigin(const SecurityOriginData& origin)
 {
     notImplemented();
 }
 
-void DatabaseTracker::deleteDatabase(const String& origin, const String& name)
+void DatabaseTracker::deleteDatabase(const SecurityOriginData& origin, const String& name)
 {
     notImplemented();
 }
 
+void DatabaseTracker::setClient(DatabaseTrackerClient* client)
+{
+    m_client = client;
+}
+
 } // namespace WebCore
index 931e84c8223cd7ed2053bd41c764d10d014c3eab..c9fcb02a58b99bdce73f845f8f4e0374411acf0a 100644 (file)
 
 namespace WebCore {
 
+class DatabaseTrackerClient;
+class SecurityOriginData;
+
 class DatabaseTracker {
 public:
     void setDatabasePath(const String&);
     const String& databasePath();
 
-    String fullPathForDatabase(const String& origin, const String& name);
+    String fullPathForDatabase(const SecurityOriginData& origin, const String& name);
 
     const HashSet<String>& origins();
-    bool databaseNamesForOrigin(const String& origin, Vector<String>& result);
+    bool databaseNamesForOrigin(const SecurityOriginData& origin, Vector<String>& result);
 
     void deleteAllDatabases();
-    void deleteAllDatabasesForOrigin(const String& origin);
-    void deleteDatabase(const String& origin, const String& name);
+    void deleteDatabasesWithOrigin(const SecurityOriginData& origin);
+    void deleteDatabase(const SecurityOriginData& origin, const String& name);
 
+    void setClient(DatabaseTrackerClient*);
+    
     static DatabaseTracker& tracker();
 private:
     DatabaseTracker();
@@ -64,6 +69,8 @@ private:
     mutable OwnPtr<HashSet<String> > m_origins;
 
     String m_databasePath;
+    
+    DatabaseTrackerClient* m_client;
 };
 
 } // namespace WebCore
diff --git a/WebCore/storage/DatabaseTrackerClient.h b/WebCore/storage/DatabaseTrackerClient.h
new file mode 100644 (file)
index 0000000..bf26d14
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef DatabaseTrackerClient_h
+#define DatabaseTrackerClient_h
+
+namespace WebCore {
+
+class SecurityOriginData;
+class String;
+
+class DatabaseTrackerClient {
+public:
+    virtual ~DatabaseTrackerClient() { }
+    virtual void dispatchDidModifyOrigin(const SecurityOriginData&) = 0;
+    virtual void dispatchDidModifyDatabase(const SecurityOriginData&, const String& databaseName) = 0;
+};
+
+} // namespace WebCore
+
+#endif // DatabaseTrackerClient_h
index 8a0705016428e518a9bfed59ec8917066243cf15..265d0a3b53c83499bf986764cc2c48451dc9277b 100644 (file)
@@ -1,3 +1,11 @@
+2007-11-15  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by John
+
+        Stubbing out everything required for a WebKit API for databases
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2007-11-12  Adam Roben  <aroben@apple.com>
 
         * StringsNotToBeLocalized.txt: Updated.
index b4d3d91916de182b0c71cfd0f7d2835e7c684369..091ef51d82f4ec5bdf0b5c3c7257ff60c5116425 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 */; };
-               5106D07F0CBC07AE00992D8C /* WebDatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5106D07D0CBC07AE00992D8C /* WebDatabaseManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               5106D0800CBC07AE00992D8C /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5106D07E0CBC07AE00992D8C /* WebDatabaseManager.mm */; };
+               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 */; };
                51494D250C7EC1B7004178C5 /* WebNSNotificationCenterExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 51494D230C7EC1B7004178C5 /* WebNSNotificationCenterExtras.m */; };
+               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 */; };
-               51C96BDD0CC5358E0047DF2A /* WebDatabaseManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C96BDC0CC5358E0047DF2A /* WebDatabaseManagerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               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>"; };
-               5106D07D0CBC07AE00992D8C /* WebDatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManager.h; sourceTree = "<group>"; };
-               5106D07E0CBC07AE00992D8C /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; 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; };
                51A8B579042834F700CA2D3A /* WebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51A8B57A042834F700CA2D3A /* WebView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerInternal.h; sourceTree = "<group>"; };
                51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = "<group>"; };
                51C16E4006138EB400A1657B /* npfunctions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = npfunctions.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListInternal.h; sourceTree = "<group>"; };
-               51C96BDC0CC5358E0047DF2A /* WebDatabaseManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerPrivate.h; sourceTree = "<group>"; };
                51E94C3406C0321200A9B09E /* WebPDFView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFView.h; 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>"; };
                                254DC334016E1D3F0ECA149E /* Misc */,
                                F8CA15B4029A399401000122 /* Panels */,
                                F5EBC45202134BB601CA1520 /* Plugins */,
+                               511F3FC30CECC7E200852565 /* Storage */,
                                F5B36B400281DE87018635CB /* WebCoreSupport */,
                                9C7CABBB0190A37C0ECA16EA /* WebView */,
                                1C68F63F095B5F9C00C2984E /* WebInspector */,
                                5241ADF40B1BC48A004012BD /* WebCache.mm */,
                                F59EAE3E0253C7EE018635CA /* WebCoreStatistics.h */,
                                F59EAE410253C8DE018635CA /* WebCoreStatistics.mm */,
-                               5106D07D0CBC07AE00992D8C /* WebDatabaseManager.h */,
-                               51C96BDC0CC5358E0047DF2A /* WebDatabaseManagerPrivate.h */,
-                               5106D07E0CBC07AE00992D8C /* WebDatabaseManager.mm */,
                                6578F5DE045F817400000128 /* WebDownload.h */,
                                6578F5DF045F817400000128 /* WebDownload.m */,
                                ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */,
                                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 */,
                        tabWidth = 4;
                        usesTabs = 0;
                };
+               511F3FC30CECC7E200852565 /* Storage */ = {
+                       isa = PBXGroup;
+                       children = (
+                               511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
+                               51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
+                               511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
+                               511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */,
+                               511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */,
+                       );
+                       path = Storage;
+                       sourceTree = "<group>";
+               };
                51E94C0706C02CA300A9B09E /* PDF */ = {
                        isa = PBXGroup;
                        children = (
                                9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
                                658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */,
                                9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
-                               5106D07F0CBC07AE00992D8C /* WebDatabaseManager.h in Headers */,
-                               51C96BDD0CC5358E0047DF2A /* WebDatabaseManagerPrivate.h in Headers */,
+                               511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */,
+                               511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */,
                                9398104E0824BF01008DF038 /* WebDefaultContextMenuDelegate.h in Headers */,
                                9398108D0824BF01008DF038 /* WebDefaultEditingDelegate.h in Headers */,
                                9398104F0824BF01008DF038 /* WebDefaultPolicyDelegate.h in Headers */,
                                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 */,
                                9398109B0824BF01008DF038 /* WebViewInternal.h in Headers */,
                                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
                                939810970824BF01008DF038 /* npfunctions.h in Headers */,
+                               51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               ED3B48DF0CC51F7E00DFF1EB /* ../StringsNotToBeLocalized.txt in Resources */,
                                939810BA0824BF01008DF038 /* IDNScriptWhiteList.txt in Resources */,
                                939810B30824BF01008DF038 /* Localizable.strings in Resources */,
-                               ED3B48DF0CC51F7E00DFF1EB /* ../StringsNotToBeLocalized.txt in Resources */,
                                939810B50824BF01008DF038 /* WebAuthenticationPanel.nib in Resources */,
                                939810B40824BF01008DF038 /* WebJavaScriptTextInputPanel.nib in Resources */,
                                939810B90824BF01008DF038 /* WebViewEditingContextMenu.nib in Resources */,
                                939810BF0824BF01008DF038 /* WebCoreStatistics.mm in Sources */,
                                9398111C0824BF01008DF038 /* WebDOMOperations.mm in Sources */,
                                939810ED0824BF01008DF038 /* WebDataSource.mm in Sources */,
-                               5106D0800CBC07AE00992D8C /* WebDatabaseManager.mm in Sources */,
+                               511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */,
+                               511F3FD80CECC88F00852565 /* WebDatabaseTrackerClient.mm in Sources */,
                                939810EF0824BF01008DF038 /* WebDefaultContextMenuDelegate.mm in Sources */,
                                9398111B0824BF01008DF038 /* WebDefaultEditingDelegate.m in Sources */,
                                939810F00824BF01008DF038 /* WebDefaultPolicyDelegate.m in Sources */,
                                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 */,
index 6f47d1d204fd35624f53e09041bb3e0942a750f3..ebd6a17e1c6b4296321f5a6c2436d8bf2ed31e5c 100644 (file)
@@ -1,3 +1,55 @@
+2007-11-15  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by John
+
+        Stubbing out everything required for a WebKit API for databases
+
+        These interfaces seem to provide everything we need for UI and management at the browser level
+
+        * Misc/WebDatabaseManager.h: Removed.
+        * Misc/WebDatabaseManager.mm: Removed.
+        * Misc/WebDatabaseManagerPrivate.h: Removed.
+
+        * Misc/WebSecurityOrigin.mm: Added. Object that acts as a container for the "SecurityOrigin tuple"
+          (protocol, domain, and port)
+        (-[WebSecurityOriginPrivate initWithProtocol:domain:port:]):
+        (-[WebSecurityOriginPrivate dealloc]):
+        (-[WebSecurityOrigin initWithProtocol:domain:]):
+        (-[WebSecurityOrigin initWithProtocol:domain:port:]):
+        (-[WebSecurityOrigin protocol]):
+        (-[WebSecurityOrigin domain]):
+        (-[WebSecurityOrigin port]):
+        (-[WebSecurityOrigin dealloc]):
+        (-[WebSecurityOrigin _initWithWebCoreSecurityOriginData:WebCore::]):
+        * Misc/WebSecurityOriginInternal.h: Added.
+        * Misc/WebSecurityOriginPrivate.h: Added.
+
+        * Storage/WebDatabaseManager.mm: Added.
+        (+[WebDatabaseManager sharedWebDatabaseManager]):
+        (-[WebDatabaseManager origins]):  Get a list of all origins currently tracked
+        (-[WebDatabaseManager detailsForOrigin:]): Get the current usage and current quota for the given origin
+        (-[WebDatabaseManager databasesWithOrigin:]): Get all databases for a certain origin
+        (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Get all details about a specific database
+        (-[WebDatabaseManager setQuota:forOrigin:]): Change origin-wide quota
+        (-[WebDatabaseManager deleteAllDatabases]):
+        (-[WebDatabaseManager deleteAllDatabasesWithOrigin:]):
+        (-[WebDatabaseManager deleteDatabase:withOrigin:]):
+        * Storage/WebDatabaseManagerPrivate.h: Added.
+        * Storage/WebDatabaseManagerInternal.h: Added.
+        (WebKitInitializeDatabasesIfNecessary): One-time initialization of database-related things
+
+        * Storage/WebDatabaseTrackerClient.h: Added. Stubbed out client for notifications
+        * Storage/WebDatabaseTrackerClient.mm: Added.
+        (WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient):
+        (WebDatabaseTrackerClient::WebDatabaseTrackerClient):
+        (WebDatabaseTrackerClient::~WebDatabaseTrackerClient):
+        (WebDatabaseTrackerClient::dispatchDidModifyOrigin):
+        (WebDatabaseTrackerClient::dispatchDidModifyDatabase):
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]): Do one-time initialization of
+          Database-related things here
+
 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit/mac/Misc/WebSecurityOrigin.mm b/WebKit/mac/Misc/WebSecurityOrigin.mm
new file mode 100644 (file)
index 0000000..35916c1
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#import "WebSecurityOriginPrivate.h"
+
+#import "WebSecurityOriginInternal.h"
+#import <WebCore/SecurityOriginData.h>
+
+@interface WebSecurityOriginPrivate : NSObject {
+@public
+    NSString *protocol;
+    NSString *domain;
+    unsigned short port;
+}
+- (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain port:(unsigned short)port;
+@end
+
+@implementation WebSecurityOriginPrivate
+
+- (id)initWithProtocol:(NSString *)theProtocol domain:(NSString *)theDomain port:(unsigned short)thePort
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    
+    protocol = [theProtocol copy];
+    domain = [theDomain copy];
+    port = thePort;
+
+    return self;
+}
+
+- (void)dealloc
+{
+    [protocol release];
+    [domain release];
+    [super dealloc];
+}
+
+@end
+
+@implementation WebSecurityOrigin
+
+
+- (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain
+{
+    return [self initWithProtocol:protocol domain:domain port:0];
+}
+
+- (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain port:(unsigned short)port
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    
+    _private = [[WebSecurityOriginPrivate alloc] initWithProtocol:protocol domain:domain port:port];
+
+    return self;
+}
+
+- (NSString*)protocol
+{
+    return [[_private->protocol retain] autorelease];
+}
+
+- (NSString*)domain
+{
+    return [[_private->domain retain] autorelease];
+}
+
+- (unsigned short)port
+{
+    return _private->port;
+}
+
+- (void)dealloc
+{
+    [_private release];
+    [super dealloc];
+}
+
+@end
+
+@implementation WebSecurityOrigin (WebInternal)
+
+- (id)_initWithWebCoreSecurityOriginData:(WebCore::SecurityOriginData *)securityOriginData
+{
+    ASSERT(securityOriginData);
+    return [self initWithProtocol:securityOriginData->protocol() domain:securityOriginData->host() port:securityOriginData->port()];
+}
+
+@end
similarity index 78%
rename from WebKit/mac/Misc/WebDatabaseManager.h
rename to WebKit/mac/Misc/WebSecurityOriginInternal.h
index c422d39d9e72aa6a2b38528374c5945cafceee70..106db4e9f178165867bba935a9e4aee93771fca2 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-extern const NSString *WebDatabaseDirectoryDefaultsKey;
-extern const NSString *WebDatabaseNameKey;
-extern const NSString *WebDatabaseSizeKey;
-
-@interface WebDatabaseManager : NSObject
-{
+namespace WebCore {
+    class SecurityOriginData;
 }
 
-+ (NSArray *)origins;
-+ (NSArray *)databasesWithOrigin:(NSString *)origin;
-+ (void)deleteAllDatabases;
-+ (void)deleteAllDatabasesWithOrigin:(NSString *)origin;
-+ (void)deleteDatabaseWithOrigin:(NSString *)origin named:(NSString *)name;
+@interface WebSecurityOrigin (WebInternal)
+
+- (id)_initWithWebCoreSecurityOriginData:(WebCore::SecurityOriginData *)securityOriginData;
 
 @end
diff --git a/WebKit/mac/Misc/WebSecurityOriginPrivate.h b/WebKit/mac/Misc/WebSecurityOriginPrivate.h
new file mode 100644 (file)
index 0000000..7424d83
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@class WebSecurityOriginPrivate;
+
+@interface WebSecurityOrigin : NSObject {
+    WebSecurityOriginPrivate *_private;
+}
+
+- (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain;
+- (id)initWithProtocol:(NSString *)protocol domain:(NSString *)domain port:(unsigned short)port;
+
+- (NSString*)protocol;
+- (NSString*)domain;
+
+// Returns zero if the port is the default port for the protocol, non-zero otherwise
+- (unsigned short)port;
+@end
similarity index 50%
rename from WebKit/mac/Misc/WebDatabaseManager.mm
rename to WebKit/mac/Storage/WebDatabaseManager.mm
index b5bb9b08938f858e23a38fd645e7abd89173149e..7dc949007ab69b330dc8d29ed7f6ce58bf689bd3 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WebDatabaseManager.h"
 #import "WebDatabaseManagerPrivate.h"
+#import "WebDatabaseManagerInternal.h"
+
+#import "WebDatabaseTrackerClient.h"
+#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 *WebDatabaseSizeKey = @"WebDatabaseSizeKey";
+const NSString *WebDatabaseDisplayNameKey = @"WebDatabaseDisplayNameKey";
+const NSString *WebDatabaseExpectedSizeKey = @"WebDatabaseExpectedSizeKey";
+const NSString *WebDatabaseUsageKey = @"WebDatabaseUsageKey";
+
+const NSString *WebDatabaseDidModifyOriginNotification = @"WebDatabaseDidModifyOriginNotification";
+const NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification";
 
 @implementation WebDatabaseManager
 
-+ (NSArray *)origins
++ (WebDatabaseManager *) sharedWebDatabaseManager
 {
-    NSMutableArray *array = [[NSMutableArray alloc] init];
-
-    const HashSet<String>& origins = DatabaseTracker::tracker().origins();
-    HashSet<String>::const_iterator iter = origins.begin();
-    HashSet<String>::const_iterator end = origins.end();
+    static WebDatabaseManager *sharedManager = [[WebDatabaseManager alloc] init];
+    return sharedManager;
+}
 
-    for (; iter != end; ++iter)
-        [array addObject:(NSString *)(*iter)];
+- (NSArray *)origins
+{
+    return nil;
+}
 
-    return [array autorelease];
+- (NSDictionary *)detailsForOrigin:(WebSecurityOrigin *)origin
+{
+    return nil;
 }
 
-+ (NSArray *)databasesWithOrigin:(NSString *)origin
+- (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin
 {
-    Vector<String> result;
-    if (!DatabaseTracker::tracker().databaseNamesForOrigin(origin, result))
-        return nil;
+    return nil;
+}
 
-    NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:result.size()];
+- (NSDictionary *)detailsForDatabase:(NSString *)databaseName withOrigin:(WebSecurityOrigin *)origin
+{
+    return nil;
+}
 
-    for (unsigned i = 0; i < result.size(); ++i)
-        [array addObject:(NSString *)result[i]];
+- (void)setQuota:(unsigned long long)quota forOrigin:(WebSecurityOrigin *)origin
+{
 
-    return array;
 }
 
-+ (void)deleteAllDatabases
+- (void)deleteAllDatabases
 {
     DatabaseTracker::tracker().deleteAllDatabases();
 }
 
-+ (void)deleteAllDatabasesWithOrigin:(NSString *)origin
+- (void)deleteDatabasesWithOrigin:(WebSecurityOrigin *)origin
 {
-    DatabaseTracker::tracker().deleteAllDatabasesForOrigin(origin);
+    SecurityOriginData coreOrigin([origin protocol], [origin domain], [origin port]);
+
+    DatabaseTracker::tracker().deleteDatabasesWithOrigin(coreOrigin);
 }
 
-+ (void)deleteDatabaseWithOrigin:(NSString *)origin named:(NSString *)name
+- (void)deleteDatabase:(NSString *)databaseName withOrigin:(WebSecurityOrigin *)origin
 {
-    DatabaseTracker::tracker().deleteDatabase(origin, name);
+    SecurityOriginData coreOrigin([origin protocol], [origin domain], [origin port]);
+    
+    DatabaseTracker::tracker().deleteDatabase(coreOrigin, databaseName);
 }
-
 @end
 
-void WebKitSetWebDatabasesPathIfNecessary()
+void WebKitInitializeDatabasesIfNecessary()
 {
-    static BOOL pathSet = NO;
-    if (pathSet)
+    static BOOL initialized = NO;
+    if (initialized)
         return;
 
+    // Set the database root path in WebCore
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 
     NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey];
-    if (!databasesDirectory)
+    if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
         databasesDirectory = @"~/Library/WebKit/Databases";
 
     DatabaseTracker::tracker().setDatabasePath([databasesDirectory stringByStandardizingPath]);
 
-    pathSet = YES;
+    // Set the DatabaseTrackerClient
+    DatabaseTracker::tracker().setClient(WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient());
+    
+    initialized = YES;
 }
similarity index 95%
rename from WebKit/mac/Misc/WebDatabaseManagerPrivate.h
rename to WebKit/mac/Storage/WebDatabaseManagerInternal.h
index 428b55586cb6f8a60c007c108d1481feeef57ea0..2065a4e712fa562a6a4a3a2b3d041f914dd8ecf9 100644 (file)
@@ -26,6 +26,4 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WebDatabaseManager.h"
-
-void WebKitSetWebDatabasesPathIfNecessary();
+void WebKitInitializeDatabasesIfNecessary();
diff --git a/WebKit/mac/Storage/WebDatabaseManagerPrivate.h b/WebKit/mac/Storage/WebDatabaseManagerPrivate.h
new file mode 100644 (file)
index 0000000..1417340
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * 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;
+
+// Posted with an origin is created from scratch, gets a new database, has a database deleted, has a quota change, etc
+extern const NSString *WebDatabaseDidModifyOriginNotification;
+
+// Posted when a database is created, its size increases, its display name changes, or its estimated size changes, or the database is removed
+extern const NSString *WebDatabaseDidModifyDatabaseNotification;
+
+@class WebSecurityOrigin;
+
+@interface WebDatabaseManager : NSObject
+{
+}
+
++ (WebDatabaseManager *) sharedWebDatabaseManager;
+
+// 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
+- (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;
+
+@end
diff --git a/WebKit/mac/Storage/WebDatabaseTrackerClient.h b/WebKit/mac/Storage/WebDatabaseTrackerClient.h
new file mode 100644 (file)
index 0000000..eb99faf
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DatabaseTrackerClient.h>
+#import <WebCore/SecurityOriginData.h>
+
+class WebDatabaseTrackerClient : public WebCore::DatabaseTrackerClient {
+public:
+    static WebDatabaseTrackerClient* sharedWebDatabaseTrackerClient();
+    
+    virtual ~WebDatabaseTrackerClient();
+    virtual void dispatchDidModifyOrigin(const WebCore::SecurityOriginData&);
+    virtual void dispatchDidModifyDatabase(const WebCore::SecurityOriginData&, const WebCore::String& databaseName);
+private:
+    WebDatabaseTrackerClient();
+};
diff --git a/WebKit/mac/Storage/WebDatabaseTrackerClient.mm b/WebKit/mac/Storage/WebDatabaseTrackerClient.mm
new file mode 100644 (file)
index 0000000..b6e8f6f
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#import "WebDatabaseTrackerClient.h"
+WebDatabaseTrackerClient* WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient()
+{
+    static WebDatabaseTrackerClient* sharedClient = new WebDatabaseTrackerClient();
+    return sharedClient;
+}
+
+WebDatabaseTrackerClient::WebDatabaseTrackerClient()
+{
+}
+
+WebDatabaseTrackerClient::~WebDatabaseTrackerClient()
+{
+}
+    
+void WebDatabaseTrackerClient::dispatchDidModifyOrigin(const WebCore::SecurityOriginData& origin)
+{
+
+}
+
+void WebDatabaseTrackerClient::dispatchDidModifyDatabase(const WebCore::SecurityOriginData& origin, const WebCore::String& databaseName)
+{
+
+}
index 513e2d7d43bf9b2424108316faef1de2368ad951..c05bc91445c2298b467c0e147953daa94db436b8 100644 (file)
@@ -37,6 +37,7 @@
 #import "WebContextMenuClient.h"
 #import "WebDOMOperationsPrivate.h"
 #import "WebDashboardRegion.h"
+#import "WebDatabaseManagerInternal.h"
 #import "WebDatabaseManagerPrivate.h"
 #import "WebDataSourceInternal.h"
 #import "WebDefaultEditingDelegate.h"
@@ -1784,7 +1785,7 @@ WebFrameLoadDelegateImplementationCache WebViewGetFrameLoadDelegateImplementatio
     WebKitInitializeLoggingChannelsIfNecessary();
     WebCore::InitializeLoggingChannelsIfNecessary();
     [WebHistoryItem initWindowWatcherIfNecessary];
-    WebKitSetWebDatabasesPathIfNecessary();
+    WebKitInitializeDatabasesIfNecessary();
 
     _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self));
     [[[WebFrameBridge alloc] initMainFrameWithPage:_private->page frameName:frameName frameView:frameView] release];