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 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 base::PlatformFile base_file; | 245 base::PlatformFile base_file; |
246 base::PlatformFileError result = instance->delegate()->OpenFile( | 246 base::PlatformFileError result = instance->delegate()->OpenFile( |
247 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), | 247 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), |
248 flags, | 248 flags, |
249 &base_file); | 249 &base_file); |
250 *file = base_file; | 250 *file = base_file; |
251 return PlatformFileErrorToPepperError(result); | 251 return PlatformFileErrorToPepperError(result); |
252 } | 252 } |
253 | 253 |
254 int32_t RenameFileRefFile(PP_Resource from_file_ref_id, | |
255 PP_Resource to_file_ref_id) { | |
256 // If it proves necessary, it's easy enough to implement. | |
257 NOTIMPLEMENTED(); | |
258 return PP_ERROR_FAILED; | |
259 } | |
260 | |
261 int32_t DeleteFileRefFileOrDir(PP_Resource file_ref_id, | |
262 PP_Bool recursive) { | |
263 // If it proves necessary, it's easy enough to implement. | |
264 NOTIMPLEMENTED(); | |
265 return PP_ERROR_FAILED; | |
266 } | |
267 | |
268 int32_t CreateFileRefDir(PP_Resource file_ref_id) { | |
269 // If it proves necessary, it's easy enough to implement. | |
270 NOTIMPLEMENTED(); | |
271 return PP_ERROR_FAILED; | |
272 } | |
273 | |
274 int32_t QueryFileRefFile(PP_Resource file_ref_id, | 254 int32_t QueryFileRefFile(PP_Resource file_ref_id, |
275 PP_FileInfo_Dev* info) { | 255 PP_FileInfo_Dev* info) { |
276 scoped_refptr<PPB_FileRef_Impl> file_ref( | 256 scoped_refptr<PPB_FileRef_Impl> file_ref( |
277 Resource::GetAs<PPB_FileRef_Impl>(file_ref_id)); | 257 Resource::GetAs<PPB_FileRef_Impl>(file_ref_id)); |
278 if (!file_ref) | 258 if (!file_ref) |
279 return PP_ERROR_BADRESOURCE; | 259 return PP_ERROR_BADRESOURCE; |
280 | 260 |
281 PluginInstance* instance = file_ref->instance(); | 261 PluginInstance* instance = file_ref->instance(); |
282 if (!instance) | 262 if (!instance) |
283 return PP_ERROR_FAILED; | 263 return PP_ERROR_FAILED; |
284 | 264 |
285 base::PlatformFileInfo file_info; | 265 base::PlatformFileInfo file_info; |
286 base::PlatformFileError result = instance->delegate()->QueryFile( | 266 base::PlatformFileError result = instance->delegate()->QueryFile( |
287 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), | 267 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), |
288 &file_info); | 268 &file_info); |
289 if (result == base::PLATFORM_FILE_OK) { | 269 if (result == base::PLATFORM_FILE_OK) { |
290 info->size = file_info.size; | 270 info->size = file_info.size; |
291 info->creation_time = file_info.creation_time.ToDoubleT(); | 271 info->creation_time = file_info.creation_time.ToDoubleT(); |
292 info->last_access_time = file_info.last_accessed.ToDoubleT(); | 272 info->last_access_time = file_info.last_accessed.ToDoubleT(); |
293 info->last_modified_time = file_info.last_modified.ToDoubleT(); | 273 info->last_modified_time = file_info.last_modified.ToDoubleT(); |
294 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; | 274 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; |
295 if (file_info.is_directory) | 275 if (file_info.is_directory) |
296 info->type = PP_FILETYPE_DIRECTORY; | 276 info->type = PP_FILETYPE_DIRECTORY; |
297 else | 277 else |
298 info->type = PP_FILETYPE_REGULAR; | 278 info->type = PP_FILETYPE_REGULAR; |
299 } | 279 } |
300 return PlatformFileErrorToPepperError(result); | 280 return PlatformFileErrorToPepperError(result); |
301 } | 281 } |
302 | 282 |
303 int32_t GetFileRefDirContents(PP_Resource file_ref_id, | |
304 PP_DirContents_Dev** contents) { | |
305 // If it proves necessary, it's easy enough to implement. | |
306 NOTIMPLEMENTED(); | |
307 return PP_ERROR_FAILED; | |
308 } | |
309 | |
310 const PPB_Flash_File_FileRef ppb_flash_file_fileref = { | 283 const PPB_Flash_File_FileRef ppb_flash_file_fileref = { |
311 &OpenFileRefFile, | 284 &OpenFileRefFile, |
312 &RenameFileRefFile, | |
313 &DeleteFileRefFileOrDir, | |
314 &CreateFileRefDir, | |
315 &QueryFileRefFile, | 285 &QueryFileRefFile, |
316 &GetFileRefDirContents, | |
317 &FreeDirContents, | |
318 }; | 286 }; |
319 | 287 |
320 } // namespace | 288 } // namespace |
321 | 289 |
322 // static | 290 // static |
323 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() { | 291 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() { |
324 return &ppb_flash_file_fileref; | 292 return &ppb_flash_file_fileref; |
325 } | 293 } |
326 | 294 |
327 } // namespace ppapi | 295 } // namespace ppapi |
328 } // namespace webkit | 296 } // namespace webkit |
OLD | NEW |