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

Side by Side 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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/proxy/plugin_private_file_system_private_resource.h"
6
7 #include "base/bind.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/pp_file_info.h"
10 #include "ppapi/proxy/file_system_resource.h"
11 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/proxy/resource_message_params.h"
13 #include "ppapi/shared_impl/host_resource.h"
14 #include "ppapi/shared_impl/tracked_callback.h"
15 #include "ppapi/thunk/enter.h"
16
17 namespace ppapi {
18 namespace proxy {
19
20 namespace {
21 void RunTrackedCallback(scoped_refptr<TrackedCallback> callback,
22 int32_t rc) {
23 callback->Run(rc);
24 }
25 } // namespace
26
27 PluginPrivateFileSystemPrivateResource::PluginPrivateFileSystemPrivateResource(
28 Connection connection, PP_Instance instance)
29 : PluginResource(connection, instance) {
30 }
31
32 PluginPrivateFileSystemPrivateResource::
33 ~PluginPrivateFileSystemPrivateResource() {
34 }
35
36 thunk::PPB_PluginPrivateFileSystem_Private_API*
37 PluginPrivateFileSystemPrivateResource::
38 AsPPB_PluginPrivateFileSystem_Private_API() {
39 return this;
40 }
41
42 int32_t PluginPrivateFileSystemPrivateResource::Open(
43 PP_Instance /* unused */,
44 PP_Resource* file_system_resource,
45 scoped_refptr<TrackedCallback> callback) {
46 if (!file_system_resource)
47 return PP_ERROR_BADARGUMENT;
48
49 FileSystemResource* fs = new FileSystemResource(
50 connection(), pp_instance(), PP_FILESYSTEMTYPE_ISOLATED);
51 *file_system_resource = fs->GetReference();
52 if (*file_system_resource == 0)
53 return PP_ERROR_FAILED;
54
55 return fs->OpenPluginPrivateFileSystem(
56 base::Bind(&RunTrackedCallback, callback));
57 }
58
59 } // namespace proxy
60 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698