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 #ifndef PPAPI_CPP_FILE_REF_H_ | 5 #ifndef PPAPI_CPP_FILE_REF_H_ |
6 #define PPAPI_CPP_FILE_REF_H_ | 6 #define PPAPI_CPP_FILE_REF_H_ |
7 | 7 |
8 #include "ppapi/c/pp_file_info.h" | 8 #include "ppapi/c/pp_file_info.h" |
9 #include "ppapi/c/pp_stdint.h" | 9 #include "ppapi/c/pp_stdint.h" |
10 #include "ppapi/c/ppb_file_ref.h" | 10 #include "ppapi/c/ppb_file_ref.h" |
11 #include "ppapi/cpp/resource.h" | 11 #include "ppapi/cpp/resource.h" |
12 #include "ppapi/cpp/var.h" | 12 #include "ppapi/cpp/var.h" |
13 | 13 |
14 /// @file | 14 /// @file |
15 /// This file defines the API to create a file reference or "weak pointer" to a | 15 /// This file defines the API to create a file reference or "weak pointer" to a |
16 /// file in a file system. | 16 /// file in a file system. |
17 | 17 |
18 namespace pp { | 18 namespace pp { |
19 | 19 |
| 20 class DirectoryEntry; |
20 class FileSystem; | 21 class FileSystem; |
21 class CompletionCallback; | 22 class CompletionCallback; |
22 template <typename T> class CompletionCallbackWithOutput; | 23 template <typename T> class CompletionCallbackWithOutput; |
23 | 24 |
24 /// The <code>FileRef</code> class represents a "weak pointer" to a file in | 25 /// The <code>FileRef</code> class represents a "weak pointer" to a file in |
25 /// a file system. | 26 /// a file system. |
26 class FileRef : public Resource { | 27 class FileRef : public Resource { |
27 public: | 28 public: |
28 /// Default constructor for creating an is_null() <code>FileRef</code> | 29 /// Default constructor for creating an is_null() <code>FileRef</code> |
29 /// object. | 30 /// object. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 /// rename a file in the external file system. | 140 /// rename a file in the external file system. |
140 /// | 141 /// |
141 /// @param[in] new_file_ref A <code>FileRef</code> corresponding to a new | 142 /// @param[in] new_file_ref A <code>FileRef</code> corresponding to a new |
142 /// file reference. | 143 /// file reference. |
143 /// @param[in] cc A <code>CompletionCallback</code> to be called upon | 144 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
144 /// completion of Rename(). | 145 /// completion of Rename(). |
145 /// | 146 /// |
146 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 147 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
147 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); | 148 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); |
148 | 149 |
149 /// | |
150 /// Query() queries info about a file or directory. You must have access to | 150 /// Query() queries info about a file or directory. You must have access to |
151 /// read this file or directory if it exists in the external filesystem. | 151 /// read this file or directory if it exists in the external filesystem. |
152 /// | 152 /// |
153 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> | 153 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> |
154 /// to be called upon completion of Query(). | 154 /// to be called upon completion of Query(). |
155 /// | 155 /// |
156 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 156 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
157 int32_t Query(const CompletionCallbackWithOutput<PP_FileInfo>& callback); | 157 int32_t Query(const CompletionCallbackWithOutput<PP_FileInfo>& callback); |
| 158 |
| 159 /// ReadDirectoryEntries() Reads all entries in the directory. |
| 160 /// |
| 161 /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called |
| 162 /// upon completion of ReadDirectoryEntries(). On success, the |
| 163 /// directory entries will be passed to the given function. |
| 164 /// |
| 165 /// Normally you would use a CompletionCallbackFactory to allow callbacks to |
| 166 /// be bound to your class. See completion_callback_factory.h for more |
| 167 /// discussion on how to use this. Your callback will generally look like: |
| 168 /// |
| 169 /// @code |
| 170 /// void OnReadDirectoryEntries( |
| 171 /// int32_t result, |
| 172 /// const std::vector<DirectoryEntry>& entries) { |
| 173 /// if (result == PP_OK) |
| 174 /// // use entries... |
| 175 /// } |
| 176 /// @endcode |
| 177 /// |
| 178 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 179 int32_t ReadDirectoryEntries( |
| 180 const CompletionCallbackWithOutput< std::vector<DirectoryEntry> >& |
| 181 callback); |
158 }; | 182 }; |
159 | 183 |
160 } // namespace pp | 184 } // namespace pp |
161 | 185 |
162 #endif // PPAPI_CPP_FILE_REF_H_ | 186 #endif // PPAPI_CPP_FILE_REF_H_ |
OLD | NEW |