Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: webkit/fileapi/file_system_file_util.h

Issue 11960003: Cleanup: Move more recursive operation logic from FileUtilHelper to FileUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/fileapi/file_util_helper.cc » ('j') | webkit/fileapi/file_util_helper.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const base::Time& last_access_time, 143 const base::Time& last_access_time,
144 const base::Time& last_modified_time) = 0; 144 const base::Time& last_modified_time) = 0;
145 145
146 // Truncates a file to the given length. If |length| is greater than the 146 // Truncates a file to the given length. If |length| is greater than the
147 // current length of the file, the file will be extended with zeroes. 147 // current length of the file, the file will be extended with zeroes.
148 virtual base::PlatformFileError Truncate( 148 virtual base::PlatformFileError Truncate(
149 FileSystemOperationContext* context, 149 FileSystemOperationContext* context,
150 const FileSystemURL& url, 150 const FileSystemURL& url,
151 int64 length) = 0; 151 int64 length) = 0;
152 152
153 // Returns true if a given |url| is an empty directory.
154 virtual bool IsDirectoryEmpty(
155 FileSystemOperationContext* context,
156 const FileSystemURL& url) = 0;
157
158 // Copies or moves a single file from |src_url| to |dest_url|. 153 // Copies or moves a single file from |src_url| to |dest_url|.
154 // The filesystem type of |src_url| and |dest_url| MUST be same.
155 //
156 // This returns:
157 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path|
158 // or the parent directory of |dest_url| does not exist.
159 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
160 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
161 // is not a file.
162 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
163 // its parent path is a file.
164 //
159 virtual base::PlatformFileError CopyOrMoveFile( 165 virtual base::PlatformFileError CopyOrMoveFile(
160 FileSystemOperationContext* context, 166 FileSystemOperationContext* context,
161 const FileSystemURL& src_url, 167 const FileSystemURL& src_url,
162 const FileSystemURL& dest_url, 168 const FileSystemURL& dest_url,
163 bool copy) = 0; 169 bool copy) = 0;
164 170
165 // Copies in a single file from a different filesystem. 171 // Copies in a single file from a different filesystem.
172 //
173 // This returns:
174 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path|
175 // or the parent directory of |dest_url| does not exist.
176 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
177 // is not a file.
178 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
179 // its parent path is a file.
180 //
166 virtual base::PlatformFileError CopyInForeignFile( 181 virtual base::PlatformFileError CopyInForeignFile(
167 FileSystemOperationContext* context, 182 FileSystemOperationContext* context,
168 const FilePath& src_file_path, 183 const FilePath& src_file_path,
169 const FileSystemURL& dest_url) = 0; 184 const FileSystemURL& dest_url) = 0;
170 185
171 // Deletes a single file. 186 // Deletes a single file.
172 // It assumes the given url points a file. 187 // It assumes the given url points a file.
173 virtual base::PlatformFileError DeleteFile( 188 virtual base::PlatformFileError DeleteFile(
174 FileSystemOperationContext* context, 189 FileSystemOperationContext* context,
175 const FileSystemURL& url) = 0; 190 const FileSystemURL& url) = 0;
176 191
177 // Deletes a single empty directory. 192 // Deletes a single empty directory.
178 // It assumes the given url points an empty directory. 193 //
179 virtual base::PlatformFileError DeleteSingleDirectory( 194 // This returns:
195 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
196 // - PLATFORM_FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory.
197 // - PLATFORM_FILE_ERROR_NOT_EMPTY if |url| is not empty.
198 //
199 virtual base::PlatformFileError DeleteDirectory(
180 FileSystemOperationContext* context, 200 FileSystemOperationContext* context,
181 const FileSystemURL& url) = 0; 201 const FileSystemURL& url) = 0;
182 202
183 // Creates a local snapshot file for a given |url| and returns the 203 // Creates a local snapshot file for a given |url| and returns the
184 // metadata and platform path of the snapshot file via |callback|. 204 // metadata and platform path of the snapshot file via |callback|.
185 // In regular filesystem cases the implementation may simply return 205 // In regular filesystem cases the implementation may simply return
186 // the metadata of the file itself (as well as GetMetadata does), 206 // the metadata of the file itself (as well as GetMetadata does),
187 // while in non-regular filesystem case the backend may create a 207 // while in non-regular filesystem case the backend may create a
188 // temporary snapshot file which holds the file data and return 208 // temporary snapshot file which holds the file data and return
189 // the metadata of the temporary file. 209 // the metadata of the temporary file.
190 // 210 //
191 // |file_info| is the metadata of the snapshot file created. 211 // |file_info| is the metadata of the snapshot file created.
192 // |platform_path| is the path to the snapshot file created. 212 // |platform_path| is the path to the snapshot file created.
193 // |policy| should indicate the policy how the fileapi backend 213 // |policy| should indicate the policy how the fileapi backend
194 // should handle the returned file. 214 // should handle the returned file.
215 //
216 // This returns:
217 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
218 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file.
219 //
195 virtual base::PlatformFileError CreateSnapshotFile( 220 virtual base::PlatformFileError CreateSnapshotFile(
196 FileSystemOperationContext* context, 221 FileSystemOperationContext* context,
197 const FileSystemURL& url, 222 const FileSystemURL& url,
198 base::PlatformFileInfo* file_info, 223 base::PlatformFileInfo* file_info,
199 FilePath* platform_path, 224 FilePath* platform_path,
200 SnapshotFilePolicy* policy) = 0; 225 SnapshotFilePolicy* policy) = 0;
201 226
202 protected: 227 protected:
203 FileSystemFileUtil() {} 228 FileSystemFileUtil() {}
204 229
205 private: 230 private:
206 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); 231 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil);
207 }; 232 };
208 233
209 } // namespace fileapi 234 } // namespace fileapi
210 235
211 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 236 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_util_helper.cc » ('j') | webkit/fileapi/file_util_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698