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 #ifndef PPAPI_THUNK_PPB_FILE_REF_API_H_ | 5 #ifndef PPAPI_THUNK_PPB_FILE_REF_API_H_ |
6 #define PPAPI_THUNK_PPB_FILE_REF_API_H_ | 6 #define PPAPI_THUNK_PPB_FILE_REF_API_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/linked_ptr.h" |
8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
9 #include "ppapi/c/ppb_file_ref.h" | 12 #include "ppapi/c/ppb_file_ref.h" |
10 #include "ppapi/thunk/ppapi_thunk_export.h" | 13 #include "ppapi/thunk/ppapi_thunk_export.h" |
11 | 14 |
12 namespace ppapi { | 15 namespace ppapi { |
13 | 16 |
14 struct PPB_FileRef_CreateInfo; | 17 struct PPB_FileRef_CreateInfo; |
15 class TrackedCallback; | 18 class TrackedCallback; |
16 | 19 |
17 namespace thunk { | 20 namespace thunk { |
18 | 21 |
19 class PPAPI_THUNK_EXPORT PPB_FileRef_API { | 22 class PPAPI_THUNK_EXPORT PPB_FileRef_API { |
20 public: | 23 public: |
21 virtual ~PPB_FileRef_API() {} | 24 virtual ~PPB_FileRef_API() {} |
22 | 25 |
23 virtual PP_FileSystemType GetFileSystemType() const = 0; | 26 virtual PP_FileSystemType GetFileSystemType() const = 0; |
24 virtual PP_Var GetName() const = 0; | 27 virtual PP_Var GetName() const = 0; |
25 virtual PP_Var GetPath() const = 0; | 28 virtual PP_Var GetPath() const = 0; |
26 virtual PP_Resource GetParent() = 0; | 29 virtual PP_Resource GetParent() = 0; |
27 virtual int32_t MakeDirectory(PP_Bool make_ancestors, | 30 virtual int32_t MakeDirectory(PP_Bool make_ancestors, |
28 scoped_refptr<TrackedCallback> callback) = 0; | 31 scoped_refptr<TrackedCallback> callback) = 0; |
29 virtual int32_t Touch(PP_Time last_access_time, | 32 virtual int32_t Touch(PP_Time last_access_time, |
30 PP_Time last_modified_time, | 33 PP_Time last_modified_time, |
31 scoped_refptr<TrackedCallback> callback) = 0; | 34 scoped_refptr<TrackedCallback> callback) = 0; |
32 virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) = 0; | 35 virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) = 0; |
33 virtual int32_t Rename(PP_Resource new_file_ref, | 36 virtual int32_t Rename(PP_Resource new_file_ref, |
34 scoped_refptr<TrackedCallback> callback) = 0; | 37 scoped_refptr<TrackedCallback> callback) = 0; |
35 virtual int32_t Query(PP_FileInfo* info, | 38 virtual int32_t Query(PP_FileInfo* info, |
36 scoped_refptr<TrackedCallback> callback) = 0; | 39 scoped_refptr<TrackedCallback> callback) = 0; |
| 40 virtual int32_t ReadDirectoryEntries( |
| 41 const PP_ArrayOutput& output, |
| 42 scoped_refptr<TrackedCallback> callback) = 0; |
| 43 // We define variants of Query and ReadDirectoryEntries because |
| 44 // 1. we need to take linked_ptr instead of raw pointers to avoid |
| 45 // use-after-free, and 2. we don't use PP_ArrayOutput for the |
| 46 // communication between renderers and the browser in |
| 47 // ReadDirectoryEntries. The *InHost functions must not be called in |
| 48 // plugins. Query must not be called in renderers in out-of-process |
| 49 // mode. As ReadDirectoryEntries is not support in-process mode, |
| 50 // ReadDirectoryEntries must not be called in renderers. |
| 51 // TODO(hamaji): These functions must be removed when we move |
| 52 // FileRef to the new resource design. http://crbug.com/225441 |
| 53 virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info, |
| 54 scoped_refptr<TrackedCallback> callback) = 0; |
| 55 virtual int32_t ReadDirectoryEntriesInHost( |
| 56 linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files, |
| 57 linked_ptr<std::vector<PP_FileType> > file_types, |
| 58 scoped_refptr<TrackedCallback> callback) = 0; |
37 | 59 |
38 // Internal function for use in proxying. Returns the internal CreateInfo | 60 // Internal function for use in proxying. Returns the internal CreateInfo |
39 // (the contained resource does not carry a ref on behalf of the caller). | 61 // (the contained resource does not carry a ref on behalf of the caller). |
40 virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const = 0; | 62 virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const = 0; |
41 | 63 |
42 // Private API | 64 // Private API |
43 virtual PP_Var GetAbsolutePath() = 0; | 65 virtual PP_Var GetAbsolutePath() = 0; |
44 }; | 66 }; |
45 | 67 |
46 } // namespace thunk | 68 } // namespace thunk |
47 } // namespace ppapi | 69 } // namespace ppapi |
48 | 70 |
49 #endif // PPAPI_THUNK_PPB_FILE_REF_API_H_ | 71 #endif // PPAPI_THUNK_PPB_FILE_REF_API_H_ |
OLD | NEW |