Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Unified Diff: Source/modules/quota/StorageQuota.cpp

Issue 20262003: Use Platform::queryUsageAndQuota and deprecate WebFrameClient::queryUsageAndQuota (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/quota/WebStorageQuotaCallbacksImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/quota/StorageQuota.cpp
diff --git a/Source/modules/quota/StorageQuota.cpp b/Source/modules/quota/StorageQuota.cpp
index 37b12e3d97a070d611a64559cf49c5d53d62cfca..3b836fd530035a0a9eca586c10796ffbf7335646 100644
--- a/Source/modules/quota/StorageQuota.cpp
+++ b/Source/modules/quota/StorageQuota.cpp
@@ -29,9 +29,19 @@
*/
#include "config.h"
-
#include "modules/quota/StorageQuota.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/dom/ScriptExecutionContext.h"
+#include "modules/quota/StorageErrorCallback.h"
+#include "modules/quota/StorageUsageCallback.h"
+#include "modules/quota/WebStorageQuotaCallbacksImpl.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebStorageQuotaCallbacks.h"
+#include "public/platform/WebStorageQuotaType.h"
+#include "weborigin/KURL.h"
+#include "weborigin/SecurityOrigin.h"
+
namespace WebCore {
StorageQuota::StorageQuota(Type type)
@@ -40,6 +50,27 @@ StorageQuota::StorageQuota(Type type)
ScriptWrappable::init(this);
}
+void StorageQuota::queryUsageAndQuota(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<StorageUsageCallback> successCallback, PassRefPtr<StorageErrorCallback> errorCallback)
+{
+ ASSERT(scriptExecutionContext);
+
+ WebKit::WebStorageQuotaType storageType = static_cast<WebKit::WebStorageQuotaType>(m_type);
+ if (storageType != WebKit::WebStorageQuotaTypeTemporary && storageType != WebKit::WebStorageQuotaTypePersistent) {
+ // Unknown storage type is requested.
+ scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError));
+ return;
+ }
+
+ SecurityOrigin* securityOrigin = scriptExecutionContext->securityOrigin();
+ if (securityOrigin->isUnique()) {
+ scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError));
+ return;
+ }
+
+ KURL storagePartition = KURL(KURL(), securityOrigin->toString());
+ WebKit::Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType, WebStorageQuotaCallbacksImpl::createLeakedPtr(successCallback, errorCallback));
+}
+
StorageQuota::~StorageQuota()
{
}
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/quota/WebStorageQuotaCallbacksImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698