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

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

Issue 9564047: Add FileUtileHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: handle not found case Created 8 years, 9 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
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/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 29 matching lines...) Expand all
40 }; 40 };
41 41
42 class EmptyFileEnumerator : public AbstractFileEnumerator { 42 class EmptyFileEnumerator : public AbstractFileEnumerator {
43 virtual FilePath Next() OVERRIDE { return FilePath(); } 43 virtual FilePath Next() OVERRIDE { return FilePath(); }
44 virtual int64 Size() OVERRIDE { return 0; } 44 virtual int64 Size() OVERRIDE { return 0; }
45 virtual bool IsDirectory() OVERRIDE { return false; } 45 virtual bool IsDirectory() OVERRIDE { return false; }
46 }; 46 };
47 47
48 virtual ~FileSystemFileUtil(); 48 virtual ~FileSystemFileUtil();
49 49
50 // Deletes a file or a directory.
51 // It is an error to delete a non-empty directory with recursive=false.
52 //
53 // This method calls one of the following methods depending on whether the
54 // target is a directory or not, and whether the |recursive| flag is given or
55 // not.
56 // - (virtual) DeleteFile,
57 // - (virtual) DeleteSingleDirectory or
58 // - (non-virtual) DeleteDirectoryRecursive which calls two methods above.
59 //
60 // TODO(kinuko): Move this implementation outside FileSystemFileUtil.
61 PlatformFileError Delete(
62 FileSystemOperationContext* context,
63 const FileSystemPath& path,
64 bool recursive);
65
66 // Creates or opens a file with the given flags. 50 // Creates or opens a file with the given flags.
67 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create 51 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create
68 // a new file at the given |path| and calls back with 52 // a new file at the given |path| and calls back with
69 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |path| already exists. 53 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |path| already exists.
70 virtual PlatformFileError CreateOrOpen( 54 virtual PlatformFileError CreateOrOpen(
71 FileSystemOperationContext* context, 55 FileSystemOperationContext* context,
72 const FileSystemPath& path, 56 const FileSystemPath& path,
73 int file_flags, 57 int file_flags,
74 PlatformFile* file_handle, 58 PlatformFile* file_handle,
75 bool* created); 59 bool* created);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 180
197 // Deletes a directory and all entries under the directory. 181 // Deletes a directory and all entries under the directory.
198 // 182 //
199 // This method is called from Delete. It internally calls two following 183 // This method is called from Delete. It internally calls two following
200 // virtual methods, 184 // virtual methods,
201 // - (virtual) DeleteFile to delete files, and 185 // - (virtual) DeleteFile to delete files, and
202 // - (virtual) DeleteSingleDirectory to delete empty directories after all 186 // - (virtual) DeleteSingleDirectory to delete empty directories after all
203 // the files are deleted. 187 // the files are deleted.
204 // 188 //
205 // TODO(kinuko): Move this method out of this class. 189 // TODO(kinuko): Move this method out of this class.
206 PlatformFileError DeleteDirectoryRecursive( 190 PlatformFileError DeleteDirectoryRecursive(
kinuko 2012/03/02 19:29:22 Should this be also removed?
tzik 2012/03/02 21:25:47 Done.
207 FileSystemOperationContext* context, 191 FileSystemOperationContext* context,
208 const FileSystemPath& path); 192 const FileSystemPath& path);
209 193
210 // TODO(kinuko): We should stop FileUtil layering. 194 // TODO(kinuko): We should stop FileUtil layering.
211 FileSystemFileUtil* underlying_file_util() const { 195 FileSystemFileUtil* underlying_file_util() const {
212 return underlying_file_util_.get(); 196 return underlying_file_util_.get();
213 } 197 }
214 198
215 private: 199 private:
216 scoped_ptr<FileSystemFileUtil> underlying_file_util_; 200 scoped_ptr<FileSystemFileUtil> underlying_file_util_;
217 201
218 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); 202 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil);
219 }; 203 };
220 204
221 } // namespace fileapi 205 } // namespace fileapi
222 206
223 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 207 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698