| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "webkit/browser/fileapi/file_system_backend.h" | 20 #include "webkit/browser/fileapi/file_system_backend.h" |
| 21 #include "webkit/browser/fileapi/file_system_options.h" | 21 #include "webkit/browser/fileapi/file_system_options.h" |
| 22 #include "webkit/browser/fileapi/file_system_quota_util.h" | 22 #include "webkit/browser/fileapi/file_system_quota_util.h" |
| 23 #include "webkit/browser/webkit_storage_browser_export.h" | 23 #include "webkit/browser/webkit_storage_browser_export.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { |
| 30 class SandboxFileSystemBackendDelegateTest; |
| 31 class SandboxFileSystemTestHelper; |
| 32 } |
| 33 |
| 29 namespace quota { | 34 namespace quota { |
| 30 class QuotaManagerProxy; | 35 class QuotaManagerProxy; |
| 31 class SpecialStoragePolicy; | 36 class SpecialStoragePolicy; |
| 32 } | 37 } |
| 33 | 38 |
| 34 namespace webkit_blob { | 39 namespace webkit_blob { |
| 35 class FileStreamReader; | 40 class FileStreamReader; |
| 36 } | 41 } |
| 37 | 42 |
| 38 namespace fileapi { | 43 namespace fileapi { |
| 39 | 44 |
| 40 class AsyncFileUtil; | 45 class AsyncFileUtil; |
| 41 class FileStreamWriter; | 46 class FileStreamWriter; |
| 42 class FileSystemFileUtil; | 47 class FileSystemFileUtil; |
| 43 class FileSystemOperationContext; | 48 class FileSystemOperationContext; |
| 44 class FileSystemURL; | 49 class FileSystemURL; |
| 45 class FileSystemUsageCache; | 50 class FileSystemUsageCache; |
| 46 class ObfuscatedFileUtil; | 51 class ObfuscatedFileUtil; |
| 47 class QuotaReservationManager; | 52 class QuotaReservationManager; |
| 48 class SandboxFileSystemBackend; | 53 class SandboxFileSystemBackend; |
| 49 class SandboxFileSystemTestHelper; | |
| 50 class SandboxQuotaObserver; | 54 class SandboxQuotaObserver; |
| 51 | 55 |
| 52 // Delegate implementation of the some methods in Sandbox/SyncFileSystemBackend. | 56 // Delegate implementation of the some methods in Sandbox/SyncFileSystemBackend. |
| 53 // An instance of this class is created and owned by FileSystemContext. | 57 // An instance of this class is created and owned by FileSystemContext. |
| 54 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxFileSystemBackendDelegate | 58 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxFileSystemBackendDelegate |
| 55 : public FileSystemQuotaUtil { | 59 : public FileSystemQuotaUtil { |
| 56 public: | 60 public: |
| 57 typedef FileSystemBackend::OpenFileSystemCallback OpenFileSystemCallback; | 61 typedef FileSystemBackend::OpenFileSystemCallback OpenFileSystemCallback; |
| 58 | 62 |
| 59 // The FileSystem directory name. | 63 // The FileSystem directory name. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return special_storage_policy_.get(); | 187 return special_storage_policy_.get(); |
| 184 } | 188 } |
| 185 | 189 |
| 186 const FileSystemOptions& file_system_options() const { | 190 const FileSystemOptions& file_system_options() const { |
| 187 return file_system_options_; | 191 return file_system_options_; |
| 188 } | 192 } |
| 189 | 193 |
| 190 FileSystemFileUtil* sync_file_util(); | 194 FileSystemFileUtil* sync_file_util(); |
| 191 | 195 |
| 192 private: | 196 private: |
| 197 friend class QuotaBackendImpl; |
| 193 friend class SandboxQuotaObserver; | 198 friend class SandboxQuotaObserver; |
| 194 friend class SandboxFileSystemTestHelper; | 199 friend class content::SandboxFileSystemBackendDelegateTest; |
| 195 friend class QuotaBackendImpl; | 200 friend class content::SandboxFileSystemTestHelper; |
| 196 FRIEND_TEST_ALL_PREFIXES(SandboxFileSystemBackendDelegateTest, IsAccessValid); | |
| 197 | 201 |
| 198 // Performs API-specific validity checks on the given path |url|. | 202 // Performs API-specific validity checks on the given path |url|. |
| 199 // Returns true if access to |url| is valid in this filesystem. | 203 // Returns true if access to |url| is valid in this filesystem. |
| 200 bool IsAccessValid(const FileSystemURL& url) const; | 204 bool IsAccessValid(const FileSystemURL& url) const; |
| 201 | 205 |
| 202 // Returns true if the given |url|'s scheme is allowed to access | 206 // Returns true if the given |url|'s scheme is allowed to access |
| 203 // filesystem. | 207 // filesystem. |
| 204 bool IsAllowedScheme(const GURL& url) const; | 208 bool IsAllowedScheme(const GURL& url) const; |
| 205 | 209 |
| 206 // Returns a path to the usage cache file. | 210 // Returns a path to the usage cache file. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 base::Time next_release_time_for_open_filesystem_stat_; | 251 base::Time next_release_time_for_open_filesystem_stat_; |
| 248 | 252 |
| 249 base::WeakPtrFactory<SandboxFileSystemBackendDelegate> weak_factory_; | 253 base::WeakPtrFactory<SandboxFileSystemBackendDelegate> weak_factory_; |
| 250 | 254 |
| 251 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackendDelegate); | 255 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackendDelegate); |
| 252 }; | 256 }; |
| 253 | 257 |
| 254 } // namespace fileapi | 258 } // namespace fileapi |
| 255 | 259 |
| 256 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ | 260 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ |
| OLD | NEW |