OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_flash_file_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_flash_file_impl.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "ppapi/c/dev/pp_file_info_dev.h" | 11 #include "ppapi/c/pp_file_info.h" |
12 #include "ppapi/c/dev/ppb_file_io_dev.h" | 12 #include "ppapi/c/ppb_file_io.h" |
13 #include "ppapi/c/private/ppb_flash_file.h" | 13 #include "ppapi/c/private/ppb_flash_file.h" |
14 #include "ppapi/thunk/enter.h" | 14 #include "ppapi/thunk/enter.h" |
15 #include "webkit/plugins/ppapi/common.h" | 15 #include "webkit/plugins/ppapi/common.h" |
16 #include "webkit/plugins/ppapi/file_path.h" | 16 #include "webkit/plugins/ppapi/file_path.h" |
17 #include "webkit/plugins/ppapi/file_type_conversions.h" | 17 #include "webkit/plugins/ppapi/file_type_conversions.h" |
18 #include "webkit/plugins/ppapi/plugin_delegate.h" | 18 #include "webkit/plugins/ppapi/plugin_delegate.h" |
19 #include "webkit/plugins/ppapi/plugin_module.h" | 19 #include "webkit/plugins/ppapi/plugin_module.h" |
20 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 20 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
21 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | 21 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
22 #include "webkit/plugins/ppapi/resource_tracker.h" | 22 #include "webkit/plugins/ppapi/resource_tracker.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (!instance) | 116 if (!instance) |
117 return PP_ERROR_FAILED; | 117 return PP_ERROR_FAILED; |
118 | 118 |
119 base::PlatformFileError result = instance->delegate()->CreateDir( | 119 base::PlatformFileError result = instance->delegate()->CreateDir( |
120 PepperFilePath::MakeModuleLocal(instance->module(), path)); | 120 PepperFilePath::MakeModuleLocal(instance->module(), path)); |
121 return PlatformFileErrorToPepperError(result); | 121 return PlatformFileErrorToPepperError(result); |
122 } | 122 } |
123 | 123 |
124 int32_t QueryModuleLocalFile(PP_Instance pp_instance, | 124 int32_t QueryModuleLocalFile(PP_Instance pp_instance, |
125 const char* path, | 125 const char* path, |
126 PP_FileInfo_Dev* info) { | 126 PP_FileInfo* info) { |
127 if (!path || !info) | 127 if (!path || !info) |
128 return PP_ERROR_BADARGUMENT; | 128 return PP_ERROR_BADARGUMENT; |
129 | 129 |
130 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 130 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
131 if (!instance) | 131 if (!instance) |
132 return PP_ERROR_FAILED; | 132 return PP_ERROR_FAILED; |
133 | 133 |
134 base::PlatformFileInfo file_info; | 134 base::PlatformFileInfo file_info; |
135 base::PlatformFileError result = instance->delegate()->QueryFile( | 135 base::PlatformFileError result = instance->delegate()->QueryFile( |
136 PepperFilePath::MakeModuleLocal(instance->module(), path), | 136 PepperFilePath::MakeModuleLocal(instance->module(), path), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 base::PlatformFile base_file; | 230 base::PlatformFile base_file; |
231 base::PlatformFileError result = instance->delegate()->OpenFile( | 231 base::PlatformFileError result = instance->delegate()->OpenFile( |
232 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), | 232 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), |
233 flags, | 233 flags, |
234 &base_file); | 234 &base_file); |
235 *file = base_file; | 235 *file = base_file; |
236 return PlatformFileErrorToPepperError(result); | 236 return PlatformFileErrorToPepperError(result); |
237 } | 237 } |
238 | 238 |
239 int32_t QueryFileRefFile(PP_Resource file_ref_id, | 239 int32_t QueryFileRefFile(PP_Resource file_ref_id, |
240 PP_FileInfo_Dev* info) { | 240 PP_FileInfo* info) { |
241 EnterResource<PPB_FileRef_API> enter(file_ref_id, true); | 241 EnterResource<PPB_FileRef_API> enter(file_ref_id, true); |
242 if (enter.failed()) | 242 if (enter.failed()) |
243 return PP_ERROR_BADRESOURCE; | 243 return PP_ERROR_BADRESOURCE; |
244 PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object()); | 244 PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object()); |
245 | 245 |
246 PluginInstance* instance = file_ref->instance(); | 246 PluginInstance* instance = file_ref->instance(); |
247 if (!instance) | 247 if (!instance) |
248 return PP_ERROR_FAILED; | 248 return PP_ERROR_FAILED; |
249 | 249 |
250 base::PlatformFileInfo file_info; | 250 base::PlatformFileInfo file_info; |
(...skipping 21 matching lines...) Expand all Loading... |
272 | 272 |
273 } // namespace | 273 } // namespace |
274 | 274 |
275 // static | 275 // static |
276 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() { | 276 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() { |
277 return &ppb_flash_file_fileref; | 277 return &ppb_flash_file_fileref; |
278 } | 278 } |
279 | 279 |
280 } // namespace ppapi | 280 } // namespace ppapi |
281 } // namespace webkit | 281 } // namespace webkit |
OLD | NEW |