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

Unified Diff: ppapi/proxy/plugin_private_file_system_private_resource.cc

Issue 26803004: PPAPI: Add PluginPrivateFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
Index: ppapi/proxy/plugin_private_file_system_private_resource.cc
diff --git a/ppapi/proxy/plugin_private_file_system_private_resource.cc b/ppapi/proxy/plugin_private_file_system_private_resource.cc
new file mode 100644
index 0000000000000000000000000000000000000000..847d7d31a45a15bd4f2c4a8152e2efaac925ed22
--- /dev/null
+++ b/ppapi/proxy/plugin_private_file_system_private_resource.cc
@@ -0,0 +1,60 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/plugin_private_file_system_private_resource.h"
+
+#include "base/bind.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/proxy/file_system_resource.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+void RunTrackedCallback(scoped_refptr<TrackedCallback> callback,
+ int32_t rc) {
+ callback->Run(rc);
+}
+} // namespace
+
+PluginPrivateFileSystemPrivateResource::PluginPrivateFileSystemPrivateResource(
+ Connection connection, PP_Instance instance)
+ : PluginResource(connection, instance) {
+}
+
+PluginPrivateFileSystemPrivateResource::
+~PluginPrivateFileSystemPrivateResource() {
+}
+
+thunk::PPB_PluginPrivateFileSystem_Private_API*
+PluginPrivateFileSystemPrivateResource::
+AsPPB_PluginPrivateFileSystem_Private_API() {
+ return this;
+}
+
+int32_t PluginPrivateFileSystemPrivateResource::Open(
+ PP_Instance /* unused */,
+ PP_Resource* file_system_resource,
+ scoped_refptr<TrackedCallback> callback) {
+ if (!file_system_resource)
+ return PP_ERROR_BADARGUMENT;
+
+ FileSystemResource* fs = new FileSystemResource(
+ connection(), pp_instance(), PP_FILESYSTEMTYPE_ISOLATED);
+ *file_system_resource = fs->GetReference();
+ if (*file_system_resource == 0)
+ return PP_ERROR_FAILED;
+
+ return fs->OpenPluginPrivateFileSystem(
+ base::Bind(&RunTrackedCallback, callback));
+}
+
+} // namespace proxy
+} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698