| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef PPAPI_CPP_PRIVATE_FLASH_FILE_H_ |
| 6 #define PPAPI_CPP_PRIVATE_FLASH_FILE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "ppapi/c/private/ppb_flash_file.h" |
| 12 |
| 13 namespace pp { |
| 14 |
| 15 class FileRef; |
| 16 class InstanceHandle; |
| 17 |
| 18 namespace flash { |
| 19 |
| 20 // FileModuleLocal ------------------------------------------------------------- |
| 21 |
| 22 class FileModuleLocal { |
| 23 public: |
| 24 // Returns true if the required interface is available. |
| 25 static bool IsAvailable(); |
| 26 |
| 27 static bool CreateThreadAdapterForInstance(const InstanceHandle& instance); |
| 28 static void ClearThreadAdapterForInstance(const InstanceHandle& instance); |
| 29 |
| 30 // Returns |PP_kInvalidFileHandle| on error. |
| 31 static PP_FileHandle OpenFile(const InstanceHandle& instance, |
| 32 const std::string& path, |
| 33 int32_t mode); |
| 34 static bool RenameFile(const InstanceHandle& instance, |
| 35 const std::string& path_from, |
| 36 const std::string& path_to); |
| 37 static bool DeleteFileOrDir(const InstanceHandle& instance, |
| 38 const std::string& path, |
| 39 bool recursive); |
| 40 static bool CreateDir(const InstanceHandle& instance, |
| 41 const std::string& path); |
| 42 static bool QueryFile(const InstanceHandle& instance, |
| 43 const std::string& path, |
| 44 PP_FileInfo* info); |
| 45 // Note that, unlike the C interface, no |FreeDirContents()| is needed. |
| 46 static bool GetDirContents(const InstanceHandle& instance, |
| 47 const std::string& path, |
| 48 std::vector<PP_DirEntry_Dev>* dir_contents); |
| 49 |
| 50 // Returns true if |CreateTemporaryFile()| is supported. |
| 51 // TODO(viettrungluu): Remove this sometime after M21 ships to Stable? |
| 52 static bool IsCreateTemporaryFileAvailable(); |
| 53 // Returns |PP_kInvalidFileHandle| on error. |
| 54 static PP_FileHandle CreateTemporaryFile(const InstanceHandle& instance); |
| 55 }; |
| 56 |
| 57 // FileFileRef ----------------------------------------------------------------- |
| 58 |
| 59 class FileFileRef { |
| 60 public: |
| 61 // Returns true if the required interface is available. |
| 62 static bool IsAvailable(); |
| 63 |
| 64 // Returns |PP_kInvalidFileHandle| on error. |
| 65 static PP_FileHandle OpenFile(const pp::FileRef& resource, |
| 66 int32_t mode); |
| 67 static bool QueryFile(const pp::FileRef& resource, |
| 68 PP_FileInfo* info); |
| 69 }; |
| 70 |
| 71 } // namespace flash |
| 72 } // namespace pp |
| 73 |
| 74 #endif // PPAPI_CPP_PRIVATE_FLASH_FILE_H_ |
| OLD | NEW |