From b469e8b4fa943d5e1fca0fc42bb373d49db116d1 Mon Sep 17 00:00:00 2001 From: "kinuko@chromium.org" Date: Tue, 23 Jul 2013 05:25:07 +0000 Subject: [PATCH] Implement WebKit::Platform::queryStorageUsageAndQuota We used to have the same method on RenderViewImpl (WebFrameClient), but are moving the impl to platform layer. (Corresponding Blink API change is: https://src.chromium.org/viewvc/blink?revision=154473&view=revision) BUG=259660 TEST=no behavioral change NOTRY=true Review URL: https://chromiumcodereview.appspot.com/19592004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213043 0039d316-1c4b-4281-b951-d872f2087c98 --- .../renderer_webkitplatformsupport_impl.cc | 14 ++++++++++++++ .../renderer/renderer_webkitplatformsupport_impl.h | 4 ++++ .../worker/worker_webkitplatformsupport_impl.cc | 12 ++++++++++++ content/worker/worker_webkitplatformsupport_impl.h | 4 ++++ 4 files changed, 34 insertions(+) diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index e31e59e8cf09dc..211c567114cbfd 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -18,6 +18,7 @@ #include "content/child/fileapi/webfilesystem_impl.h" #include "content/child/indexed_db/proxy_webidbfactory_impl.h" #include "content/child/npapi/npobject_util.h" +#include "content/child/quota_dispatcher.h" #include "content/child/thread_safe_sender.h" #include "content/child/webblobregistry_impl.h" #include "content/child/webmessageportchannel_impl.h" @@ -65,6 +66,7 @@ #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "url/gurl.h" #include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h" +#include "webkit/common/quota/quota_types.h" #include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkit_glue.h" @@ -1154,4 +1156,16 @@ void RendererWebKitPlatformSupportImpl::cancelVibration() { } #endif // defined(OS_ANDROID) +//------------------------------------------------------------------------------ + +void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( + const WebKit::WebURL& storage_partition, + WebKit::WebStorageQuotaType type, + WebKit::WebStorageQuotaCallbacks* callbacks) { + ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( + storage_partition, + static_cast(type), + QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); +} + } // namespace content diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index 9acaad4d264c0a..6e4c3d065d5319 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -141,6 +141,10 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl virtual void setDeviceMotionListener( WebKit::WebDeviceMotionListener* listener) OVERRIDE; virtual WebKit::WebCrypto* crypto() OVERRIDE; + virtual void queryStorageUsageAndQuota( + const WebKit::WebURL& storage_partition, + WebKit::WebStorageQuotaType, + WebKit::WebStorageQuotaCallbacks*) OVERRIDE; #if defined(OS_ANDROID) virtual void vibrate(unsigned int milliseconds); diff --git a/content/worker/worker_webkitplatformsupport_impl.cc b/content/worker/worker_webkitplatformsupport_impl.cc index d290fe5e6853d8..9832a42c9b1c8b 100644 --- a/content/worker/worker_webkitplatformsupport_impl.cc +++ b/content/worker/worker_webkitplatformsupport_impl.cc @@ -12,6 +12,7 @@ #include "content/child/database_util.h" #include "content/child/fileapi/webfilesystem_impl.h" #include "content/child/indexed_db/proxy_webidbfactory_impl.h" +#include "content/child/quota_dispatcher.h" #include "content/child/thread_safe_sender.h" #include "content/child/webblobregistry_impl.h" #include "content/child/webmessageportchannel_impl.h" @@ -24,6 +25,7 @@ #include "third_party/WebKit/public/platform/WebFileInfo.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" +#include "webkit/common/quota/quota_types.h" #include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkit_glue.h" @@ -296,4 +298,14 @@ WebBlobRegistry* WorkerWebKitPlatformSupportImpl::blobRegistry() { return blob_registry_.get(); } +void WorkerWebKitPlatformSupportImpl::queryStorageUsageAndQuota( + const WebKit::WebURL& storage_partition, + WebKit::WebStorageQuotaType type, + WebKit::WebStorageQuotaCallbacks* callbacks) { + ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( + storage_partition, + static_cast(type), + QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); +} + } // namespace content diff --git a/content/worker/worker_webkitplatformsupport_impl.h b/content/worker/worker_webkitplatformsupport_impl.h index aa193a14b2d23c..b923ba39e0e466 100644 --- a/content/worker/worker_webkitplatformsupport_impl.h +++ b/content/worker/worker_webkitplatformsupport_impl.h @@ -99,6 +99,10 @@ class WorkerWebKitPlatformSupportImpl : public WebKitPlatformSupportImpl, virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); virtual WebKit::WebString preferredExtensionForMIMEType( const WebKit::WebString&); + virtual void queryStorageUsageAndQuota( + const WebKit::WebURL& storage_partition, + WebKit::WebStorageQuotaType, + WebKit::WebStorageQuotaCallbacks*) OVERRIDE; private: