1 // Copyright (c) 2012 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/c/pp_errors.h"
6 #include "ppapi/c/private/ppb_flash_file.h"
7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/ppb_flash_file_api.h"
9 #include "ppapi/thunk/thunk.h"
16 bool CreateThreadAdapterForInstance(PP_Instance instance
) {
20 void ClearThreadAdapterForInstance(PP_Instance instance
) {
23 int32_t OpenFile(PP_Instance instance
,
26 PP_FileHandle
* file
) {
27 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
29 return PP_ERROR_BADARGUMENT
;
30 return enter
.functions()->OpenFile(instance
, path
, mode
, file
);
33 int32_t RenameFile(PP_Instance instance
,
34 const char* path_from
,
35 const char* path_to
) {
36 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
38 return PP_ERROR_BADARGUMENT
;
39 return enter
.functions()->RenameFile(instance
, path_from
, path_to
);
42 int32_t DeleteFileOrDir(PP_Instance instance
,
45 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
47 return PP_ERROR_BADARGUMENT
;
48 return enter
.functions()->DeleteFileOrDir(instance
, path
, recursive
);
51 int32_t CreateDir(PP_Instance instance
, const char* path
) {
52 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
54 return PP_ERROR_BADARGUMENT
;
55 return enter
.functions()->CreateDir(instance
, path
);
58 int32_t QueryFile(PP_Instance instance
, const char* path
, PP_FileInfo
* info
) {
59 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
61 return PP_ERROR_BADARGUMENT
;
62 return enter
.functions()->QueryFile(instance
, path
, info
);
65 int32_t GetDirContents(PP_Instance instance
,
67 PP_DirContents_Dev
** contents
) {
68 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
70 return PP_ERROR_BADARGUMENT
;
71 return enter
.functions()->GetDirContents(instance
, path
, contents
);
74 void FreeDirContents(PP_Instance instance
,
75 PP_DirContents_Dev
* contents
) {
76 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
77 if (enter
.succeeded())
78 enter
.functions()->FreeDirContents(instance
, contents
);
81 int32_t CreateTemporaryFile(PP_Instance instance
, PP_FileHandle
* file
) {
82 EnterInstanceAPI
<PPB_Flash_File_API
> enter(instance
);
84 return PP_ERROR_BADARGUMENT
;
86 *file
= PP_kInvalidFileHandle
;
87 return enter
.functions()->CreateTemporaryFile(instance
, file
);
90 const PPB_Flash_File_ModuleLocal_3_0 g_ppb_flash_file_modulelocal_thunk_3_0
= {
91 &CreateThreadAdapterForInstance
,
92 &ClearThreadAdapterForInstance
,
105 const PPB_Flash_File_ModuleLocal_3_0
*
106 GetPPB_Flash_File_ModuleLocal_3_0_Thunk() {
107 return &g_ppb_flash_file_modulelocal_thunk_3_0
;