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_api.h"
9 #include "ppapi/thunk/ppb_instance_api.h"
10 #include "ppapi/thunk/thunk.h"
17 bool CreateThreadAdapterForInstance(PP_Instance instance
) {
18 EnterInstance
enter(instance
);
21 return enter
.functions()->GetFlashAPI()->CreateThreadAdapterForInstance(
25 void ClearThreadAdapterForInstance(PP_Instance instance
) {
26 EnterInstance
enter(instance
);
27 if (enter
.succeeded()) {
28 return enter
.functions()->GetFlashAPI()->ClearThreadAdapterForInstance(
33 int32_t OpenFile(PP_Instance instance
,
36 PP_FileHandle
* file
) {
37 EnterInstance
enter(instance
);
39 return PP_ERROR_BADARGUMENT
;
40 return enter
.functions()->GetFlashAPI()->OpenFile(instance
, path
, mode
, file
);
43 int32_t RenameFile(PP_Instance instance
,
44 const char* path_from
,
45 const char* path_to
) {
46 EnterInstance
enter(instance
);
48 return PP_ERROR_BADARGUMENT
;
49 return enter
.functions()->GetFlashAPI()->RenameFile(instance
,
53 int32_t DeleteFileOrDir(PP_Instance instance
,
56 EnterInstance
enter(instance
);
58 return PP_ERROR_BADARGUMENT
;
59 return enter
.functions()->GetFlashAPI()->DeleteFileOrDir(instance
, path
,
63 int32_t CreateDir(PP_Instance instance
, const char* path
) {
64 EnterInstance
enter(instance
);
66 return PP_ERROR_BADARGUMENT
;
67 return enter
.functions()->GetFlashAPI()->CreateDir(instance
, path
);
70 int32_t QueryFile(PP_Instance instance
, const char* path
, PP_FileInfo
* info
) {
71 EnterInstance
enter(instance
);
73 return PP_ERROR_BADARGUMENT
;
74 return enter
.functions()->GetFlashAPI()->QueryFile(instance
, path
, info
);
77 int32_t GetDirContents(PP_Instance instance
,
79 PP_DirContents_Dev
** contents
) {
80 EnterInstance
enter(instance
);
82 return PP_ERROR_BADARGUMENT
;
83 return enter
.functions()->GetFlashAPI()->GetDirContents(instance
, path
,
87 void FreeDirContents(PP_Instance instance
,
88 PP_DirContents_Dev
* contents
) {
89 EnterInstance
enter(instance
);
90 if (enter
.succeeded())
91 enter
.functions()->GetFlashAPI()->FreeDirContents(instance
, contents
);
94 int32_t CreateTemporaryFile(PP_Instance instance
, PP_FileHandle
* file
) {
95 EnterInstance
enter(instance
);
97 return PP_ERROR_BADARGUMENT
;
99 *file
= PP_kInvalidFileHandle
;
100 return enter
.functions()->GetFlashAPI()->CreateTemporaryFile(instance
, file
);
103 const PPB_Flash_File_ModuleLocal_2_0 g_ppb_flash_file_modulelocal_thunk_2_0
= {
104 &CreateThreadAdapterForInstance
,
105 &ClearThreadAdapterForInstance
,
115 const PPB_Flash_File_ModuleLocal_3_0 g_ppb_flash_file_modulelocal_thunk_3_0
= {
116 &CreateThreadAdapterForInstance
,
117 &ClearThreadAdapterForInstance
,
130 const PPB_Flash_File_ModuleLocal_2_0
*
131 GetPPB_Flash_File_ModuleLocal_2_0_Thunk() {
132 return &g_ppb_flash_file_modulelocal_thunk_2_0
;
135 const PPB_Flash_File_ModuleLocal_3_0
*
136 GetPPB_Flash_File_ModuleLocal_3_0_Thunk() {
137 return &g_ppb_flash_file_modulelocal_thunk_3_0
;