WebCore:
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2007 17:51:44 +0000 (17:51 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2007 17:51:44 +0000 (17:51 +0000)
        Reviewed by Maciej

        Stub out the WebCore parts of the WebKit API

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

        * storage/DatabaseDetails.h: Added.  Simple container for vitals on a specific database
        (WebCore::DatabaseDetails::DatabaseDetails::DatabaseDetails):
        (WebCore::DatabaseDetails::DatabaseDetails):
        (WebCore::DatabaseDetails::isValid):
        (WebCore::DatabaseDetails::name):
        (WebCore::DatabaseDetails::version):
        (WebCore::DatabaseDetails::displayName):
        (WebCore::DatabaseDetails::expectedUsage):
        (WebCore::DatabaseDetails::currentUsage):

        * storage/DatabaseTracker.cpp:  Added various methods for API usage
        (WebCore::DatabaseTracker::detailsForNameAndOrigin):
        (WebCore::DatabaseTracker::usageForOrigin):
        (WebCore::DatabaseTracker::quotaForOrigin):
        (WebCore::DatabaseTracker::setQuota):
        * storage/DatabaseTracker.h:

WebKit:

        Reviewed by Maciej

        * WebKit.xcodeproj/project.pbxproj: Sorted!

WebKit/mac:

        Reviewed by Maciej

        Finished hooking up the WebKit API for database management.
        Most of the API is actually implemented in WebCore and some of those methods might
        only be stubs for now.

        * Storage/WebDatabaseManager.mm:
        (-[WebDatabaseManager origins]): Call through to the WebCore tracker and construct an API result
        (-[WebDatabaseManager databasesWithOrigin:]): Ditto
        (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Ditto

        * Storage/WebSecurityOrigin.mm:
        (-[WebSecurityOrigin usage]): Call through to WebCore
        (-[WebSecurityOrigin quota]): Ditto
        (-[WebSecurityOrigin setQuota:]): Ditto
        (-[WebSecurityOrigin _core]): Get WebCore version of this object
        * Storage/WebSecurityOriginInternal.h:

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

12 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/storage/DatabaseDetails.h [new file with mode: 0644]
WebCore/storage/DatabaseTracker.cpp
WebCore/storage/DatabaseTracker.h
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/mac/ChangeLog
WebKit/mac/Storage/WebDatabaseManager.mm
WebKit/mac/Storage/WebSecurityOrigin.mm
WebKit/mac/Storage/WebSecurityOriginInternal.h

index a30a03a29451b536860678b865110b64594e5fb4..00e3bc3927d393ab5a0eb58cb5a4bc9f76779616 100644 (file)
@@ -1,3 +1,29 @@
+2007-11-19  Brady Eidson <beidson@apple.com>
+
+        Reviewed by Maciej
+
+        Stub out the WebCore parts of the WebKit API
+
+        * WebCore.base.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * storage/DatabaseDetails.h: Added.  Simple container for vitals on a specific database
+        (WebCore::DatabaseDetails::DatabaseDetails::DatabaseDetails):
+        (WebCore::DatabaseDetails::DatabaseDetails):
+        (WebCore::DatabaseDetails::isValid):
+        (WebCore::DatabaseDetails::name):
+        (WebCore::DatabaseDetails::version):
+        (WebCore::DatabaseDetails::displayName):
+        (WebCore::DatabaseDetails::expectedUsage):
+        (WebCore::DatabaseDetails::currentUsage):
+
+        * storage/DatabaseTracker.cpp:  Added various methods for API usage
+        (WebCore::DatabaseTracker::detailsForNameAndOrigin):
+        (WebCore::DatabaseTracker::usageForOrigin):
+        (WebCore::DatabaseTracker::quotaForOrigin):
+        (WebCore::DatabaseTracker::setQuota):
+        * storage/DatabaseTracker.h:
+
 2007-11-19  Kevin Ollivier  <kevino@theolliviers.com>
 
         wx port build fix.
index cba4335cfb4f6c0e00f47b4608ffe094c369988b..d020feb3c03842a68a39c00b25fe4124b100703e 100644 (file)
@@ -290,10 +290,16 @@ __ZN7WebCore15BackForwardListC1EPNS_4PageE
 __ZN7WebCore15BackForwardListD1Ev
 __ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
 __ZN7WebCore15DatabaseTracker14deleteDatabaseERKNS_18SecurityOriginDataERKNS_6StringE
+__ZN7WebCore15DatabaseTracker14quotaForOriginERKNS_18SecurityOriginDataE
+__ZN7WebCore15DatabaseTracker14usageForOriginERKNS_18SecurityOriginDataE
 __ZN7WebCore15DatabaseTracker15setDatabasePathERKNS_6StringE
 __ZN7WebCore15DatabaseTracker18deleteAllDatabasesEv
+__ZN7WebCore15DatabaseTracker22databaseNamesForOriginERKNS_18SecurityOriginDataERN3WTF6VectorINS_6StringELm0EEE
+__ZN7WebCore15DatabaseTracker23detailsForNameAndOriginERKNS_6StringERKNS_18SecurityOriginDataE
 __ZN7WebCore15DatabaseTracker25deleteDatabasesWithOriginERKNS_18SecurityOriginDataE
+__ZN7WebCore15DatabaseTracker7originsERN3WTF6VectorINS_18SecurityOriginDataELm0EEE
 __ZN7WebCore15DatabaseTracker7trackerEv
+__ZN7WebCore15DatabaseTracker8setQuotaERKNS_18SecurityOriginDataEy
 __ZN7WebCore15DatabaseTracker9setClientEPNS_21DatabaseTrackerClientE
 __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
@@ -411,11 +417,15 @@ __ZN7WebCore6Editor11canDHTMLCutEv
 __ZN7WebCore6Editor11execCommandERKNS_12AtomicStringEPNS_5EventE
 __ZN7WebCore6Editor11tryDHTMLCutEv
 __ZN7WebCore6Editor12canDHTMLCopyEv
+__ZN7WebCore6Editor12deleteToMarkEv
+__ZN7WebCore6Editor12selectToMarkEv
+__ZN7WebCore6Editor12swapWithMarkEv
 __ZN7WebCore6Editor12tryDHTMLCopyEv
 __ZN7WebCore6Editor13canDHTMLPasteEv
 __ZN7WebCore6Editor13performDeleteEv
 __ZN7WebCore6Editor13rangeForPointERKNS_8IntPointE
 __ZN7WebCore6Editor13tryDHTMLPasteEv
+__ZN7WebCore6Editor13yankAndSelectEv
 __ZN7WebCore6Editor14setCompositionERKNS_6StringERKN3WTF6VectorINS_20CompositionUnderlineELm0EEEjj
 __ZN7WebCore6Editor16pasteAsPlainTextEv
 __ZN7WebCore6Editor17insertOrderedListEv
@@ -435,21 +445,17 @@ __ZN7WebCore6Editor30applyParagraphStyleToSelectionEPNS_19CSSStyleDeclarationENS
 __ZN7WebCore6Editor30deleteSelectionWithSmartDeleteEb
 __ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv
 __ZN7WebCore6Editor33increaseSelectionListLevelOrderedEv
-__ZN7WebCore6Editor12deleteToMarkEv
-__ZN7WebCore6Editor12selectToMarkEv
-__ZN7WebCore6Editor12swapWithMarkEv
-__ZN7WebCore6Editor13yankAndSelectEv
-__ZN7WebCore6Editor4yankEv
-__ZN7WebCore6Editor7setMarkEv
 __ZN7WebCore6Editor35increaseSelectionListLevelUnorderedEv
 __ZN7WebCore6Editor35setIgnoreCompositionSelectionChangeEb
 __ZN7WebCore6Editor3cutEv
 __ZN7WebCore6Editor44confirmCompositionWithoutDisturbingSelectionEv
 __ZN7WebCore6Editor4copyEv
+__ZN7WebCore6Editor4yankEv
 __ZN7WebCore6Editor5pasteEv
 __ZN7WebCore6Editor6indentEv
 __ZN7WebCore6Editor7copyURLERKNS_4KURLERKNS_6StringE
 __ZN7WebCore6Editor7outdentEv
+__ZN7WebCore6Editor7setMarkEv
 __ZN7WebCore6String6appendERKS0_
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EPKc
index 2f665b95661eab58a365b24f9cb0026060a6cf77..f48769db110e10038a8951471fa77edd7dcb3a0e 100644 (file)
                510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };
                51079DD50CED2A820077247D /* SecurityOriginData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51079DD40CED2A820077247D /* SecurityOriginData.cpp */; };
