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

Unified Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 7633061: Merge 94892 - Pepper quota support (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 4 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 | « content/renderer/pepper_plugin_delegate_impl.h ('k') | ppapi/tests/test_file_io.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper_plugin_delegate_impl.cc
===================================================================
--- content/renderer/pepper_plugin_delegate_impl.cc (revision 96768)
+++ content/renderer/pepper_plugin_delegate_impl.cc (working copy)
@@ -23,10 +23,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"
@@ -357,6 +359,23 @@
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(
@@ -1009,6 +1028,21 @@
(*i)->HandlePolicyUpdate(policy_json);
}
+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:
« no previous file with comments | « content/renderer/pepper_plugin_delegate_impl.h ('k') | ppapi/tests/test_file_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698