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

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

Issue 7470037: [Refactor] to rename and re-layer the file_util stack layers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased on the svn tree. Created 9 years, 3 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) 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 WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/file_util_proxy.h" 13 #include "base/file_util_proxy.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/platform_file.h" 16 #include "base/platform_file.h"
17 #include "webkit/fileapi/file_system_file_util.h" 17 #include "webkit/fileapi/file_system_file_util.h"
18 #include "webkit/fileapi/file_system_types.h" 18 #include "webkit/fileapi/file_system_types.h"
19 19
20 namespace base { 20 namespace base {
21 struct PlatformFileInfo; 21 struct PlatformFileInfo;
22 class MessageLoopProxy; 22 class MessageLoopProxy;
23 class Time; 23 class Time;
24 } 24 }
25 25
26 class GURL; 26 class GURL;
27 27
28 namespace fileapi { 28 namespace fileapi {
29 29
30 using base::PlatformFile; 30 using base::PlatformFile;
31 using base::PlatformFileError; 31 using base::PlatformFileError;
32 32
33 class FileSystemOperationContext; 33 class FileSystemOperationContext;
34 34
35 // An instance of this class is created and owned by *MountPointProvider. 35 // An instance of this class is created and owned by *MountPointProvider.
36 class LocalFileSystemFileUtil : public FileSystemFileUtil { 36 class LocalFileUtil : public FileSystemFileUtil {
37 public: 37 public:
38 // |underlying_file_util| is owned by the instance. It will be deleted by 38 // |underlying_file_util| is owned by the instance. It will be deleted by
39 // the owner instance. For example, it can be instanciated as follows: 39 // the owner instance. For example, it can be instanciated as follows:
40 // FileSystemFileUtil* file_system_file_util = 40 // FileSystemFileUtil* file_util = new LocalFileUtil(new NativeFileUtil());
41 // new LocalFileSystemFileUtil(new FileSystemFileUtil()); 41 explicit LocalFileUtil(FileSystemFileUtil* underlying_file_util);
42 explicit LocalFileSystemFileUtil(FileSystemFileUtil* underlying_file_util); 42 virtual ~LocalFileUtil();
43 virtual ~LocalFileSystemFileUtil();
44 43
45 virtual PlatformFileError CreateOrOpen( 44 virtual PlatformFileError CreateOrOpen(
46 FileSystemOperationContext* context, 45 FileSystemOperationContext* context,
47 const FilePath& file_path, 46 const FilePath& file_path,
48 int file_flags, 47 int file_flags,
49 PlatformFile* file_handle, 48 PlatformFile* file_handle,
50 bool* created); 49 bool* created) OVERRIDE;
51
52 virtual PlatformFileError EnsureFileExists( 50 virtual PlatformFileError EnsureFileExists(
53 FileSystemOperationContext* context, 51 FileSystemOperationContext* context,
54 const FilePath& file_path, bool* created); 52 const FilePath& file_path, bool* created) OVERRIDE;
55 53 virtual PlatformFileError CreateDirectory(
56 virtual PlatformFileError GetLocalFilePath(
57 FileSystemOperationContext* context, 54 FileSystemOperationContext* context,
58 const FilePath& virtual_file, 55 const FilePath& file_path,
59 FilePath* local_path); 56 bool exclusive,
60 57 bool recursive) OVERRIDE;
61 virtual PlatformFileError GetFileInfo( 58 virtual PlatformFileError GetFileInfo(
62 FileSystemOperationContext* context, 59 FileSystemOperationContext* context,
63 const FilePath& file, 60 const FilePath& file,
64 base::PlatformFileInfo* file_info, 61 base::PlatformFileInfo* file_info,
65 FilePath* platform_file); 62 FilePath* platform_file) OVERRIDE;
66
67 virtual PlatformFileError ReadDirectory( 63 virtual PlatformFileError ReadDirectory(
68 FileSystemOperationContext* context, 64 FileSystemOperationContext* context,
69 const FilePath& file_path, 65 const FilePath& file_path,
70 std::vector<base::FileUtilProxy::Entry>* entries); 66 std::vector<base::FileUtilProxy::Entry>* entries) OVERRIDE;
71 67 virtual AbstractFileEnumerator* CreateFileEnumerator(
72 virtual PlatformFileError CreateDirectory( 68 FileSystemOperationContext* context,
69 const FilePath& root_path) OVERRIDE;
70 virtual PlatformFileError GetLocalFilePath(
71 FileSystemOperationContext* context,
72 const FilePath& virtual_file,
73 FilePath* local_path) OVERRIDE;
74 virtual PlatformFileError Touch(
73 FileSystemOperationContext* context, 75 FileSystemOperationContext* context,
74 const FilePath& file_path, 76 const FilePath& file_path,
75 bool exclusive, 77 const base::Time& last_access_time,
76 bool recursive); 78 const base::Time& last_modified_time) OVERRIDE;
77 79 virtual PlatformFileError Truncate(
80 FileSystemOperationContext* context,
81 const FilePath& path,
82 int64 length) OVERRIDE;
83 virtual bool PathExists(
84 FileSystemOperationContext* context,
85 const FilePath& file_path) OVERRIDE;
86 virtual bool DirectoryExists(
87 FileSystemOperationContext* context,
88 const FilePath& file_path) OVERRIDE;
89 virtual bool IsDirectoryEmpty(
90 FileSystemOperationContext* context,
91 const FilePath& file_path) OVERRIDE;
78 virtual PlatformFileError CopyOrMoveFile( 92 virtual PlatformFileError CopyOrMoveFile(
79 FileSystemOperationContext* context, 93 FileSystemOperationContext* context,
80 const FilePath& src_file_path, 94 const FilePath& src_file_path,
81 const FilePath& dest_file_path, 95 const FilePath& dest_file_path,
82 bool copy); 96 bool copy) OVERRIDE;
83
84 virtual PlatformFileError CopyInForeignFile( 97 virtual PlatformFileError CopyInForeignFile(
85 FileSystemOperationContext* context, 98 FileSystemOperationContext* context,
86 const FilePath& src_file_path, 99 const FilePath& src_file_path,
87 const FilePath& dest_file_path); 100 const FilePath& dest_file_path) OVERRIDE;
88
89 virtual PlatformFileError DeleteFile( 101 virtual PlatformFileError DeleteFile(
90 FileSystemOperationContext* context, 102 FileSystemOperationContext* context,
91 const FilePath& file_path); 103 const FilePath& file_path) OVERRIDE;
92
93 virtual PlatformFileError DeleteSingleDirectory( 104 virtual PlatformFileError DeleteSingleDirectory(
94 FileSystemOperationContext* context, 105 FileSystemOperationContext* context,
95 const FilePath& file_path); 106 const FilePath& file_path) OVERRIDE;
96
97 virtual PlatformFileError Touch(
98 FileSystemOperationContext* context,
99 const FilePath& file_path,
100 const base::Time& last_access_time,
101 const base::Time& last_modified_time);
102
103 virtual PlatformFileError Truncate(
104 FileSystemOperationContext* context,
105 const FilePath& path,
106 int64 length);
107
108 virtual bool PathExists(
109 FileSystemOperationContext* context,
110 const FilePath& file_path);
111
112 virtual bool DirectoryExists(
113 FileSystemOperationContext* context,
114 const FilePath& file_path);
115
116 virtual bool IsDirectoryEmpty(
117 FileSystemOperationContext* context,
118 const FilePath& file_path);
119
120 virtual AbstractFileEnumerator* CreateFileEnumerator(
121 FileSystemOperationContext* context,
122 const FilePath& root_path);
123 107
124 private: 108 private:
125 // Given the filesystem's root URL and a virtual path, produces a real, full 109 // Given the filesystem's root URL and a virtual path, produces a real, full
126 // local path. 110 // local path.
127 FilePath GetLocalPath( 111 FilePath GetLocalPath(
128 FileSystemOperationContext* context, 112 FileSystemOperationContext* context,
129 const GURL& origin_url, 113 const GURL& origin_url,
130 FileSystemType type, 114 FileSystemType type,
131 const FilePath& virtual_path); 115 const FilePath& virtual_path);
132 116
133 scoped_ptr<FileSystemFileUtil> underlying_file_util_; 117 DISALLOW_COPY_AND_ASSIGN(LocalFileUtil);
134
135 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil);
136 }; 118 };
137 119
138 } // namespace fileapi 120 } // namespace fileapi
139 121
140 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 122 #endif // WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/local_file_system_file_util_unittest.cc ('k') | webkit/fileapi/local_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698