[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

joepeck at webkit.org joepeck at webkit.org
Wed Dec 22 11:37:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 263d1335c87c253516265fce2a2f7c036151adf7
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jul 31 02:22:45 2010 +0000

    2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
    Reviewed by David Kilzer.
    
    WebCore:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Part 4 - Client Notification when the Quota is Reached
    
                Notify the WebKit client when the per-origin quota is reached
                via a delegate method reachedApplicationCacheOriginQuota.
    
                  Call the delegate method when the quota is reached.
    
                * loader/appcache/ApplicationCacheGroup.cpp:
                (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
                (WebCore::ApplicationCacheGroup::didFinishLoading):
                (WebCore::ApplicationCacheGroup::didReachOriginQuota):
                (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota):
                (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
                (WebCore::ApplicationCacheGroup::scheduleReachedOriginQuotaCallback):
                * loader/appcache/ApplicationCacheGroup.h:
    
                  Some minor refactoring to access more quota information
                  without repeating code. Such as origin usage, and creating
                  an origin record.
    
                * loader/appcache/ApplicationCacheStorage.cpp:
                (WebCore::ApplicationCacheStorage::usageForOrigin):
                (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
                (WebCore::ApplicationCacheStorage::store):
                (WebCore::ApplicationCacheStorage::ensureOriginRecord):
                * loader/appcache/ApplicationCacheStorage.h:
    
                  Boilerplate. Exports and definition of the delegate method.
    
                * WebCore.OfflineWebApplications.exp:
                * loader/EmptyClients.h:
                (WebCore::EmptyChromeClient::reachedApplicationCacheOriginQuota):
                * page/ChromeClient.h:
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
    WebKit:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebKit.xcodeproj/project.pbxproj:
                * efl/WebCoreSupport/ChromeClientEfl.cpp:
                (WebCore::ChromeClientEfl::reachedApplicationCacheOriginQuota):
                * efl/WebCoreSupport/ChromeClientEfl.h:
    
    WebKit/chromium:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * src/ChromeClientImpl.cpp:
                (WebKit::ChromeClientImpl::reachedApplicationCacheOriginQuota):
                * src/ChromeClientImpl.h:
    
    WebKit/gtk:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebCoreSupport/ChromeClientGtk.cpp:
                (WebKit::ChromeClient::reachedApplicationCacheOriginQuota):
                * WebCoreSupport/ChromeClientGtk.h:
    
    WebKit/haiku:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebCoreSupport/ChromeClientHaiku.cpp:
                (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota):
                * WebCoreSupport/ChromeClientHaiku.h:
    
    WebKit/mac:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Part 4 - Client Notification when the Quota is Reached
    
                Notify the WebKit client when the per-origin quota is reached
                via a delegate method reachedApplicationCacheOriginQuota.
    
                  Refactor the WebSecurityOrigin class to be generic enough to
                  allow quota management of both Databases or Application Caches
                  via subclasses.
    
                * Storage/WebDatabaseSecurityOrigin.h: Added.
                * Storage/WebDatabaseSecurityOrigin.mm: Added.
                (-[WebDatabaseSecurityOrigin quota]):
                (-[WebDatabaseSecurityOrigin setQuota:]):
                * WebCoreSupport/WebApplicationCacheSecurityOrigin.h: Added.
                * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: Added.
                (-[WebApplicationCacheSecurityOrigin quota]):
                (-[WebApplicationCacheSecurityOrigin setQuota:]):
                * Storage/WebSecurityOrigin.mm: Removed. (Moved to WebCoreSupport)
                * Storage/WebSecurityOriginPrivate.h: Removed. (Moved to WebCoreSupport)
                * WebCoreSupport/WebSecurityOrigin.mm: Added.
                (-[WebSecurityOrigin usage]): to be implemented by subclasses.
                (-[WebSecurityOrigin quota]): to be implemented by subclasses.
                (-[WebSecurityOrigin setQuota:]): to be implemented by subclasses.
                * WebCoreSupport/WebSecurityOriginInternal.h: Renamed from WebKit/mac/Storage/WebSecurityOriginInternal.h.
                * WebCoreSupport/WebSecurityOriginPrivate.h: Added.
    
                  Turn the notification into a WebUI Delegate to call. Following
                  the example of Databases.
    
                * DefaultDelegates/WebDefaultUIDelegate.m:
                (-[WebDefaultUIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:]):
                * WebCoreSupport/WebChromeClient.h:
                * WebCoreSupport/WebChromeClient.mm:
                (WebChromeClient::exceededDatabaseQuota): use the Databases Security Origin subclass.
                (WebChromeClient::reachedApplicationCacheOriginQuota): use the Application Cache Security Origin subclass.
                * WebView/WebUIDelegatePrivate.h:
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
    WebKit/qt:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebCoreSupport/ChromeClientQt.cpp:
                (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota):
                * WebCoreSupport/ChromeClientQt.h:
    
    WebKit/win:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebCoreSupport/WebChromeClient.cpp:
                (WebChromeClient::reachedApplicationCacheOriginQuota):
                * WebCoreSupport/WebChromeClient.h:
    
    WebKit/wx:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebKitSupport/ChromeClientWx.cpp:
                (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota):
                * WebKitSupport/ChromeClientWx.h:
    
    WebKit2:
    
        2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                * WebProcess/WebCoreSupport/WebChromeClient.cpp:
                (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
                * WebProcess/WebCoreSupport/WebChromeClient.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64400 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 915bdda..259eb04 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -5,6 +5,47 @@
         Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
         https://bugs.webkit.org/show_bug.cgi?id=40627
 
+        Part 4 - Client Notification when the Quota is Reached
+
+        Notify the WebKit client when the per-origin quota is reached
+        via a delegate method reachedApplicationCacheOriginQuota.
+
+          Call the delegate method when the quota is reached.
+
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
+        (WebCore::ApplicationCacheGroup::didFinishLoading):
+        (WebCore::ApplicationCacheGroup::didReachOriginQuota):
+        (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota):
+        (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
+        (WebCore::ApplicationCacheGroup::scheduleReachedOriginQuotaCallback):
+        * loader/appcache/ApplicationCacheGroup.h:
+
+          Some minor refactoring to access more quota information
+          without repeating code. Such as origin usage, and creating
+          an origin record.
+
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::usageForOrigin):
+        (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
+        (WebCore::ApplicationCacheStorage::store):
+        (WebCore::ApplicationCacheStorage::ensureOriginRecord):
+        * loader/appcache/ApplicationCacheStorage.h:
+
+          Boilerplate. Exports and definition of the delegate method.
+
+        * WebCore.OfflineWebApplications.exp:
+        * loader/EmptyClients.h:
+        (WebCore::EmptyChromeClient::reachedApplicationCacheOriginQuota):
+        * page/ChromeClient.h:
+
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
         Part 3 - Refactor storeNewestCache to allow Failure Reason Output
 
         Storing can result in an error in a number of reasons. Previously
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 07824dc..0abbcf1 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -1465,11 +1465,15 @@ __ZN7WebCore9HTMLNames8videoTagE
 #endif
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
+__ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx
 __ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
+__ZN7WebCore23ApplicationCacheStorage14usageForOriginEPKNS_14SecurityOriginERx
 __ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE
 __ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE
 __ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv
 __ZN7WebCore23ApplicationCacheStorage21setDefaultOriginQuotaEx
+__ZN7WebCore23ApplicationCacheStorage26storeUpdatedQuotaForOriginEPKNS_14SecurityOriginEx
+__ZN7WebCore23ApplicationCacheStorage36remainingSizeForOriginExcludingCacheEPKNS_14SecurityOriginEPNS_16ApplicationCacheERx
 __ZN7WebCore23ApplicationCacheStorage5emptyEv
 __ZNK7WebCore23ApplicationCacheStorage11maximumSizeEv
 #endif
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index 3f2cf19..eca01e8 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -28,8 +28,8 @@
 #define EmptyClients_h
 
 #include "ChromeClient.h"
-#include "ContextMenuClient.h"
 #include "Console.h"
+#include "ContextMenuClient.h"
 #include "DocumentLoader.h"
 #include "DragClient.h"
 #include "EditCommand.h"
@@ -141,6 +141,7 @@ public:
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t) { }
+    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*) { }
 #endif
 
 #if ENABLE(NOTIFICATIONS)
diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp
index bbfc676..395d9ad 100644
--- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp
+++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp
@@ -71,6 +71,7 @@ ApplicationCacheGroup::ApplicationCacheGroup(const KURL& manifestURL, bool isCop
     , m_calledReachedMaxAppCacheSize(false)
     , m_loadedSize(0)
     , m_availableSpaceInQuota(ApplicationCacheStorage::unknownQuota())
+    , m_originQuotaReached(false)
 {
 }
 
@@ -624,7 +625,7 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle)
     // idea of the available quota space.
     if (m_availableSpaceInQuota < m_loadedSize) {
         m_currentResource = 0;
-        cacheUpdateFailed();
+        cacheUpdateFailedDueToOriginQuota();
         return;
     }
 
@@ -792,6 +793,13 @@ void ApplicationCacheGroup::didReachMaxAppCacheSize()
     checkIfLoadIsComplete();
 }
 
+void ApplicationCacheGroup::didReachOriginQuota(PassRefPtr<Frame> frame)
+{
+    // Inform the client the origin quota has been reached,
+    // they may decide to increase the quota.
+    frame->page()->chrome()->client()->reachedApplicationCacheOriginQuota(m_origin.get());
+}
+
 void ApplicationCacheGroup::cacheUpdateFailed()
 {
     stopLoading();
@@ -801,6 +809,16 @@ void ApplicationCacheGroup::cacheUpdateFailed()
     m_completionType = Failure;
     deliverDelayedMainResources();
 }
+
+void ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota()
+{
+    if (!m_originQuotaReached) {
+        m_originQuotaReached = true;
+        scheduleReachedOriginQuotaCallback();
+    }
+
+    cacheUpdateFailed();
+}
     
 void ApplicationCacheGroup::manifestNotFound()
 {
@@ -894,12 +912,14 @@ void ApplicationCacheGroup::checkIfLoadIsComplete()
 
             // Fire the success event.
             postListenerTask(isUpgradeAttempt ? ApplicationCacheHost::UPDATEREADY_EVENT : ApplicationCacheHost::CACHED_EVENT, m_associatedDocumentLoaders);
+            // It is clear that the origin quota was not reached, so clear the flag if it was set.
+            m_originQuotaReached = false;
         } else {
             if (failureReason == ApplicationCacheStorage::OriginQuotaReached) {
                 // We ran out of space for this origin. Roll back to previous state.
                 if (oldNewestCache)
                     setNewestCache(oldNewestCache.release());
-                cacheUpdateFailed();
+                cacheUpdateFailedDueToOriginQuota();
                 return;
             }
 
@@ -1059,6 +1079,25 @@ private:
     ApplicationCacheGroup* m_cacheGroup;
 };
 
+class OriginQuotaReachedCallbackTimer: public TimerBase {
+public:
+    OriginQuotaReachedCallbackTimer(ApplicationCacheGroup* cacheGroup, Frame* frame)
+        : m_cacheGroup(cacheGroup)
+        , m_frame(frame)
+    {
+    }
+
+private:
+    virtual void fired()
+    {
+        m_cacheGroup->didReachOriginQuota(m_frame.release());
+        delete this;
+    }
+
+    ApplicationCacheGroup* m_cacheGroup;
+    RefPtr<Frame> m_frame;
+};
+
 void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback()
 {
     ASSERT(isMainThread());
@@ -1067,6 +1106,15 @@ void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback()
     // The timer will delete itself once it fires.
 }
 
+void ApplicationCacheGroup::scheduleReachedOriginQuotaCallback()
+{
+    ASSERT(isMainThread());
+    RefPtr<Frame> frameProtector = m_frame;
+    OriginQuotaReachedCallbackTimer* timer = new OriginQuotaReachedCallbackTimer(this, frameProtector.get());
+    timer->startOneShot(0);
+    // The timer will delete itself once it fires.
+}
+
 class CallCacheListenerTask : public ScriptExecutionContext::Task {
 public:
     static PassOwnPtr<CallCacheListenerTask> create(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone)
diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.h b/WebCore/loader/appcache/ApplicationCacheGroup.h
index 9b68ccc..b5cdf7b 100644
--- a/WebCore/loader/appcache/ApplicationCacheGroup.h
+++ b/WebCore/loader/appcache/ApplicationCacheGroup.h
@@ -100,6 +100,7 @@ private:
     static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, DocumentLoader*);
 
     void scheduleReachedMaxAppCacheSizeCallback();
+    void scheduleReachedOriginQuotaCallback();
 
     PassRefPtr<ResourceHandle> createResourceHandle(const KURL&, ApplicationCacheResource* newestCachedResource);
 
@@ -119,11 +120,13 @@ private:
     void didReceiveManifestData(const char*, int);
     void didFinishLoadingManifest();
     void didReachMaxAppCacheSize();
+    void didReachOriginQuota(PassRefPtr<Frame> frame);
     
     void startLoadingEntry();
     void deliverDelayedMainResources();
     void checkIfLoadIsComplete();
     void cacheUpdateFailed();
+    void cacheUpdateFailedDueToOriginQuota();
     void manifestNotFound();
     
     void addEntry(const String&, unsigned type);
@@ -199,8 +202,10 @@ private:
 
     int64_t m_loadedSize;
     int64_t m_availableSpaceInQuota;
+    bool m_originQuotaReached;
 
     friend class ChromeClientCallbackTimer;
+    friend class OriginQuotaReachedCallbackTimer;
 };
 
 } // namespace WebCore
diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/WebCore/loader/appcache/ApplicationCacheStorage.cpp
index eb72331..ec83911 100644
--- a/WebCore/loader/appcache/ApplicationCacheStorage.cpp
+++ b/WebCore/loader/appcache/ApplicationCacheStorage.cpp
@@ -443,6 +443,30 @@ bool ApplicationCacheStorage::quotaForOrigin(const SecurityOrigin* origin, int64
     return false;
 }
 
+bool ApplicationCacheStorage::usageForOrigin(const SecurityOrigin* origin, int64_t& usage)
+{
+    // If an Origins record doesn't exist, then the SUM will be null,
+    // which will become 0, as expected, when converting to a number.
+    SQLiteStatement statement(m_database, "SELECT SUM(Caches.size)"
+                                          "  FROM CacheGroups"
+                                          " INNER JOIN Origins ON CacheGroups.origin = Origins.origin"
+                                          " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup"
+                                          " WHERE Origins.origin=?");
+    if (statement.prepare() != SQLResultOk)
+        return false;
+
+    statement.bindText(1, origin->databaseIdentifier());
+    int result = statement.step();
+
+    if (result == SQLResultRow) {
+        usage = statement.getColumnInt64(0);
+        return true;
+    }
+
+    LOG_ERROR("Could not get the quota of an origin, error \"%s\"", m_database.lastErrorMsg());
+    return false;
+}
+
 bool ApplicationCacheStorage::remainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize)
 {
     openDatabase(false);
@@ -498,6 +522,9 @@ bool ApplicationCacheStorage::storeUpdatedQuotaForOrigin(const SecurityOrigin* o
     if (!m_database.isOpen())
         return false;
 
+    if (!ensureOriginRecord(origin))
+        return false;
+
     SQLiteStatement updateStatement(m_database, "UPDATE Origins SET quota=? WHERE origin=?");
     if (updateStatement.prepare() != SQLResultOk)
         return false;
@@ -625,26 +652,15 @@ bool ApplicationCacheStorage::store(ApplicationCacheGroup* group, GroupStorageID
     if (statement.prepare() != SQLResultOk)
         return false;
 
-    String originIdentifier = group->origin()->databaseIdentifier();
-
     statement.bindInt64(1, urlHostHash(group->manifestURL()));
     statement.bindText(2, group->manifestURL());
-    statement.bindText(3, originIdentifier);
+    statement.bindText(3, group->origin()->databaseIdentifier());
 
     if (!executeStatement(statement))
         return false;
 
-    // Create Origin if needed.
-    {
-        SQLiteStatement insertOriginStatement(m_database, "INSERT INTO Origins (origin, quota) VALUES (?, ?)");
-        if (insertOriginStatement.prepare() != SQLResultOk)
-            return false;
-
-        insertOriginStatement.bindText(1, originIdentifier);
-        insertOriginStatement.bindInt64(2, m_defaultOriginQuota);
-        if (!executeStatement(insertOriginStatement))
-            return false;
-    }
+    if (!ensureOriginRecord(group->origin()))
+        return false;
 
     group->setStorageID(static_cast<unsigned>(m_database.lastInsertRowID()));
     journal->add(group, 0);
@@ -858,6 +874,20 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, Applicat
     return true;
 }
 
+bool ApplicationCacheStorage::ensureOriginRecord(const SecurityOrigin* origin)
+{
+    SQLiteStatement insertOriginStatement(m_database, "INSERT INTO Origins (origin, quota) VALUES (?, ?)");
+    if (insertOriginStatement.prepare() != SQLResultOk)
+        return false;
+
+    insertOriginStatement.bindText(1, origin->databaseIdentifier());
+    insertOriginStatement.bindInt64(2, m_defaultOriginQuota);
+    if (!executeStatement(insertOriginStatement))
+        return false;
+
+    return true;
+}
+
 bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group, ApplicationCache* oldCache, FailureReason& failureReason)
 {
     openDatabase(true);
diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.h b/WebCore/loader/appcache/ApplicationCacheStorage.h
index ec22800..c990fa7 100644
--- a/WebCore/loader/appcache/ApplicationCacheStorage.h
+++ b/WebCore/loader/appcache/ApplicationCacheStorage.h
@@ -63,6 +63,7 @@ public:
 
     int64_t defaultOriginQuota() const { return m_defaultOriginQuota; }
     void setDefaultOriginQuota(int64_t quota);
+    bool usageForOrigin(const SecurityOrigin*, int64_t& usage);
     bool quotaForOrigin(const SecurityOrigin*, int64_t& quota);
     bool remainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
     bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota);
@@ -105,6 +106,8 @@ private:
     bool store(ApplicationCache*, ResourceStorageIDJournal*);
     bool store(ApplicationCacheResource*, unsigned cacheStorageID);
 
+    bool ensureOriginRecord(const SecurityOrigin*);
+
     void loadManifestHostHashes();
     
     void verifySchemaVersion();
diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h
index 942610f..6f244c2 100644
--- a/WebCore/page/ChromeClient.h
+++ b/WebCore/page/ChromeClient.h
@@ -53,6 +53,7 @@ namespace WebCore {
     class IntRect;
     class Node;
     class Page;
+    class SecurityOrigin;
     class String;
     class Widget;
 
@@ -167,6 +168,13 @@ namespace WebCore {
         // The chrome client would need to take some action such as evicting some
         // old caches.
         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded) = 0;
+
+        // Callback invoked when the application cache origin quota is reached. This
+        // means that the resources attempting to be cached via the manifest are
+        // more than allowed on this origin. This callback allows the chrome client
+        // to take action, such as prompting the user to ask to increase the quota
+        // for this origin.
+        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin* origin) = 0;
 #endif
 
 #if ENABLE(DASHBOARD_SUPPORT)
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 76048df..eda95c6 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebKit.xcodeproj/project.pbxproj:
+        * efl/WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::reachedApplicationCacheOriginQuota):
+        * efl/WebCoreSupport/ChromeClientEfl.h:
+
 2010-07-30  Rafael Antognolli  <antognolli at profusion.mobi>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index 634a430..edffcb9 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -93,9 +93,6 @@
 		441793A60E34EE150055E1AE /* WebHTMLRepresentationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 441793A50E34EE150055E1AE /* WebHTMLRepresentationInternal.h */; };
 		4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; settings = {ATTRIBUTES = (); }; };
 		4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; };
