OLD | NEW |
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_OBFUSCATED_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ |
6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 FileSystemOperationContext* context, | 132 FileSystemOperationContext* context, |
133 const FileSystemURL& url) OVERRIDE; | 133 const FileSystemURL& url) OVERRIDE; |
134 | 134 |
135 virtual base::PlatformFileError DeleteSingleDirectory( | 135 virtual base::PlatformFileError DeleteSingleDirectory( |
136 FileSystemOperationContext* context, | 136 FileSystemOperationContext* context, |
137 const FileSystemURL& url) OVERRIDE; | 137 const FileSystemURL& url) OVERRIDE; |
138 | 138 |
139 // Gets the topmost directory specific to this origin and type. This will | 139 // Gets the topmost directory specific to this origin and type. This will |
140 // contain both the directory database's files and all the backing file | 140 // contain both the directory database's files and all the backing file |
141 // subdirectories. | 141 // subdirectories. |
| 142 // Returns an empty path if the directory is undefined (e.g. because |type| |
| 143 // is invalid). If the directory is defined, it will be returned, even if |
| 144 // there is a file system error (e.g. the directory doesn't exist on disk and |
| 145 // |create| is false). Callers should always check |error_code| to make sure |
| 146 // the returned path is usable. |
142 FilePath GetDirectoryForOriginAndType( | 147 FilePath GetDirectoryForOriginAndType( |
143 const GURL& origin, | 148 const GURL& origin, |
144 FileSystemType type, | 149 FileSystemType type, |
145 bool create, | 150 bool create, |
146 base::PlatformFileError* error_code); | 151 base::PlatformFileError* error_code); |
147 | 152 |
148 FilePath GetDirectoryForOriginAndType( | |
149 const GURL& origin, | |
150 FileSystemType type, | |
151 bool create) { | |
152 return GetDirectoryForOriginAndType(origin, type, create, NULL); | |
153 } | |
154 | |
155 // Deletes the topmost directory specific to this origin and type. This will | 153 // Deletes the topmost directory specific to this origin and type. This will |
156 // delete its directory database. | 154 // delete its directory database. |
157 bool DeleteDirectoryForOriginAndType(const GURL& origin, FileSystemType type); | 155 bool DeleteDirectoryForOriginAndType(const GURL& origin, FileSystemType type); |
158 | 156 |
159 // This will migrate a filesystem from the old passthrough sandbox into the | 157 // This will migrate a filesystem from the old passthrough sandbox into the |
160 // new obfuscated one. It won't obfuscate the old filenames [it will maintain | 158 // new obfuscated one. It won't obfuscate the old filenames [it will maintain |
161 // the old structure, but move it to a new root], but any new files created | 159 // the old structure, but move it to a new root], but any new files created |
162 // will go into the new standard locations. This will be completely | 160 // will go into the new standard locations. This will be completely |
163 // transparent to the user. This migration is atomic in that it won't alter | 161 // transparent to the user. This migration is atomic in that it won't alter |
164 // the source data until it's done, and that will be with a single directory | 162 // the source data until it's done, and that will be with a single directory |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 scoped_ptr<FileSystemOriginDatabase> origin_database_; | 264 scoped_ptr<FileSystemOriginDatabase> origin_database_; |
267 FilePath file_system_directory_; | 265 FilePath file_system_directory_; |
268 base::OneShotTimer<ObfuscatedFileUtil> timer_; | 266 base::OneShotTimer<ObfuscatedFileUtil> timer_; |
269 | 267 |
270 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); | 268 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); |
271 }; | 269 }; |
272 | 270 |
273 } // namespace fileapi | 271 } // namespace fileapi |
274 | 272 |
275 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ | 273 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ |
OLD | NEW |