1 // Copyright (c) 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.
5 #include "ppapi/proxy/file_system_resource.h"
8 #include "ipc/ipc_message.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/shared_impl/tracked_callback.h"
13 using ppapi::thunk::PPB_FileSystem_API
;
18 FileSystemResource::FileSystemResource(Connection connection
,
20 PP_FileSystemType type
)
21 : PluginResource(connection
, instance
),
24 DCHECK(type_
!= PP_FILESYSTEMTYPE_INVALID
);
25 SendCreate(RENDERER
, PpapiHostMsg_FileSystem_Create(type_
));
28 FileSystemResource::~FileSystemResource() {
31 PPB_FileSystem_API
* FileSystemResource::AsPPB_FileSystem_API() {
35 int32_t FileSystemResource::Open(int64_t expected_size
,
36 scoped_refptr
<TrackedCallback
> callback
) {
38 return PP_ERROR_FAILED
;
41 Call
<PpapiPluginMsg_FileSystem_OpenReply
>(RENDERER
,
42 PpapiHostMsg_FileSystem_Open(expected_size
),
43 base::Bind(&FileSystemResource::OpenComplete
,
46 return PP_OK_COMPLETIONPENDING
;
49 PP_FileSystemType
FileSystemResource::GetType() {
53 void FileSystemResource::InitIsolatedFileSystem(const char* fsid
) {
55 PpapiHostMsg_FileSystem_InitIsolatedFileSystem(std::string(fsid
)));
58 void FileSystemResource::OpenComplete(
59 scoped_refptr
<TrackedCallback
> callback
,
60 const ResourceMessageReplyParams
& params
) {
61 callback
->Run(params
.result());