-		51079D170CED11B00077247D /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51079D140CED11B00077247D /* WebSecurityOrigin.mm */; };
-		51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51079D150CED11B00077247D /* WebSecurityOriginInternal.h */; };
-		51079D190CED11B00077247D /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */; };
 		511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */; };
@@ -316,6 +313,13 @@
 		93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */; };
 		93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB178E09F88D510091F8FF /* WebSystemInterface.h */; };
 		93FDE9330D79CAF30074F029 /* WebHistoryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */; };
+		A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */; };
+		A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */; };
+		A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */; };
+		A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */; };
+		A5DEFC1011D5343E00885273 /* WebDatabaseSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */; };
+		A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */; };
+		A5DEFC1411D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */; };
 		A70936AF0B5608DC00CDB48E /* WebDragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A70936AD0B5608DC00CDB48E /* WebDragClient.h */; };
 		A70936B00B5608DC00CDB48E /* WebDragClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A70936AE0B5608DC00CDB48E /* WebDragClient.mm */; };
 		A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */; };
@@ -472,9 +476,6 @@
 		449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
 		4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; };
 		4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; };
-		51079D140CED11B00077247D /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; };
-		51079D150CED11B00077247D /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; };
-		51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; };
 		511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; sourceTree = "<group>"; };
 		511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerPrivate.h; sourceTree = "<group>"; };
 		511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseTrackerClient.h; sourceTree = "<group>"; };
