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

Side by Side Diff: webkit/fileapi/native_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: rebased 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 | « webkit/fileapi/media/native_media_file_util.cc ('k') | webkit/fileapi/native_file_util.cc » ('j') | no next file with comments »
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_NATIVE_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_NATIVE_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/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "webkit/fileapi/file_system_file_util.h" 12 #include "webkit/fileapi/file_system_file_util.h"
13 #include "webkit/storage/webkit_storage_export.h" 13 #include "webkit/storage/webkit_storage_export.h"
14 14
15 namespace base { 15 namespace base {
16 class Time; 16 class Time;
17 } 17 }
18 18
19 namespace fileapi { 19 namespace fileapi {
20 20
21 // A thin wrapper class for accessing the OS native filesystem.
22 // This performs common error checks necessary to implement FileUtil family
23 // in addition to perform native filesystem operations.
24 //
25 // For the error checks it performs please see the comment for
26 // FileSystemFileUtil interface (webkit/fileapi/file_system_file_util.h).
27 //
28 // Note that all the methods of this class are static and this does NOT
29 // inherit from FileSystemFileUtil.
30 //
21 // TODO(dmikurube): Add unit tests for NativeFileUtil. 31 // TODO(dmikurube): Add unit tests for NativeFileUtil.
22 // This class handles accessing the OS native filesystem. 32 // http://crbug.com/170564
23 class WEBKIT_STORAGE_EXPORT_PRIVATE NativeFileUtil { 33 class WEBKIT_STORAGE_EXPORT_PRIVATE NativeFileUtil {
24 public: 34 public:
25 static base::PlatformFileError CreateOrOpen( 35 static base::PlatformFileError CreateOrOpen(
26 const FilePath& path, 36 const FilePath& path,
27 int file_flags, 37 int file_flags,
28 base::PlatformFile* file_handle, 38 base::PlatformFile* file_handle,
29 bool* created); 39 bool* created);
30 static base::PlatformFileError Close(base::PlatformFile file); 40 static base::PlatformFileError Close(base::PlatformFile file);
31 static base::PlatformFileError EnsureFileExists(const FilePath& path, 41 static base::PlatformFileError EnsureFileExists(const FilePath& path,
32 bool* created); 42 bool* created);
33 static base::PlatformFileError CreateDirectory(const FilePath& path, 43 static base::PlatformFileError CreateDirectory(const FilePath& path,
34 bool exclusive, 44 bool exclusive,
35 bool recursive); 45 bool recursive);
36 static base::PlatformFileError GetFileInfo(const FilePath& path, 46 static base::PlatformFileError GetFileInfo(const FilePath& path,
37 base::PlatformFileInfo* file_info); 47 base::PlatformFileInfo* file_info);
38 static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> 48 static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator>
39 CreateFileEnumerator(const FilePath& root_path, 49 CreateFileEnumerator(const FilePath& root_path,
40 bool recursive); 50 bool recursive);
41 static base::PlatformFileError Touch(const FilePath& path, 51 static base::PlatformFileError Touch(const FilePath& path,
42 const base::Time& last_access_time, 52 const base::Time& last_access_time,
43 const base::Time& last_modified_time); 53 const base::Time& last_modified_time);
44 static base::PlatformFileError Truncate(const FilePath& path, int64 length); 54 static base::PlatformFileError Truncate(const FilePath& path, int64 length);
45 static bool PathExists(const FilePath& path); 55 static bool PathExists(const FilePath& path);
46 static bool DirectoryExists(const FilePath& path); 56 static bool DirectoryExists(const FilePath& path);
47 static bool IsDirectoryEmpty(const FilePath& path);
48 static base::PlatformFileError CopyOrMoveFile(const FilePath& src_path, 57 static base::PlatformFileError CopyOrMoveFile(const FilePath& src_path,
49 const FilePath& dest_path, 58 const FilePath& dest_path,
50 bool copy); 59 bool copy);
51 static base::PlatformFileError DeleteFile(const FilePath& path); 60 static base::PlatformFileError DeleteFile(const FilePath& path);
52 static base::PlatformFileError DeleteSingleDirectory(const FilePath& path); 61 static base::PlatformFileError DeleteDirectory(const FilePath& path);
53 62
54 private: 63 private:
55 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil); 64 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil);
56 }; 65 };
57 66
58 } // namespace fileapi 67 } // namespace fileapi
59 68
60 #endif // WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_ 69 #endif // WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/media/native_media_file_util.cc ('k') | webkit/fileapi/native_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698