| 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 #include "webkit/fileapi/obfuscated_file_util.h" | 5 #include "webkit/fileapi/obfuscated_file_util.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 FilePath base_path_; | 264 FilePath base_path_; |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 ObfuscatedFileUtil::ObfuscatedFileUtil( | 267 ObfuscatedFileUtil::ObfuscatedFileUtil( |
| 268 const FilePath& file_system_directory, | 268 const FilePath& file_system_directory, |
| 269 FileSystemFileUtil* underlying_file_util) | 269 FileSystemFileUtil* underlying_file_util) |
| 270 : FileSystemFileUtil(underlying_file_util), | 270 : FileSystemFileUtil(underlying_file_util), |
| 271 file_system_directory_(file_system_directory) { | 271 file_system_directory_(file_system_directory) { |
| 272 } | 272 } |
| 273 | 273 |
| 274 ObfuscatedFileUtil::~ObfuscatedFileUtil() { | |
| 275 DropDatabases(); | |
| 276 } | |
| 277 | |
| 278 PlatformFileError ObfuscatedFileUtil::CreateOrOpen( | 274 PlatformFileError ObfuscatedFileUtil::CreateOrOpen( |
| 279 FileSystemOperationContext* context, | 275 FileSystemOperationContext* context, |
| 280 const FileSystemPath& virtual_path, int file_flags, | 276 const FileSystemPath& virtual_path, int file_flags, |
| 281 PlatformFile* file_handle, bool* created) { | 277 PlatformFile* file_handle, bool* created) { |
| 282 DCHECK(!(file_flags & (base::PLATFORM_FILE_DELETE_ON_CLOSE | | 278 DCHECK(!(file_flags & (base::PLATFORM_FILE_DELETE_ON_CLOSE | |
| 283 base::PLATFORM_FILE_HIDDEN | base::PLATFORM_FILE_EXCLUSIVE_READ | | 279 base::PLATFORM_FILE_HIDDEN | base::PLATFORM_FILE_EXCLUSIVE_READ | |
| 284 base::PLATFORM_FILE_EXCLUSIVE_WRITE))); | 280 base::PLATFORM_FILE_EXCLUSIVE_WRITE))); |
| 285 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( | 281 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( |
| 286 virtual_path.origin(), virtual_path.type(), true); | 282 virtual_path.origin(), virtual_path.type(), true); |
| 287 if (!db) | 283 if (!db) |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 if (!file_util::DirectoryExists(path)) | 995 if (!file_util::DirectoryExists(path)) |
| 1000 return true; | 996 return true; |
| 1001 return FileSystemDirectoryDatabase::DestroyDatabase(path); | 997 return FileSystemDirectoryDatabase::DestroyDatabase(path); |
| 1002 } | 998 } |
| 1003 | 999 |
| 1004 // static | 1000 // static |
| 1005 int64 ObfuscatedFileUtil::ComputeFilePathCost(const FilePath& path) { | 1001 int64 ObfuscatedFileUtil::ComputeFilePathCost(const FilePath& path) { |
| 1006 return UsageForPath(VirtualPath::BaseName(path).value().size()); | 1002 return UsageForPath(VirtualPath::BaseName(path).value().size()); |
| 1007 } | 1003 } |
| 1008 | 1004 |
| 1005 ObfuscatedFileUtil::~ObfuscatedFileUtil() { |
| 1006 DropDatabases(); |
| 1007 } |
| 1008 |
| 1009 PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( | 1009 PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( |
| 1010 FileSystemDirectoryDatabase* db, | 1010 FileSystemDirectoryDatabase* db, |
| 1011 FileSystemOperationContext* context, | 1011 FileSystemOperationContext* context, |
| 1012 const GURL& origin, | 1012 const GURL& origin, |
| 1013 FileSystemType type, | 1013 FileSystemType type, |
| 1014 FileId file_id, | 1014 FileId file_id, |
| 1015 FileInfo* local_info, | 1015 FileInfo* local_info, |
| 1016 base::PlatformFileInfo* file_info, | 1016 base::PlatformFileInfo* file_info, |
| 1017 FilePath* platform_file_path) { | 1017 FilePath* platform_file_path) { |
| 1018 DCHECK(db); | 1018 DCHECK(db); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 file_system_directory_.value(); | 1264 file_system_directory_.value(); |
| 1265 return false; | 1265 return false; |
| 1266 } | 1266 } |
| 1267 origin_database_.reset( | 1267 origin_database_.reset( |
| 1268 new FileSystemOriginDatabase(file_system_directory_)); | 1268 new FileSystemOriginDatabase(file_system_directory_)); |
| 1269 } | 1269 } |
| 1270 return true; | 1270 return true; |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 } // namespace fileapi | 1273 } // namespace fileapi |
| OLD | NEW |