+               5116D9770CF177BD00C2B84D /* DatabaseDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 5116D9750CF177BD00C2B84D /* DatabaseDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
                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, ); }; };
                510184670B08602A004A825F /* CachedPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedPage.h; sourceTree = "<group>"; };
                510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = "<group>"; };
                51079DD40CED2A820077247D /* SecurityOriginData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOriginData.cpp; sourceTree = "<group>"; };
+               5116D9750CF177BD00C2B84D /* DatabaseDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseDetails.h; 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>"; };
                                519611600CAC56570010A80C /* Database.idl */,
                                51A45B550CAD7FD7000D2BE9 /* DatabaseAuthorizer.cpp */,
                                51A45B540CAD7FD7000D2BE9 /* DatabaseAuthorizer.h */,
+                               5116D9750CF177BD00C2B84D /* DatabaseDetails.h */,
                                519611E90CAC749C0010A80C /* DatabaseTask.cpp */,
                                519611E80CAC749C0010A80C /* DatabaseTask.h */,
                                519611610CAC56570010A80C /* DatabaseThread.cpp */,
                                BCEA4856097D93020094C9E4 /* DataRef.h in Headers */,
                                5196116B0CAC56570010A80C /* Database.h in Headers */,
                                51A45B560CAD7FD7000D2BE9 /* DatabaseAuthorizer.h in Headers */,
