Index: content/renderer/pepper_plugin_delegate_impl.cc |
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc |
index 3edf654bca58ac7d8ed2b9047e781d5eb77e7252..0ad05924ac28b305331399e5a5e83fb80c1708c2 100644 |
--- a/content/renderer/pepper_plugin_delegate_impl.cc |
+++ b/content/renderer/pepper_plugin_delegate_impl.cc |
@@ -22,10 +22,12 @@ |
#include "content/common/child_thread.h" |
#include "content/common/content_switches.h" |
#include "content/common/file_system/file_system_dispatcher.h" |
+#include "content/common/file_system_messages.h" |
#include "content/common/media/audio_messages.h" |
#include "content/common/pepper_file_messages.h" |
#include "content/common/pepper_plugin_registry.h" |
#include "content/common/pepper_messages.h" |
+#include "content/common/quota_dispatcher.h" |
#include "content/common/view_messages.h" |
#include "content/renderer/content_renderer_client.h" |
#include "content/renderer/gpu/command_buffer_proxy.h" |
@@ -356,6 +358,23 @@ class DispatcherWrapper |
scoped_ptr<pp::proxy::HostDispatcher> dispatcher_; |
}; |
+class QuotaCallbackTranslator : public QuotaDispatcher::Callback { |
+ public: |
+ typedef webkit::ppapi::PluginDelegate::AvailableSpaceCallback PluginCallback; |
+ explicit QuotaCallbackTranslator(PluginCallback* cb) : callback_(cb) {} |
+ virtual void DidQueryStorageUsageAndQuota(int64 usage, int64 quota) OVERRIDE { |
+ callback_->Run(std::max(static_cast<int64>(0), quota - usage)); |
+ } |
+ virtual void DidGrantStorageQuota(int64 granted_quota) OVERRIDE { |
+ NOTREACHED(); |
+ } |
+ virtual void DidFail(quota::QuotaStatusCode error) OVERRIDE { |
+ callback_->Run(0); |
+ } |
+ private: |
+ scoped_ptr<PluginCallback> callback_; |
+}; |
+ |
} // namespace |
bool DispatcherWrapper::Init( |
@@ -997,6 +1016,21 @@ bool PepperPluginDelegateImpl::ReadDirectory( |
return file_system_dispatcher->ReadDirectory(directory_path, dispatcher); |
} |
+void PepperPluginDelegateImpl::QueryAvailableSpace( |
+ const GURL& origin, quota::StorageType type, |
+ AvailableSpaceCallback* callback) { |
+ ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( |
+ origin, type, new QuotaCallbackTranslator(callback)); |
+} |
+ |
+void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) { |
+ ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path)); |
+} |
+ |
+void PepperPluginDelegateImpl::DidUpdateFile(const GURL& path, int64_t delta) { |
+ ChildThread::current()->Send(new FileSystemHostMsg_DidUpdate(path, delta)); |
+} |
+ |
class AsyncOpenFileSystemURLCallbackTranslator |
: public fileapi::FileSystemCallbackDispatcher { |
public: |