OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_CPP_FILE_REF_H_ |
| 6 #define PPAPI_CPP_FILE_REF_H_ |
| 7 |
| 8 #include "ppapi/c/pp_stdint.h" |
| 9 #include "ppapi/c/ppb_file_ref.h" |
| 10 #include "ppapi/cpp/resource.h" |
| 11 #include "ppapi/cpp/var.h" |
| 12 |
| 13 namespace pp { |
| 14 |
| 15 class CompletionCallback; |
| 16 class FileSystem; |
| 17 |
| 18 class FileRef: public Resource { |
| 19 public: |
| 20 // Creates an is_null() FileRef object. |
| 21 FileRef() {} |
| 22 |
| 23 // This constructor is used when we've gotten a PP_Resource as a return value |
| 24 // that we need to addref. |
| 25 explicit FileRef(PP_Resource resource); |
| 26 |
| 27 // This constructor is used when we've gotten a PP_Resource as a return value |
| 28 // that has already been addref'ed for us. |
| 29 struct PassRef {}; |
| 30 FileRef(PassRef, PP_Resource resource); |
| 31 |
| 32 // Creates a FileRef pointing to a path in the given filesystem. |
| 33 FileRef(const FileSystem& file_system, const char* path); |
| 34 |
| 35 FileRef(const FileRef& other); |
| 36 |
| 37 // Returns the file system type. |
| 38 PP_FileSystemType GetFileSystemType() const; |
| 39 |
| 40 // Returns the name of the file. |
| 41 Var GetName() const; |
| 42 |
| 43 // Returns the absolute path of the file. See PPB_FileRef::GetPath for more |
| 44 // details. |
| 45 Var GetPath() const; |
| 46 |
| 47 // Returns the parent directory of this file. See PPB_FileRef::GetParent for |
| 48 // more details. |
| 49 FileRef GetParent() const; |
| 50 |
| 51 int32_t MakeDirectory(const CompletionCallback& cc); |
| 52 |
| 53 int32_t MakeDirectoryIncludingAncestors(const CompletionCallback& cc); |
| 54 |
| 55 int32_t Touch(PP_Time last_access_time, |
| 56 PP_Time last_modified_time, |
| 57 const CompletionCallback& cc); |
| 58 |
| 59 int32_t Delete(const CompletionCallback& cc); |
| 60 |
| 61 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); |
| 62 }; |
| 63 |
| 64 } // namespace pp |
| 65 |
| 66 #endif // PPAPI_CPP_FILE_REF_H_ |
OLD | NEW |