OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/c/private/ppb_flash_file.h" | 6 #include "ppapi/c/private/ppb_flash_file.h" |
7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/ppb_flash_file_api.h" | 8 #include "ppapi/thunk/ppb_flash_file_api.h" |
9 #include "ppapi/thunk/thunk.h" | 9 #include "ppapi/thunk/thunk.h" |
10 | 10 |
11 namespace ppapi { | 11 namespace ppapi { |
12 namespace thunk { | 12 namespace thunk { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 bool CreateThreadAdapterForInstance(PP_Instance instance) { | 16 bool CreateThreadAdapterForInstance(PP_Instance instance) { return true; } |
17 return true; | |
18 } | |
19 | 17 |
20 void ClearThreadAdapterForInstance(PP_Instance instance) { | 18 void ClearThreadAdapterForInstance(PP_Instance instance) {} |
21 } | |
22 | 19 |
23 int32_t OpenFile(PP_Instance instance, | 20 int32_t OpenFile(PP_Instance instance, |
24 const char* path, | 21 const char* path, |
25 int32_t mode, | 22 int32_t mode, |
26 PP_FileHandle* file) { | 23 PP_FileHandle* file) { |
27 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); | 24 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); |
28 if (enter.failed()) | 25 if (enter.failed()) |
29 return PP_ERROR_BADARGUMENT; | 26 return PP_ERROR_BADARGUMENT; |
30 return enter.functions()->OpenFile(instance, path, mode, file); | 27 return enter.functions()->OpenFile(instance, path, mode, file); |
31 } | 28 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 61 |
65 int32_t GetDirContents(PP_Instance instance, | 62 int32_t GetDirContents(PP_Instance instance, |
66 const char* path, | 63 const char* path, |
67 PP_DirContents_Dev** contents) { | 64 PP_DirContents_Dev** contents) { |
68 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); | 65 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); |
69 if (enter.failed()) | 66 if (enter.failed()) |
70 return PP_ERROR_BADARGUMENT; | 67 return PP_ERROR_BADARGUMENT; |
71 return enter.functions()->GetDirContents(instance, path, contents); | 68 return enter.functions()->GetDirContents(instance, path, contents); |
72 } | 69 } |
73 | 70 |
74 void FreeDirContents(PP_Instance instance, | 71 void FreeDirContents(PP_Instance instance, PP_DirContents_Dev* contents) { |
75 PP_DirContents_Dev* contents) { | |
76 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); | 72 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); |
77 if (enter.succeeded()) | 73 if (enter.succeeded()) |
78 enter.functions()->FreeDirContents(instance, contents); | 74 enter.functions()->FreeDirContents(instance, contents); |
79 } | 75 } |
80 | 76 |
81 int32_t CreateTemporaryFile(PP_Instance instance, PP_FileHandle* file) { | 77 int32_t CreateTemporaryFile(PP_Instance instance, PP_FileHandle* file) { |
82 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); | 78 EnterInstanceAPI<PPB_Flash_File_API> enter(instance); |
83 if (enter.failed()) | 79 if (enter.failed()) |
84 return PP_ERROR_BADARGUMENT; | 80 return PP_ERROR_BADARGUMENT; |
85 | 81 |
86 *file = PP_kInvalidFileHandle; | 82 *file = PP_kInvalidFileHandle; |
87 return enter.functions()->CreateTemporaryFile(instance, file); | 83 return enter.functions()->CreateTemporaryFile(instance, file); |
88 } | 84 } |
89 | 85 |
90 const PPB_Flash_File_ModuleLocal_3_0 g_ppb_flash_file_modulelocal_thunk_3_0 = { | 86 const PPB_Flash_File_ModuleLocal_3_0 g_ppb_flash_file_modulelocal_thunk_3_0 = { |
91 &CreateThreadAdapterForInstance, | 87 &CreateThreadAdapterForInstance, &ClearThreadAdapterForInstance, |
92 &ClearThreadAdapterForInstance, | 88 &OpenFile, &RenameFile, |
93 &OpenFile, | 89 &DeleteFileOrDir, &CreateDir, |
94 &RenameFile, | 90 &QueryFile, &GetDirContents, |
95 &DeleteFileOrDir, | 91 &FreeDirContents, &CreateTemporaryFile}; |
96 &CreateDir, | |
97 &QueryFile, | |
98 &GetDirContents, | |
99 &FreeDirContents, | |
100 &CreateTemporaryFile | |
101 }; | |
102 | 92 |
103 } // namespace | 93 } // namespace |
104 | 94 |
105 const PPB_Flash_File_ModuleLocal_3_0* | 95 const PPB_Flash_File_ModuleLocal_3_0* |
106 GetPPB_Flash_File_ModuleLocal_3_0_Thunk() { | 96 GetPPB_Flash_File_ModuleLocal_3_0_Thunk() { |
107 return &g_ppb_flash_file_modulelocal_thunk_3_0; | 97 return &g_ppb_flash_file_modulelocal_thunk_3_0; |
108 } | 98 } |
109 | 99 |
110 } // namespace thunk | 100 } // namespace thunk |
111 } // namespace ppapi | 101 } // namespace ppapi |
OLD | NEW |