@@ -607,6 +608,13 @@
 		9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferencesPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageRendererFactory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		9CF0E249021361B00ECA16EA /* WebFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFramePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+		A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; };
+		A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; };
+		A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; };
+		A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseSecurityOrigin.h; sourceTree = "<group>"; };
+		A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseSecurityOrigin.mm; sourceTree = "<group>"; };
+		A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheSecurityOrigin.h; sourceTree = "<group>"; };
+		A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCacheSecurityOrigin.mm; sourceTree = "<group>"; };
 		A70936AD0B5608DC00CDB48E /* WebDragClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDragClient.h; sourceTree = "<group>"; };
 		A70936AE0B5608DC00CDB48E /* WebDragClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClient.mm; sourceTree = "<group>"; };
 		A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardHelper.h; sourceTree = "<group>"; };
@@ -1012,11 +1020,10 @@
 				511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
 				51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
 				511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
+				A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */,
+				A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */,
 				511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */,
 				511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */,
-				51079D140CED11B00077247D /* WebSecurityOrigin.mm */,
-				51079D150CED11B00077247D /* WebSecurityOriginInternal.h */,
-				51079D160CED11B00077247D /* WebSecurityOriginPrivate.h */,
 			);
 			name = Storage;
 			path = mac/Storage;