+                               5116D9770CF177BD00C2B84D /* DatabaseDetails.h in Headers */,
                                519611EA0CAC749C0010A80C /* DatabaseTask.h in Headers */,
                                519611780CAC56A80010A80C /* DatabaseThread.h in Headers */,
                                1AD51A140CB59CD300953D11 /* DatabaseTracker.h in Headers */,
diff --git a/WebCore/storage/DatabaseDetails.h b/WebCore/storage/DatabaseDetails.h
new file mode 100644 (file)
index 0000000..55067ac
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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 DatabaseDetails_h
+#define DatabaseDetails_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class DatabaseDetails {
+public:
+    DatabaseDetails::DatabaseDetails()
+        : m_expectedUsage(0)
+        , m_currentUsage(0)
+    { }
+    
+    DatabaseDetails(const String& databaseName, const String& databaseVersion, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage)
+        : m_name(databaseName)
+        , m_version(databaseVersion)
+        , m_displayName(displayName)
+        , m_expectedUsage(expectedUsage)
+        , m_currentUsage(currentUsage)
+    { }
+    
+    bool isValid() const { return !(m_name.isEmpty() && m_version.isEmpty() && m_displayName.isEmpty() && !m_expectedUsage && !m_currentUsage); }
+    
+    const String& name() { return m_name; }
+    const String& version() { return m_version; }
+    const String& displayName() { return m_displayName; }
+    unsigned long long expectedUsage() { return m_expectedUsage; }
+    unsigned long long currentUsage() { return m_currentUsage; }
+    
+private:
+    String m_name;
+    String m_version;
+    String m_displayName;
+    unsigned long long m_expectedUsage;
+    unsigned long long m_currentUsage; 
+
+};
+
+} // namespace WebCore
+
+#endif // DatabaseDetails_h
index dde62c25977a943508648dec11296943b077f2f3..15a08a5eb1543effeee37649787c277a37be3bbb 100644 (file)
@@ -221,6 +221,30 @@ bool DatabaseTracker::databaseNamesForOrigin(const SecurityOriginData& origin, V
     return true;
 }
 
