OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PROXY_PPB_FILE_REF_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class StringVar; | 22 class StringVar; |
23 | 23 |
24 namespace proxy { | 24 namespace proxy { |
25 | 25 |
26 class PPAPI_PROXY_EXPORT FileRefResource | 26 class PPAPI_PROXY_EXPORT FileRefResource |
27 : public PluginResource, | 27 : public PluginResource, |
28 public thunk::PPB_FileRef_API { | 28 public thunk::PPB_FileRef_API { |
29 public: | 29 public: |
30 static PP_Resource CreateFileRef(Connection connection, | 30 static PP_Resource CreateFileRef(Connection connection, |
31 PP_Instance instance, | 31 PP_Instance instance, |
32 const FileRefCreateInfo& info); | 32 const FileRef_CreateInfo& info); |
33 | 33 |
34 virtual ~FileRefResource(); | 34 virtual ~FileRefResource(); |
35 | 35 |
36 // Resource implementation. | 36 // Resource implementation. |
37 virtual thunk::PPB_FileRef_API* AsPPB_FileRef_API() OVERRIDE; | 37 virtual thunk::PPB_FileRef_API* AsPPB_FileRef_API() OVERRIDE; |
38 | 38 |
39 // PPB_FileRef_API implementation. | 39 // PPB_FileRef_API implementation. |
40 virtual PP_FileSystemType GetFileSystemType() const OVERRIDE; | 40 virtual PP_FileSystemType GetFileSystemType() const OVERRIDE; |
41 virtual PP_Var GetName() const OVERRIDE; | 41 virtual PP_Var GetName() const OVERRIDE; |
42 virtual PP_Var GetPath() const OVERRIDE; | 42 virtual PP_Var GetPath() const OVERRIDE; |
43 virtual PP_Resource GetParent() OVERRIDE; | 43 virtual PP_Resource GetParent() OVERRIDE; |
44 virtual int32_t MakeDirectory( | 44 virtual int32_t MakeDirectory( |
45 PP_Bool make_ancestors, | 45 PP_Bool make_ancestors, |
46 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 46 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
47 virtual int32_t Touch(PP_Time last_access_time, | 47 virtual int32_t Touch(PP_Time last_access_time, |
48 PP_Time last_modified_time, | 48 PP_Time last_modified_time, |
49 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 49 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
50 virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) OVERRIDE; | 50 virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) OVERRIDE; |
51 virtual int32_t Rename(PP_Resource new_file_ref, | 51 virtual int32_t Rename(PP_Resource new_file_ref, |
52 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 52 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
53 virtual int32_t Query(PP_FileInfo* info, | 53 virtual int32_t Query(PP_FileInfo* info, |
54 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 54 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
55 virtual int32_t ReadDirectoryEntries( | 55 virtual int32_t ReadDirectoryEntries( |
56 const PP_ArrayOutput& output, | 56 const PP_ArrayOutput& output, |
57 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 57 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
58 virtual const FileRefCreateInfo& GetCreateInfo() const OVERRIDE; | 58 virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const OVERRIDE; |
| 59 virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info, |
| 60 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 61 virtual int32_t ReadDirectoryEntriesInHost( |
| 62 linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files, |
| 63 linked_ptr<std::vector<PP_FileType> > file_types, |
| 64 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
59 | 65 |
60 // Private API | 66 // Private API |
61 virtual PP_Var GetAbsolutePath() OVERRIDE; | 67 virtual PP_Var GetAbsolutePath() OVERRIDE; |
62 | 68 |
63 private: | 69 private: |
64 FileRefResource(Connection connection, | 70 FileRefResource(Connection connection, |
65 PP_Instance instance, | 71 PP_Instance instance, |
66 const FileRefCreateInfo& info); | 72 const FileRef_CreateInfo& info); |
67 | 73 |
68 void RunTrackedCallback(scoped_refptr<TrackedCallback> callback, | 74 void RunTrackedCallback(scoped_refptr<TrackedCallback> callback, |
69 const ResourceMessageReplyParams& params); | 75 const ResourceMessageReplyParams& params); |
70 | 76 |
71 void OnQueryReply(PP_FileInfo* out_info, | 77 void OnQueryReply(PP_FileInfo* out_info, |
72 scoped_refptr<TrackedCallback> callback, | 78 scoped_refptr<TrackedCallback> callback, |
73 const ResourceMessageReplyParams& params, | 79 const ResourceMessageReplyParams& params, |
74 const PP_FileInfo& info); | 80 const PP_FileInfo& info); |
75 | 81 |
76 void OnDirectoryEntriesReply( | 82 void OnDirectoryEntriesReply( |
77 const PP_ArrayOutput& output, | 83 const PP_ArrayOutput& output, |
78 scoped_refptr<TrackedCallback> callback, | 84 scoped_refptr<TrackedCallback> callback, |
79 const ResourceMessageReplyParams& params, | 85 const ResourceMessageReplyParams& params, |
80 const std::vector<ppapi::FileRefCreateInfo>& infos, | 86 const std::vector<ppapi::FileRef_CreateInfo>& infos, |
81 const std::vector<PP_FileType>& file_types); | 87 const std::vector<PP_FileType>& file_types); |
82 | 88 |
83 // Populated after creation. | 89 // Populated after creation. |
84 FileRefCreateInfo create_info_; | 90 FileRef_CreateInfo create_info_; |
85 | 91 |
86 // Some file ref operations may fail if the the file system resource inside | 92 // Some file ref operations may fail if the the file system resource inside |
87 // create_info_ is destroyed. Therefore, we explicitly hold a reference to | 93 // create_info_ is destroyed. Therefore, we explicitly hold a reference to |
88 // the file system resource to make sure it outlives the file ref. | 94 // the file system resource to make sure it outlives the file ref. |
89 ScopedPPResource file_system_resource_; | 95 ScopedPPResource file_system_resource_; |
90 | 96 |
91 scoped_refptr<StringVar> name_var_; | 97 scoped_refptr<StringVar> name_var_; |
92 scoped_refptr<StringVar> path_var_; | 98 scoped_refptr<StringVar> path_var_; |
93 scoped_refptr<StringVar> absolute_path_var_; | 99 scoped_refptr<StringVar> absolute_path_var_; |
94 | 100 |
95 DISALLOW_COPY_AND_ASSIGN(FileRefResource); | 101 DISALLOW_COPY_AND_ASSIGN(FileRefResource); |
96 }; | 102 }; |
97 | 103 |
98 } // namespace proxy | 104 } // namespace proxy |
99 } // namespace ppapi | 105 } // namespace ppapi |
100 | 106 |
101 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ | 107 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ |
OLD | NEW |