@@ -1231,6 +1238,8 @@
 			children = (
 				B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
 				B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
+				A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */,
+				A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */,
 				51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */,
 				14D8252D0AF955090004F057 /* WebChromeClient.h */,
 				14D8252E0AF955090004F057 /* WebChromeClient.mm */,
@@ -1260,6 +1269,9 @@
 				1AA879B511CBE9BF003C664F /* WebPlatformStrategies.mm */,
 				0A2D87FB107AF52B00CDDEE3 /* WebPluginHalterClient.h */,
 				0A2D87FC107AF52B00CDDEE3 /* WebPluginHalterClient.mm */,
+				A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */,
+				A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */,
+				A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */,
 				93EB178E09F88D510091F8FF /* WebSystemInterface.h */,
 				93EB178C09F88D460091F8FF /* WebSystemInterface.mm */,
 				F5F7174C02885C5B018635CA /* WebViewFactory.h */,
@@ -1535,8 +1547,6 @@
 				C0167BF80D7F5DD00028696E /* WebScriptDebugger.h in Headers */,
 				C0B1F7E810AC8E3100C925D9 /* WebScriptWorld.h in Headers */,
 				C0B1F7EA10AC8E3100C925D9 /* WebScriptWorldInternal.h in Headers */,
-				51079D180CED11B00077247D /* WebSecurityOriginInternal.h in Headers */,
-				51079D190CED11B00077247D /* WebSecurityOriginPrivate.h in Headers */,
 				BC26C69E10B743F400B687ED /* WebSerializedJSValue.h in Headers */,
 				939810270824BF01008DF038 /* WebStringTruncator.h in Headers */,
 				93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */,
@@ -1557,6 +1567,10 @@
 				939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
 				0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */,
 				41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */,
+				A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */,
+				A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */,
+				A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */,
+				A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1899,7 +1913,6 @@
 				7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.mm in Sources */,
 				C0167BF90D7F5DD00028696E /* WebScriptDebugger.mm in Sources */,
 				C0B1F7E910AC8E3100C925D9 /* WebScriptWorld.mm in Sources */,
-				51079D170CED11B00077247D /* WebSecurityOrigin.mm in Sources */,
 				BC26C6A510B7447A00B687ED /* WebSerializedJSValue.mm in Sources */,
 				939810CC0824BF01008DF038 /* WebStringTruncator.mm in Sources */,
 				93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */,
@@ -1916,6 +1929,9 @@
 				939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */,
 				0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */,
 				41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */,
+				A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */,
+				A5DEFC1011D5343E00885273 /* WebDatabaseSecurityOrigin.mm in Sources */,
+				A5DEFC1411D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index d2fdf3c..9451a4f 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::reachedApplicationCacheOriginQuota):
+        * src/ChromeClientImpl.h:
+
 2010-07-30  James Robinson  <jamesr at chromium.org>
 
         Compile fix. Put GLES2 functions behind USE(GLES2_RENDERING) instead of
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 59d54fb..fc08b5d 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -56,6 +56,7 @@
 #include "Page.h"
 #include "PopupMenuChromium.h"
 #include "ScriptController.h"
