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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 15 matching lines...) Expand all
26 // Layering structure of the FileSystemFileUtil was split out. 26 // Layering structure of the FileSystemFileUtil was split out.
27 // See http://crbug.com/128136 if you need it. 27 // See http://crbug.com/128136 if you need it.
28 class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { 28 class WEBKIT_STORAGE_EXPORT FileSystemFileUtil {
29 public: 29 public:
30 // It will be implemented by each subclass such as FileSystemFileEnumerator. 30 // It will be implemented by each subclass such as FileSystemFileEnumerator.
31 class WEBKIT_STORAGE_EXPORT AbstractFileEnumerator { 31 class WEBKIT_STORAGE_EXPORT AbstractFileEnumerator {
32 public: 32 public:
33 virtual ~AbstractFileEnumerator() {} 33 virtual ~AbstractFileEnumerator() {}
34 34
35 // Returns an empty string if there are no more results. 35 // Returns an empty string if there are no more results.
36 virtual FilePath Next() = 0; 36 virtual base::FilePath Next() = 0;
37 37
38 // These methods return metadata for the file most recently returned by 38 // These methods return metadata for the file most recently returned by
39 // Next(). If Next() has never been called, or if Next() most recently 39 // Next(). If Next() has never been called, or if Next() most recently
40 // returned an empty string, then return the default values of 0, 40 // returned an empty string, then return the default values of 0,
41 // "null time", and false, respectively. 41 // "null time", and false, respectively.
42 virtual int64 Size() = 0; 42 virtual int64 Size() = 0;
43 virtual base::Time LastModifiedTime() = 0; 43 virtual base::Time LastModifiedTime() = 0;
44 virtual bool IsDirectory() = 0; 44 virtual bool IsDirectory() = 0;
45 }; 45 };
46 46
47 class WEBKIT_STORAGE_EXPORT EmptyFileEnumerator 47 class WEBKIT_STORAGE_EXPORT EmptyFileEnumerator
48 : public AbstractFileEnumerator { 48 : public AbstractFileEnumerator {
49 virtual FilePath Next() OVERRIDE; 49 virtual base::FilePath Next() OVERRIDE;
50 virtual int64 Size() OVERRIDE; 50 virtual int64 Size() OVERRIDE;
51 virtual base::Time LastModifiedTime() OVERRIDE; 51 virtual base::Time LastModifiedTime() OVERRIDE;
52 virtual bool IsDirectory() OVERRIDE; 52 virtual bool IsDirectory() OVERRIDE;
53 }; 53 };
54 54
55 virtual ~FileSystemFileUtil() {} 55 virtual ~FileSystemFileUtil() {}
56 56
57 // Creates or opens a file with the given flags. 57 // Creates or opens a file with the given flags.
58 // See header comments for AsyncFileUtil::CreateOrOpen() for more details. 58 // See header comments for AsyncFileUtil::CreateOrOpen() for more details.
59 // This is used only by Pepper/NaCL File API. 59 // This is used only by Pepper/NaCL File API.
(...skipping 24 matching lines...) Expand all
84 const FileSystemURL& url, 84 const FileSystemURL& url,
85 bool exclusive, 85 bool exclusive,
86 bool recursive) = 0; 86 bool recursive) = 0;
87 87
88 // Retrieves the information about a file. 88 // Retrieves the information about a file.
89 // See header comments for AsyncFileUtil::GetFileInfo() for more details. 89 // See header comments for AsyncFileUtil::GetFileInfo() for more details.
90 virtual base::PlatformFileError GetFileInfo( 90 virtual base::PlatformFileError GetFileInfo(
91 FileSystemOperationContext* context, 91 FileSystemOperationContext* context,
92 const FileSystemURL& url, 92 const FileSystemURL& url,
93 base::PlatformFileInfo* file_info, 93 base::PlatformFileInfo* file_info,
94 FilePath* platform_path) = 0; 94 base::FilePath* platform_path) = 0;
95 95
96 // Returns a pointer to a new instance of AbstractFileEnumerator which is 96 // Returns a pointer to a new instance of AbstractFileEnumerator which is
97 // implemented for each FileSystemFileUtil subclass. The instance needs to be 97 // implemented for each FileSystemFileUtil subclass. The instance needs to be
98 // freed by the caller, and its lifetime should not extend past when the 98 // freed by the caller, and its lifetime should not extend past when the
99 // current call returns to the main FILE message loop. 99 // current call returns to the main FILE message loop.
100 // 100 //
101 // The supplied context must remain valid at least lifetime of the enumerator 101 // The supplied context must remain valid at least lifetime of the enumerator
102 // instance. 102 // instance.
103 // 103 //
104 // TODO(kinuko): Drop recursive flag so that each FileUtil no longer 104 // TODO(kinuko): Drop recursive flag so that each FileUtil no longer
105 // needs to implement recursive logic. 105 // needs to implement recursive logic.
106 virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( 106 virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator(
107 FileSystemOperationContext* context, 107 FileSystemOperationContext* context,
108 const FileSystemURL& root_url, 108 const FileSystemURL& root_url,
109 bool recursive) = 0; 109 bool recursive) = 0;
110 110
111 // Maps |file_system_url| given |context| into |local_file_path| 111 // Maps |file_system_url| given |context| into |local_file_path|
112 // which represents physical file location on the host OS. 112 // which represents physical file location on the host OS.
113 // This may not always make sense for all subclasses. 113 // This may not always make sense for all subclasses.
114 virtual base::PlatformFileError GetLocalFilePath( 114 virtual base::PlatformFileError GetLocalFilePath(
115 FileSystemOperationContext* context, 115 FileSystemOperationContext* context,
116 const FileSystemURL& file_system_url, 116 const FileSystemURL& file_system_url,
117 FilePath* local_file_path) = 0; 117 base::FilePath* local_file_path) = 0;
118 118
119 // Updates the file metadata information. 119 // Updates the file metadata information.
120 // See header comments for AsyncFileUtil::Touch() for more details. 120 // See header comments for AsyncFileUtil::Touch() for more details.
121 virtual base::PlatformFileError Touch( 121 virtual base::PlatformFileError Touch(
122 FileSystemOperationContext* context, 122 FileSystemOperationContext* context,
123 const FileSystemURL& url, 123 const FileSystemURL& url,
124 const base::Time& last_access_time, 124 const base::Time& last_access_time,
125 const base::Time& last_modified_time) = 0; 125 const base::Time& last_modified_time) = 0;
126 126
127 // Truncates a file to the given length. 127 // Truncates a file to the given length.
(...skipping 19 matching lines...) Expand all
147 FileSystemOperationContext* context, 147 FileSystemOperationContext* context,
148 const FileSystemURL& src_url, 148 const FileSystemURL& src_url,
149 const FileSystemURL& dest_url, 149 const FileSystemURL& dest_url,
150 bool copy) = 0; 150 bool copy) = 0;
151 151
152 // Copies in a single file from a different filesystem. 152 // Copies in a single file from a different filesystem.
153 // See header comments for AsyncFileUtil::CopyInForeignFile() for 153 // See header comments for AsyncFileUtil::CopyInForeignFile() for
154 // more details. 154 // more details.
155 virtual base::PlatformFileError CopyInForeignFile( 155 virtual base::PlatformFileError CopyInForeignFile(
156 FileSystemOperationContext* context, 156 FileSystemOperationContext* context,
157 const FilePath& src_file_path, 157 const base::FilePath& src_file_path,
158 const FileSystemURL& dest_url) = 0; 158 const FileSystemURL& dest_url) = 0;
159 159
160 // Deletes a single file. 160 // Deletes a single file.
161 // See header comments for AsyncFileUtil::DeleteFile() for more details. 161 // See header comments for AsyncFileUtil::DeleteFile() for more details.
162 virtual base::PlatformFileError DeleteFile( 162 virtual base::PlatformFileError DeleteFile(
163 FileSystemOperationContext* context, 163 FileSystemOperationContext* context,
164 const FileSystemURL& url) = 0; 164 const FileSystemURL& url) = 0;
165 165
166 // Deletes a single empty directory. 166 // Deletes a single empty directory.
167 // See header comments for AsyncFileUtil::DeleteDirectory() for more details. 167 // See header comments for AsyncFileUtil::DeleteDirectory() for more details.
168 virtual base::PlatformFileError DeleteDirectory( 168 virtual base::PlatformFileError DeleteDirectory(
169 FileSystemOperationContext* context, 169 FileSystemOperationContext* context,
170 const FileSystemURL& url) = 0; 170 const FileSystemURL& url) = 0;
171 171
172 // Creates a local snapshot file for a given |url| and returns the 172 // Creates a local snapshot file for a given |url| and returns the
173 // metadata and platform path of the snapshot file via |callback|. 173 // metadata and platform path of the snapshot file via |callback|.
174 // 174 //
175 // See header comments for AsyncFileUtil::CreateSnapshotFile() for 175 // See header comments for AsyncFileUtil::CreateSnapshotFile() for
176 // more details. 176 // more details.
177 virtual base::PlatformFileError CreateSnapshotFile( 177 virtual base::PlatformFileError CreateSnapshotFile(
178 FileSystemOperationContext* context, 178 FileSystemOperationContext* context,
179 const FileSystemURL& url, 179 const FileSystemURL& url,
180 base::PlatformFileInfo* file_info, 180 base::PlatformFileInfo* file_info,
181 FilePath* platform_path, 181 base::FilePath* platform_path,
182 SnapshotFilePolicy* policy) = 0; 182 SnapshotFilePolicy* policy) = 0;
183 183
184 protected: 184 protected:
185 FileSystemFileUtil() {} 185 FileSystemFileUtil() {}
186 186
187 private: 187 private:
188 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); 188 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil);
189 }; 189 };
190 190
191 } // namespace fileapi 191 } // namespace fileapi
192 192
193 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 193 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_file_stream_reader_unittest.cc ('k') | webkit/fileapi/file_system_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698