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

Side by Side Diff: webkit/browser/fileapi/obfuscated_file_util.h

Issue 274903002: Remove PlatformFile from fileapi::FileSystemFileUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
6 #define WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 6 #define WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/files/file.h" 14 #include "base/files/file.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util_proxy.h" 16 #include "base/files/file_util_proxy.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/platform_file.h"
20 #include "webkit/browser/fileapi/file_system_file_util.h" 19 #include "webkit/browser/fileapi/file_system_file_util.h"
21 #include "webkit/browser/fileapi/file_system_url.h" 20 #include "webkit/browser/fileapi/file_system_url.h"
22 #include "webkit/browser/fileapi/sandbox_directory_database.h" 21 #include "webkit/browser/fileapi/sandbox_directory_database.h"
23 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" 22 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
24 #include "webkit/browser/webkit_storage_browser_export.h" 23 #include "webkit/browser/webkit_storage_browser_export.h"
25 #include "webkit/common/blob/shareable_file_reference.h" 24 #include "webkit/common/blob/shareable_file_reference.h"
26 #include "webkit/common/fileapi/file_system_types.h" 25 #include "webkit/common/fileapi/file_system_types.h"
27 26
28 namespace base { 27 namespace base {
29 class SequencedTaskRunner; 28 class SequencedTaskRunner;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 quota::SpecialStoragePolicy* special_storage_policy, 105 quota::SpecialStoragePolicy* special_storage_policy,
107 const base::FilePath& file_system_directory, 106 const base::FilePath& file_system_directory,
108 leveldb::Env* env_override, 107 leveldb::Env* env_override,
109 base::SequencedTaskRunner* file_task_runner, 108 base::SequencedTaskRunner* file_task_runner,
110 const GetTypeStringForURLCallback& get_type_string_for_url, 109 const GetTypeStringForURLCallback& get_type_string_for_url,
111 const std::set<std::string>& known_type_strings, 110 const std::set<std::string>& known_type_strings,
112 SandboxFileSystemBackendDelegate* sandbox_delegate); 111 SandboxFileSystemBackendDelegate* sandbox_delegate);
113 virtual ~ObfuscatedFileUtil(); 112 virtual ~ObfuscatedFileUtil();
114 113
115 // FileSystemFileUtil overrides. 114 // FileSystemFileUtil overrides.
116 virtual base::File::Error CreateOrOpen( 115 virtual base::File CreateOrOpen(
117 FileSystemOperationContext* context, 116 FileSystemOperationContext* context,
118 const FileSystemURL& url, 117 const FileSystemURL& url,
119 int file_flags, 118 int file_flags) OVERRIDE;
120 base::PlatformFile* file_handle,
121 bool* created) OVERRIDE;
122 virtual base::File::Error Close(
123 FileSystemOperationContext* context,
124 base::PlatformFile file) OVERRIDE;
125 virtual base::File::Error EnsureFileExists( 119 virtual base::File::Error EnsureFileExists(
126 FileSystemOperationContext* context, 120 FileSystemOperationContext* context,
127 const FileSystemURL& url, bool* created) OVERRIDE; 121 const FileSystemURL& url, bool* created) OVERRIDE;
128 virtual base::File::Error CreateDirectory( 122 virtual base::File::Error CreateDirectory(
129 FileSystemOperationContext* context, 123 FileSystemOperationContext* context,
130 const FileSystemURL& url, 124 const FileSystemURL& url,
131 bool exclusive, 125 bool exclusive,
132 bool recursive) OVERRIDE; 126 bool recursive) OVERRIDE;
133 virtual base::File::Error GetFileInfo( 127 virtual base::File::Error GetFileInfo(
134 FileSystemOperationContext* context, 128 FileSystemOperationContext* context,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 252
259 base::File::Error GetFileInfoInternal( 253 base::File::Error GetFileInfoInternal(
260 SandboxDirectoryDatabase* db, 254 SandboxDirectoryDatabase* db,
261 FileSystemOperationContext* context, 255 FileSystemOperationContext* context,
262 const FileSystemURL& url, 256 const FileSystemURL& url,
263 FileId file_id, 257 FileId file_id,
264 FileInfo* local_info, 258 FileInfo* local_info,
265 base::File::Info* file_info, 259 base::File::Info* file_info,
266 base::FilePath* platform_file_path); 260 base::FilePath* platform_file_path);
267 261
262 base::File::Error GetDbRootAndLocalPath(
263 FileSystemOperationContext* context,
264 const FileSystemURL& dest_url,
265 SandboxDirectoryDatabase** db,
266 base::FilePath* root,
267 base::FilePath* local_path);
268
269 // Updates |dest_file_info| and |db| at the end of creating a new file.
270 base::File::Error PostCreateFile(
271 const base::FilePath& root,
272 const base::FilePath& local_path,
273 FileInfo* dest_file_info,
274 SandboxDirectoryDatabase* db);
kinuko 2014/05/12 05:39:57 nit: could we move these methods declarations/defi
rvargas (doing something else) 2014/05/12 23:39:59 Done.
275
268 // Creates a new file, both the underlying backing file and the entry in the 276 // Creates a new file, both the underlying backing file and the entry in the
269 // database. |dest_file_info| is an in-out parameter. Supply the name and 277 // database. |dest_file_info| is an in-out parameter. Supply the name and
270 // parent_id; data_path is ignored. On success, data_path will 278 // parent_id; data_path is ignored. On success, data_path will
271 // always be set to the relative path [from the root of the type-specific 279 // always be set to the relative path [from the root of the type-specific
272 // filesystem directory] of a NEW backing file, and handle, if supplied, will 280 // filesystem directory] of a NEW backing file. Returns the new file.
273 // hold open PlatformFile for the backing file, which the caller is 281 base::File CreateAndOpenFile(
274 // responsible for closing. If you supply a path in |source_path|, it will be 282 FileSystemOperationContext* context,
275 // used as a source from which to COPY data. 283 const FileSystemURL& dest_url,
276 // Caveat: do not supply handle if you're also supplying a data path. It was 284 FileInfo* dest_file_info,
277 // easier not to support this, and no code has needed it so far, so it will 285 int file_flags);
278 // DCHECK and handle will hold base::kInvalidPlatformFileValue. 286
287 // The same as CreateAndOpenFile except that a file is not returned and if a
288 // path is provided in |source_path|, it will be used as a source from which
289 // to COPY data.
279 base::File::Error CreateFile( 290 base::File::Error CreateFile(
280 FileSystemOperationContext* context, 291 FileSystemOperationContext* context,
281 const base::FilePath& source_file_path, 292 const base::FilePath& source_file_path,
282 const FileSystemURL& dest_url, 293 const FileSystemURL& dest_url,
283 FileInfo* dest_file_info, 294 FileInfo* dest_file_info);
284 int file_flags,
285 base::PlatformFile* handle);
286 295
287 // This converts from a relative path [as is stored in the FileInfo.data_path 296 // This converts from a relative path [as is stored in the FileInfo.data_path
288 // field] to an absolute platform path that can be given to the native 297 // field] to an absolute platform path that can be given to the native
289 // filesystem. 298 // filesystem.
290 base::FilePath DataPathToLocalPath( 299 base::FilePath DataPathToLocalPath(
291 const FileSystemURL& url, 300 const FileSystemURL& url,
292 const base::FilePath& data_file_path); 301 const base::FilePath& data_file_path);
293 302
294 std::string GetDirectoryDatabaseKey(const GURL& origin, 303 std::string GetDirectoryDatabaseKey(const GURL& origin,
295 const std::string& type_string); 304 const std::string& type_string);
(...skipping 20 matching lines...) Expand all
316 // Initializes the origin database. |origin_hint| may be used as a hint 325 // Initializes the origin database. |origin_hint| may be used as a hint
317 // for initializing database if it's not empty. 326 // for initializing database if it's not empty.
318 bool InitOriginDatabase(const GURL& origin_hint, bool create); 327 bool InitOriginDatabase(const GURL& origin_hint, bool create);
319 328
320 base::File::Error GenerateNewLocalPath( 329 base::File::Error GenerateNewLocalPath(
321 SandboxDirectoryDatabase* db, 330 SandboxDirectoryDatabase* db,
322 FileSystemOperationContext* context, 331 FileSystemOperationContext* context,
323 const FileSystemURL& url, 332 const FileSystemURL& url,
324 base::FilePath* local_path); 333 base::FilePath* local_path);
325 334
326 base::File::Error CreateOrOpenInternal( 335 base::File CreateOrOpenInternal(
327 FileSystemOperationContext* context, 336 FileSystemOperationContext* context,
328 const FileSystemURL& url, 337 const FileSystemURL& url,
329 int file_flags, 338 int file_flags);
330 base::PlatformFile* file_handle,
331 bool* created);
332 339
333 bool HasIsolatedStorage(const GURL& origin); 340 bool HasIsolatedStorage(const GURL& origin);
334 341
335 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap; 342 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap;
336 DirectoryMap directories_; 343 DirectoryMap directories_;
337 scoped_ptr<SandboxOriginDatabaseInterface> origin_database_; 344 scoped_ptr<SandboxOriginDatabaseInterface> origin_database_;
338 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 345 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
339 base::FilePath file_system_directory_; 346 base::FilePath file_system_directory_;
340 leveldb::Env* env_override_; 347 leveldb::Env* env_override_;
341 348
342 // Used to delete database after a certain period of inactivity. 349 // Used to delete database after a certain period of inactivity.
343 int64 db_flush_delay_seconds_; 350 int64 db_flush_delay_seconds_;
344 351
345 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 352 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
346 scoped_ptr<TimedTaskHelper> timer_; 353 scoped_ptr<TimedTaskHelper> timer_;
347 354
348 GetTypeStringForURLCallback get_type_string_for_url_; 355 GetTypeStringForURLCallback get_type_string_for_url_;
349 std::set<std::string> known_type_strings_; 356 std::set<std::string> known_type_strings_;
350 357
351 // Not owned. 358 // Not owned.
352 SandboxFileSystemBackendDelegate* sandbox_delegate_; 359 SandboxFileSystemBackendDelegate* sandbox_delegate_;
353 360
354 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); 361 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
355 }; 362 };
356 363
357 } // namespace fileapi 364 } // namespace fileapi
358 365
359 #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 366 #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698