+#include "SecurityOrigin.h"
 #include "WebGeolocationService.h"
 #if USE(V8)
 #include "V8Proxy.h"
@@ -579,6 +580,11 @@ void ChromeClientImpl::reachedMaxAppCacheSize(int64_t spaceNeeded)
 {
     ASSERT_NOT_REACHED();
 }
+
+void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    ASSERT_NOT_REACHED();
+}
 #endif
 
 void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser)
diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h
index 2500753..fe19b8b 100644
--- a/WebKit/chromium/src/ChromeClientImpl.h
+++ b/WebKit/chromium/src/ChromeClientImpl.h
@@ -118,6 +118,7 @@ public:
         WebCore::Frame*, const WebCore::String& databaseName);
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
 #endif
 #if ENABLE(NOTIFICATIONS)
     virtual WebCore::NotificationPresenter* notificationPresenter() const;
diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
index ffbd642..fa4d37a 100644
--- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
+++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
@@ -47,6 +47,7 @@
 #include "KURL.h"
 #include "NotImplemented.h"
 #include "PlatformString.h"
+#include "SecurityOrigin.h"
 #include "ViewportArguments.h"
 #include "WindowFeatures.h"
 #include "ewk_private.h"
@@ -376,6 +377,11 @@ void ChromeClientEfl::reachedMaxAppCacheSize(int64_t spaceNeeded)
     // FIXME: Free some space.
     notImplemented();
 }
+
+void ChromeClientEfl::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 #if ENABLE(DATABASE)
diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
index ce8abd1..2f3fd3e 100644
--- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
+++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
@@ -111,6 +111,7 @@ public:
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
 #endif
 
     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index bf1777d..67c4365 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::reachedApplicationCacheOriginQuota):
+        * WebCoreSupport/ChromeClientGtk.h:
+
 2010-07-26  Steve Block  <steveblock at google.com>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 88440ba..3eb21f8 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -30,10 +30,11 @@
 #include "FrameLoadRequest.h"
 #include "GtkVersioning.h"
 #include "IntRect.h"
-#include "PlatformString.h"
 #include "HitTestResult.h"
 #include "Icon.h"
 #include "KURL.h"
+#include "PlatformString.h"
+#include "SecurityOrigin.h"
 #include "webkitgeolocationpolicydecision.h"
 #include "webkitwebview.h"
 #include "webkitnetworkrequest.h"
@@ -549,6 +550,11 @@ void ChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded)
     // FIXME: Free some space.
     notImplemented();
 }
+
+void ChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser)
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
index ce5c5a7..16a9f5d 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
@@ -108,6 +108,7 @@ namespace WebKit {
 #endif
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+        virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
 #endif
         virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
         virtual void chooseIconForFiles(const Vector<WebCore::String>&, WebCore::FileChooser*);
diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog
index 841a94c..b624ac7 100644
--- a/WebKit/haiku/ChangeLog
+++ b/WebKit/haiku/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebCoreSupport/ChromeClientHaiku.cpp:
+        (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota):
+        * WebCoreSupport/ChromeClientHaiku.h:
+
 2010-07-16  Zhe Su  <suzhe at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
index d18b84d..c3cdaa0 100644
--- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
+++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
@@ -35,6 +35,7 @@
 #include "Icon.h"
 #include "NotImplemented.h"
 #include "PlatformString.h"
+#include "SecurityOrigin.h"
 
 #include <Alert.h>
 #include <String.h>
@@ -345,6 +346,11 @@ void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded)
 {
     notImplemented();
 }
