| OLD | NEW |
| 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_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // DropDatabases needs to be called. References will be held by the | 40 // DropDatabases needs to be called. References will be held by the |
| 41 // SandboxMountPointProvider [and the task it uses to drop the reference] and | 41 // SandboxMountPointProvider [and the task it uses to drop the reference] and |
| 42 // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, | 42 // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, |
| 43 // we wouldn't need ref counting. | 43 // we wouldn't need ref counting. |
| 44 // | 44 // |
| 45 // TODO(ericu): We don't ever update directory mtimes; which operations should | 45 // TODO(ericu): We don't ever update directory mtimes; which operations should |
| 46 // do that? | 46 // do that? |
| 47 class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil, | 47 class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil, |
| 48 public base::RefCountedThreadSafe<ObfuscatedFileSystemFileUtil> { | 48 public base::RefCountedThreadSafe<ObfuscatedFileSystemFileUtil> { |
| 49 public: | 49 public: |
| 50 // |underlying_file_util| is not owned by the instance. It will need to be | 50 // |underlying_file_util| is owned by the instance. It will be deleted by |
| 51 // a singleton or to be deleted by someone else. | 51 // the owner instance. For example, it can be instanciated as follows: |
| 52 // FileSystemFileUtil* file_system_file_util = |
| 53 // new ObfuscatedFileSystemFileUtil(new FileSystemFileUtil()); |
| 52 ObfuscatedFileSystemFileUtil( | 54 ObfuscatedFileSystemFileUtil( |
| 53 const FilePath& file_system_directory, | 55 const FilePath& file_system_directory, |
| 54 FileSystemFileUtil* underlying_file_util); | 56 FileSystemFileUtil* underlying_file_util); |
| 55 virtual ~ObfuscatedFileSystemFileUtil(); | 57 virtual ~ObfuscatedFileSystemFileUtil(); |
| 56 | 58 |
| 57 virtual base::PlatformFileError CreateOrOpen( | 59 virtual base::PlatformFileError CreateOrOpen( |
| 58 FileSystemOperationContext* context, | 60 FileSystemOperationContext* context, |
| 59 const FilePath& file_path, | 61 const FilePath& file_path, |
| 60 int file_flags, | 62 int file_flags, |
| 61 base::PlatformFile* file_handle, | 63 base::PlatformFile* file_handle, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 FilePath GetDirectoryForOrigin(const GURL& origin, bool create); | 239 FilePath GetDirectoryForOrigin(const GURL& origin, bool create); |
| 238 void MarkUsed(); | 240 void MarkUsed(); |
| 239 void DropDatabases(); | 241 void DropDatabases(); |
| 240 bool InitOriginDatabase(bool create); | 242 bool InitOriginDatabase(bool create); |
| 241 | 243 |
| 242 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; | 244 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; |
| 243 DirectoryMap directories_; | 245 DirectoryMap directories_; |
| 244 scoped_ptr<FileSystemOriginDatabase> origin_database_; | 246 scoped_ptr<FileSystemOriginDatabase> origin_database_; |
| 245 FilePath file_system_directory_; | 247 FilePath file_system_directory_; |
| 246 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_; | 248 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_; |
| 247 FileSystemFileUtil* underlying_file_util_; | 249 scoped_ptr<FileSystemFileUtil> underlying_file_util_; |
| 248 | 250 |
| 249 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil); | 251 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil); |
| 250 }; | 252 }; |
| 251 | 253 |
| 252 } // namespace fileapi | 254 } // namespace fileapi |
| 253 | 255 |
| 254 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ | 256 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ |
| OLD | NEW |