+DatabaseDetails DatabaseTracker::detailsForNameAndOrigin(const String& name, const SecurityOriginData& origin)
+{
+    notImplemented();
+    return DatabaseDetails();
+}
+
+
+unsigned long long DatabaseTracker::usageForOrigin(const SecurityOriginData& origin)
+{
+    notImplemented();
+    return 0;
+}
+
+unsigned long long DatabaseTracker::quotaForOrigin(const SecurityOriginData& origin)
+{
+    notImplemented();
+    return 5 * 1024 * 1024;
+}
+
+void DatabaseTracker::setQuota(const SecurityOriginData& origin, unsigned long long quota)
+{
+    notImplemented();
+}
+    
 bool DatabaseTracker::addDatabase(const SecurityOriginData& origin, const String& name, const String& path)
 {
     if (!m_database.isOpen())
index 91a56dad1095585aa554dcbd756499d0c3c56506..0f3c0db71a74e53f8b7940820b7e412b8db6e7fc 100644 (file)
@@ -28,6 +28,7 @@
 #ifndef DatabaseTracker_h
 #define DatabaseTracker_h
 
+#include "DatabaseDetails.h"
 #include "PlatformString.h"
 #include "SQLiteDatabase.h"
 #include "StringHash.h"
@@ -51,6 +52,12 @@ public:
     void origins(Vector<SecurityOriginData>& result);
     bool databaseNamesForOrigin(const SecurityOriginData& origin, Vector<String>& result);
 
+    DatabaseDetails detailsForNameAndOrigin(const String&, const SecurityOriginData&);
+    
+    unsigned long long usageForOrigin(const SecurityOriginData&);
+    unsigned long long quotaForOrigin(const SecurityOriginData&);
+    void setQuota(const SecurityOriginData&, unsigned long long);
+    
     void deleteAllDatabases();
     void deleteDatabasesWithOrigin(const SecurityOriginData& origin);
     void deleteDatabase(const SecurityOriginData& origin, const String& name);
index 0ae59bd4231a885c02424585387f524208002350..9a7c30f3fb95246197462db04922503be5240812 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-19  Brady Eidson <beidson@apple.com>
+
+        Reviewed by Maciej
+
+        * WebKit.xcodeproj/project.pbxproj: Sorted!
+
 2007-11-17  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Mark Rowe.
index 0ef1e8565849d5047b4e20873f04edb5dd3930f5..5d537ca178467e6c159417c2d166ca2620c4b39c 100644 (file)
                                9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
                                658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */,
                                9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
+                               51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
                                511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */,
                                511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */,
                                9398104E0824BF01008DF038 /* WebDefaultContextMenuDelegate.h in Headers */,
                                1C0706630A431E01001078F6 /* WebScriptDebugServer.h in Headers */,
                                1C07079A0A433E22001078F6 /* WebScriptDebugServerPrivate.h in Headers */,
                                939810260824BF01008DF038 /* WebSearchableTextView.h in Headers */,
+                               51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */,
+                               51079D190CED11B00077247D /* 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 */,
-                               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 */,
+                               51079D170CED11B00077247D /* 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 614ad3220bcdc997a60ec66aef3975d6ff3af955..a6b03a6a3691090cfe8db4e5c9d7c9984104783e 100644 (file)
@@ -1,3 +1,23 @@
+2007-11-19  Brady Eidson <beidson@apple.com>
+
+        Reviewed by Maciej
+
+        Finished hooking up the WebKit API for database management.
+        Most of the API is actually implemented in WebCore and some of those methods might
+        only be stubs for now.
+
+        * Storage/WebDatabaseManager.mm:
+        (-[WebDatabaseManager origins]): Call through to the WebCore tracker and construct an API result
+        (-[WebDatabaseManager databasesWithOrigin:]): Ditto
+        (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Ditto
+
+        * Storage/WebSecurityOrigin.mm:
+        (-[WebSecurityOrigin usage]): Call through to WebCore
+        (-[WebSecurityOrigin quota]): Ditto
+        (-[WebSecurityOrigin setQuota:]): Ditto
+        (-[WebSecurityOrigin _core]): Get WebCore version of this object
+        * Storage/WebSecurityOriginInternal.h:
+
 2007-11-17  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Mark Rowe.
index d61819b2eccd3cb719c717fcbf799e843e5d26f2..593c044fdb092c9a1f30523889b6ec0a61726a2d 100644 (file)
@@ -31,6 +31,7 @@
 
 #import "WebDatabaseTrackerClient.h"
 #import "WebSecurityOriginPrivate.h"
+#import "WebSecurityOriginInternal.h"
 
 #import <WebCore/DatabaseTracker.h>
 
@@ -55,17 +56,47 @@ const NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModif
 
 - (NSArray *)origins
 {
-    return nil;
+    Vector<WebCoreSecurityOriginData> coreOrigins;
+    DatabaseTracker::tracker().origins(coreOrigins);
+    NSMutableArray *webOrigins = [[NSMutableArray alloc] initWithCapacity:coreOrigins.size()];
+
+    for (unsigned i = 0; i < coreOrigins.size(); ++i) {
+        WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOriginData:&coreOrigins[i]];
+        [webOrigins addObject:webOrigin];
+        [webOrigin release];
+    }
+
+    return [webOrigins autorelease];
 }
 
 - (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin
 {
-    return nil;
+    Vector<String> nameVector;
+    if (!DatabaseTracker::tracker().databaseNamesForOrigin([origin _core], nameVector))
+        return nil;
+    
+    NSMutableArray *names = [[NSMutableArray alloc] initWithCapacity:nameVector.size()];
+
+    for (unsigned i = 0; i < nameVector.size(); ++i)
+        [names addObject:(NSString *)nameVector[i]];
+
+    return [names autorelease];
 }
 
 - (NSDictionary *)detailsForDatabase:(NSString *)databaseName withOrigin:(WebSecurityOrigin *)origin
 {
-    return nil;
+    static id keys[3] = {WebDatabaseDisplayNameKey, WebDatabaseExpectedSizeKey, WebDatabaseUsageKey};
+    
+    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, [origin _core]);
+    if (!details.isValid())
+        return nil;
+        
+    id objects[3];
+    objects[0] = details.displayName().isEmpty() ? databaseName : (NSString *)details.displayName();
+    objects[1] = [NSNumber numberWithUnsignedLongLong:details.expectedUsage()];
+    objects[2] = [NSNumber numberWithUnsignedLongLong:details.currentUsage()];
+    
+    return [[[NSDictionary alloc] initWithObjects:objects forKeys:keys count:3] autorelease];
 }
 
 - (void)deleteAllDatabases
index 1ee49edf0dd28e68079e58afc52586b5b84de16f..ad77c25e85fafbec2495781644d924e1268e85dd 100644 (file)
 #import "WebSecurityOriginPrivate.h"
 
 #import "WebSecurityOriginInternal.h"
-#include <WebCore/SecurityOriginData.h>
+
+#import <WebCore/DatabaseTracker.h>
+#import <WebCore/SecurityOriginData.h>
+
+using namespace WebCore;
 
 @interface WebSecurityOriginPrivate : NSObject {
 @public
 
 - (unsigned long long)usage
 {
-    return 0;
+    return DatabaseTracker::tracker().usageForOrigin(*_private->securityOriginData);
 }
 
 - (unsigned long long)quota
 {
-    return 0;
+    return DatabaseTracker::tracker().quotaForOrigin(*_private->securityOriginData);
 }
 
 // Sets the storage quota (in bytes)
 // This will simply prevent new data from being added to databases in that origin
 - (void)setQuota:(unsigned long long)quota
 {
-
+    DatabaseTracker::tracker().setQuota(*_private->securityOriginData, quota);
 }
 
 - (void)dealloc
     return self;
 }
 
+- (WebCoreSecurityOriginData)_core
+{
+    return WebCoreSecurityOriginData(*_private->securityOriginData);
+}
+
 @end
index 9bf45e3cb8f3e54c0c9645d4a3d571a96960a1d4..dd82ad4714358e4f688dcb856f05f854cf3fecd7 100644 (file)
@@ -35,5 +35,6 @@ typedef WebCore::SecurityOriginData WebCoreSecurityOriginData;
 @interface WebSecurityOrigin (WebInternal)
 
 - (id)_initWithWebCoreSecurityOriginData:(WebCoreSecurityOriginData *)securityOriginData;
+- (WebCoreSecurityOriginData)_core;
 
 @end