+
+void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 void ChromeClientHaiku::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
index 963e72f..463d667 100644
--- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
+++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
@@ -130,6 +130,7 @@ namespace WebCore {
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
 #endif
 
         // This is an asynchronous call. The ChromeClient can display UI asking the user for permission
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 13ec1a1..a3fcda6 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -5,6 +5,50 @@
         Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
         https://bugs.webkit.org/show_bug.cgi?id=40627
 
+        Part 4 - Client Notification when the Quota is Reached
+
+        Notify the WebKit client when the per-origin quota is reached
+        via a delegate method reachedApplicationCacheOriginQuota.
+
+          Refactor the WebSecurityOrigin class to be generic enough to
+          allow quota management of both Databases or Application Caches
+          via subclasses.
+
+        * Storage/WebDatabaseSecurityOrigin.h: Added.
+        * Storage/WebDatabaseSecurityOrigin.mm: Added.
+        (-[WebDatabaseSecurityOrigin quota]):
+        (-[WebDatabaseSecurityOrigin setQuota:]):
+        * WebCoreSupport/WebApplicationCacheSecurityOrigin.h: Added.
+        * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: Added.
+        (-[WebApplicationCacheSecurityOrigin quota]):
+        (-[WebApplicationCacheSecurityOrigin setQuota:]):
+        * Storage/WebSecurityOrigin.mm: Removed. (Moved to WebCoreSupport)
+        * Storage/WebSecurityOriginPrivate.h: Removed. (Moved to WebCoreSupport)
+        * WebCoreSupport/WebSecurityOrigin.mm: Added.
+        (-[WebSecurityOrigin usage]): to be implemented by subclasses.
+        (-[WebSecurityOrigin quota]): to be implemented by subclasses.
+        (-[WebSecurityOrigin setQuota:]): to be implemented by subclasses.
+        * WebCoreSupport/WebSecurityOriginInternal.h: Renamed from WebKit/mac/Storage/WebSecurityOriginInternal.h.
+        * WebCoreSupport/WebSecurityOriginPrivate.h: Added.
+
+          Turn the notification into a WebUI Delegate to call. Following
+          the example of Databases.
+
+        * DefaultDelegates/WebDefaultUIDelegate.m:
+        (-[WebDefaultUIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:]):
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::exceededDatabaseQuota): use the Databases Security Origin subclass.
+        (WebChromeClient::reachedApplicationCacheOriginQuota): use the Application Cache Security Origin subclass.
+        * WebView/WebUIDelegatePrivate.h:
+
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
         Part 1 - Add Total and Per-Origin Quota Preferences.
 
         Allow the application cache total size to be a preference, and
diff --git a/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m b/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m
index 68fa05e..a327fd4 100644
--- a/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m
+++ b/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m
@@ -227,6 +227,10 @@ static WebDefaultUIDelegate *sharedDelegate = nil;
 {
 }
 
+- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin
+{
+}
+
 - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename
 {
     return NO;
diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h
new file mode 100644
index 0000000..a06ca3d
--- /dev/null
+++ b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2010 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "WebSecurityOriginInternal.h"
+
+ at interface WebDatabaseSecurityOrigin : WebSecurityOrigin
+ at end
diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm
new file mode 100644
index 0000000..e91a187
--- /dev/null
+++ b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007, 2010 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "WebDatabaseSecurityOrigin.h"
+
+#import <WebCore/DatabaseTracker.h>
+#import <WebCore/SecurityOrigin.h>
+
+using namespace WebCore;
+
+ at implementation WebDatabaseSecurityOrigin
+
+- (long long)usage
+{
+#if ENABLE(DATABASE)
+    return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+#else
+    return 0;
+#endif
+}
+
+- (long long)quota
+{
+#if ENABLE(DATABASE)
+    return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+#else
+    return 0;
+#endif
+}
+
+// If the quota is set to a value lower than the current usage, that quota will
+// "stick" but no data will be purged to meet the new quota. This will simply
+// prevent new data from being added to databases in that origin
+- (void)setQuota:(long long)quota
+{
+#if ENABLE(DATABASE)
+    DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
+#endif
+}
+
+ at end
diff --git a/WebKit/mac/Storage/WebSecurityOrigin.mm b/WebKit/mac/Storage/WebSecurityOrigin.mm
deleted file mode 100644
index 56a21f5..0000000
--- a/WebKit/mac/Storage/WebSecurityOrigin.mm
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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 "WebSecurityOriginInternal.h"
-
-#import <WebCore/DatabaseTracker.h>
-#import <WebCore/KURL.h>
-#import <WebCore/SecurityOrigin.h>
-
-using namespace WebCore;
-
- at implementation WebSecurityOrigin
-- (id)initWithURL:(NSURL *)url
-{
-    self = [super init];
-    if (!self)
-        return nil;
-
-    RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL([url absoluteURL]));
-    origin->ref();
-    _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin.get());
-
-    return self;
-}
-
-- (NSString*)protocol
-{
-    return reinterpret_cast<SecurityOrigin*>(_private)->protocol();
-}
-
-- (NSString*)host
-{
-    return reinterpret_cast<SecurityOrigin*>(_private)->host();
-}
-
-// Deprecated. Use host instead. This needs to stay here until we ship a new Safari.
-- (NSString*)domain
-{
-    return [self host];
-}
-
-- (unsigned short)port
-{
-    return reinterpret_cast<SecurityOrigin*>(_private)->port();
-}
-
-- (unsigned long long)usage
-{
-#if ENABLE(DATABASE)
-    return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
-#else
-    return 0;
-#endif
-}
-
-- (unsigned long long)quota
-{
-#if ENABLE(DATABASE)
-    return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
-#else
-    return 0;
-#endif
-}
-
-// Sets the storage quota (in bytes)
-// If the quota is set to a value lower than the current usage, that quota will "stick" but no data will be purged to meet the new quota.  
-// This will simply prevent new data from being added to databases in that origin
-- (void)setQuota:(unsigned long long)quota
-{
-#if ENABLE(DATABASE)
-    DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
-#endif
-}
-
-- (BOOL)isEqual:(id)anObject
-{
-    if (![anObject isMemberOfClass:[WebSecurityOrigin class]]) {
-        return NO;
-    }
-    
-    return [self _core]->equal([anObject _core]);
-}
-
-- (void)dealloc
-{
-    if (_private)
-        reinterpret_cast<SecurityOrigin*>(_private)->deref();
-    [super dealloc];
-}
-
-- (void)finalize
-{
-    if (_private)
-        reinterpret_cast<SecurityOrigin*>(_private)->deref();
-    [super finalize];
-}
-
- at end
-
- at implementation WebSecurityOrigin (WebInternal)
-
-- (id)_initWithWebCoreSecurityOrigin:(SecurityOrigin*)origin
-{
-    ASSERT(origin);
-    self = [super init];
-    if (!self)
-        return nil;
-
-    origin->ref();
-    _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin);
-
-    return self;
-}
-
-- (SecurityOrigin *)_core
-{
-    return reinterpret_cast<SecurityOrigin*>(_private);
-}
-
- at end
diff --git a/WebKit/mac/Storage/WebSecurityOriginPrivate.h b/WebKit/mac/Storage/WebSecurityOriginPrivate.h
deleted file mode 100644
index c7836f8..0000000
--- a/WebKit/mac/Storage/WebSecurityOriginPrivate.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
- at class WebSecurityOriginPrivate;
-
- at interface WebSecurityOrigin : NSObject {
-    WebSecurityOriginPrivate *_private;
-}
-
-- (id)initWithURL:(NSURL *)url;
-
-- (NSString*)protocol;
-- (NSString*)host;
-
-// Returns zero if the port is the default port for the protocol, non-zero otherwise
-- (unsigned short)port;
-
-// Returns the current total usage of all databases in this security origin in bytes
-- (unsigned long long)usage;
-
-- (unsigned long long)quota;
-// Sets the storage quota (in bytes)
-// If the quota is set to a value lower than the current usage, that quota will "stick" but no data will be purged to meet the new quota.  
-// This will simply prevent new data from being added to databases in that origin
-- (void)setQuota:(unsigned long long)quota;
-
-
- at end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.h b/WebKit/mac/WebCoreSupport/WebApplicationCache.h
index e0fb523..78b06b7 100644
--- a/WebKit/mac/WebCoreSupport/WebApplicationCache.h
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.h
@@ -25,8 +25,7 @@
 
 #import <Foundation/Foundation.h>
 
- at interface WebApplicationCache: NSObject {
-}
+ at interface WebApplicationCache: NSObject
 
 + (long long)maximumSize;
 + (void)setMaximumSize:(long long)size;
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h
new file mode 100644
index 0000000..09c0610
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2010 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "WebSecurityOriginInternal.h"
+
+ at interface WebApplicationCacheSecurityOrigin : WebSecurityOrigin
+ at end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm
new file mode 100644
index 0000000..b72cdcc
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "WebApplicationCacheSecurityOrigin.h"
+
+#import <WebCore/ApplicationCacheStorage.h>
+
+using namespace WebCore;
+
+ at implementation WebApplicationCacheSecurityOrigin
+
+- (long long)usage
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    long long usage;
+    if (cacheStorage().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private), usage))
+        return usage;
+    return 0;
+#else
+    return 0;
+#endif
+}
+
+- (long long)quota
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    long long quota;
+    if (cacheStorage().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota))
+        return quota;
+    return 0;
+#else
+    return 0;
+#endif
+}
+
+- (void)setQuota:(long long)quota
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    cacheStorage().storeUpdatedQuotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota);
+#endif
+}
+
+ at end
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 707d080..f454c60 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -117,6 +117,7 @@ public:
 #endif
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
 #endif
     virtual void populateVisitedLinks();
 
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index eb56240..ac34bc0 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -30,6 +30,8 @@
 #import "WebChromeClient.h"
 
 #import "DOMNodeInternal.h"
+#import "WebApplicationCacheSecurityOrigin.h"
+#import "WebDatabaseSecurityOrigin.h"
 #import "WebDefaultUIDelegate.h"
 #import "WebDelegateImplementationCaching.h"
 #import "WebElementDictionary.h"
@@ -553,7 +555,7 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
+    WebDatabaseSecurityOrigin *webOrigin = [[WebDatabaseSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
     // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
     if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) {
         const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
@@ -571,6 +573,17 @@ void WebChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded)
 {
     // FIXME: Free some space.
 }
+
+void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    WebApplicationCacheSecurityOrigin *webOrigin = [[WebApplicationCacheSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];
+    CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:), webOrigin);
+    [webOrigin release];
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
 #endif
     
 void WebChromeClient::populateVisitedLinks()
diff --git a/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
new file mode 100644
index 0000000..4fbefff
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2007, 2010 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 "WebSecurityOriginInternal.h"
+
+#import <WebCore/KURL.h>
+#import <WebCore/SecurityOrigin.h>
+
+using namespace WebCore;
+
+ at implementation WebSecurityOrigin
+- (id)initWithURL:(NSURL *)url
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL([url absoluteURL]));
+    origin->ref();
+    _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin.get());
+
+    return self;
+}
+
+- (NSString*)protocol
+{
+    return reinterpret_cast<SecurityOrigin*>(_private)->protocol();
+}
+
+- (NSString*)host
+{
+    return reinterpret_cast<SecurityOrigin*>(_private)->host();
+}
+
+// Deprecated. Use host instead. This needs to stay here until we ship a new Safari.
+- (NSString*)domain
+{
+    return [self host];
+}
+
+- (unsigned short)port
+{
+    return reinterpret_cast<SecurityOrigin*>(_private)->port();
+}
+
+// Meant to be implemented in a subclass.
+- (long long)usage
+{
+    return 0;
+}
+
+// Meant to be implemented in a subclass.
+- (long long)quota
+{
+    return 0;
+}
+
+// Meant to be implemented in a subclass.
+- (void)setQuota:(long long)quota
+{
+}
+
+- (BOOL)isEqual:(id)anObject
+{
+    if (![anObject isMemberOfClass:[WebSecurityOrigin class]]) {
+        return NO;
+    }
+    
+    return [self _core]->equal([anObject _core]);
+}
+
+- (void)dealloc
+{
+    if (_private)
+        reinterpret_cast<SecurityOrigin*>(_private)->deref();
+    [super dealloc];
+}
+
+- (void)finalize
+{
+    if (_private)
+        reinterpret_cast<SecurityOrigin*>(_private)->deref();
+    [super finalize];
+}
+
+ at end
+
+ at implementation WebSecurityOrigin (WebInternal)
+
+- (id)_initWithWebCoreSecurityOrigin:(SecurityOrigin*)origin
+{
+    ASSERT(origin);
+    self = [super init];
+    if (!self)
+        return nil;
+
+    origin->ref();
+    _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin);
+
+    return self;
+}
+
+- (SecurityOrigin *)_core
+{
+    return reinterpret_cast<SecurityOrigin*>(_private);
+}
+
+ at end
diff --git a/WebKit/mac/Storage/WebSecurityOriginInternal.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h
similarity index 100%
rename from WebKit/mac/Storage/WebSecurityOriginInternal.h
rename to WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h
diff --git a/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
new file mode 100644
index 0000000..26ee852
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+ at class WebSecurityOriginPrivate;
+
+ at interface WebSecurityOrigin : NSObject {
+    WebSecurityOriginPrivate *_private;
+}
+
+- (id)initWithURL:(NSURL *)url;
+
+- (NSString*)protocol;
+- (NSString*)host;
+
+// Returns zero if the port is the default port for the protocol, non-zero otherwise.
+- (unsigned short)port;
+
+// Meant to be implemented in a subclass.
+// Returns the current total usage of all relevant items in this security origin in bytes.
+- (long long)usage;
+
+// Meant to be implemented in a subclass.
+// Returns the quota of this security origin in bytes.
+- (long long)quota;
+
+// Meant to be implemented in a subclass.
+// Sets the storage quota in bytes.
+- (void)setQuota:(long long)quota;
+
+ at end
diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h
index eccb10f..0fb120c 100644
--- a/WebKit/mac/WebView/WebUIDelegatePrivate.h
+++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -125,6 +125,16 @@ enum {
 */
 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier;
 
+/*!
+    @method webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:
+    @param sender The WebView sending the delegate method.
+    @param origin The security origin that needs a larger quota
+    @discussion This method is called when a page attempts to store more in the Application Cache
+    for an origin than was allowed by the quota (or default) set for the origin. This allows the
+    quota to be increased for the security origin.
+*/
+- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin;
+
 - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features;
 
 - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 858bf29..95fe09d 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota):
+        * WebCoreSupport/ChromeClientQt.h:
+
 2010-07-29  Alexis Menard  <alexis.menard at nokia.com>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 2c64a78..935c006 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -483,6 +483,11 @@ void ChromeClientQt::reachedMaxAppCacheSize(int64_t)
     // FIXME: Free some space.
     notImplemented();
 }
+
+void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 #if ENABLE(NOTIFICATIONS)
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 70b4a25..70bf872 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -131,6 +131,7 @@ namespace WebCore {
 #endif
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
 #endif
 
 #if ENABLE(NOTIFICATIONS)
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 6b81bcc..3606bde 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::reachedApplicationCacheOriginQuota):
+        * WebCoreSupport/WebChromeClient.h:
+
 2010-07-26  Steve Block  <steveblock at google.com>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
index 73532a6..4e15be7 100644
--- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
@@ -55,6 +55,7 @@
 #include <WebCore/LocalizedStrings.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/Page.h>
+#include <WebCore/SecurityOrigin.h>
 #include <WebCore/WindowFeatures.h>
 #pragma warning(pop)
 
@@ -617,6 +618,11 @@ void WebChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded)
     // FIXME: Free some space.
     notImplemented();
 }
+
+void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 void WebChromeClient::populateVisitedLinks()
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h
index e7845a9..7a60fb6 100644
--- a/WebKit/win/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.h
@@ -118,6 +118,7 @@ public:
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
 #endif
 
     virtual void populateVisitedLinks();
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index af7fcd7..5ac20f9 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebKitSupport/ChromeClientWx.cpp:
+        (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota):
+        * WebKitSupport/ChromeClientWx.h:
+
 2010-07-29  Kevin Ollivier  <kevino at theolliviers.com>
 
         [wx] Build fix, add file missing from DOM bindings commit.
diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
index d81a20c..764648c 100644
--- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
@@ -38,6 +38,7 @@
 #include "Icon.h"
 #include "NotImplemented.h"
 #include "PlatformString.h"
+#include "SecurityOrigin.h"
 #include "WindowFeatures.h"
 
 #include <stdio.h>
@@ -429,6 +430,11 @@ void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded)
 {
     notImplemented();
 }
+
+void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&)
diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h
index 4b156ed..52ec0d8 100644
--- a/WebKit/wx/WebKitSupport/ChromeClientWx.h
+++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h
@@ -125,6 +125,7 @@ public:
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
 #endif
 
     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 39e2af0..e8a2637 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-30  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2010-07-30  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index fecc3b5..4def7c5 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -40,6 +40,7 @@
 #include <WebCore/FileChooser.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoader.h>
+#include <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
 
@@ -375,6 +376,11 @@ void WebChromeClient::reachedMaxAppCacheSize(int64_t)
 {
     notImplemented();
 }
+
+void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+    notImplemented();
+}
 #endif
 
 #if ENABLE(DASHBOARD_SUPPORT)
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index dd487b4..d26a4ee 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -123,6 +123,7 @@ private:
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
 #endif
 
 #if ENABLE(DASHBOARD_SUPPORT)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list