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_CONTEXT_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
(...skipping 15 matching lines...) Expand all Loading... |
32 | 32 |
33 class AsyncFileUtil; | 33 class AsyncFileUtil; |
34 class FileSystemFileUtil; | 34 class FileSystemFileUtil; |
35 class FileSystemURL; | 35 class FileSystemURL; |
36 class FileSystemUsageCache; | 36 class FileSystemUsageCache; |
37 class ObfuscatedFileUtil; | 37 class ObfuscatedFileUtil; |
38 class SandboxFileSystemBackend; | 38 class SandboxFileSystemBackend; |
39 class SandboxFileSystemTestHelper; | 39 class SandboxFileSystemTestHelper; |
40 class SandboxQuotaObserver; | 40 class SandboxQuotaObserver; |
41 | 41 |
42 // This class keeps and provides a sandbox file system context. | 42 // Delegate implementation of the some methods in Sandbox/SyncFileSystemBackend. |
43 // An instance of this class is created and owned by FileSystemContext. | 43 // An instance of this class is created and owned by FileSystemContext. |
44 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxContext { | 44 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxFileSystemBackendDelegate { |
45 public: | 45 public: |
46 typedef FileSystemBackend::OpenFileSystemCallback OpenFileSystemCallback; | 46 typedef FileSystemBackend::OpenFileSystemCallback OpenFileSystemCallback; |
47 | 47 |
48 // The FileSystem directory name. | 48 // The FileSystem directory name. |
49 static const base::FilePath::CharType kFileSystemDirectory[]; | 49 static const base::FilePath::CharType kFileSystemDirectory[]; |
50 | 50 |
51 // Origin enumerator interface. | 51 // Origin enumerator interface. |
52 // An instance of this interface is assumed to be called on the file thread. | 52 // An instance of this interface is assumed to be called on the file thread. |
53 class OriginEnumerator { | 53 class OriginEnumerator { |
54 public: | 54 public: |
55 virtual ~OriginEnumerator() {} | 55 virtual ~OriginEnumerator() {} |
56 | 56 |
57 // Returns the next origin. Returns empty if there are no more origins. | 57 // Returns the next origin. Returns empty if there are no more origins. |
58 virtual GURL Next() = 0; | 58 virtual GURL Next() = 0; |
59 | 59 |
60 // Returns the current origin's information. | 60 // Returns the current origin's information. |
61 virtual bool HasFileSystemType(FileSystemType type) const = 0; | 61 virtual bool HasFileSystemType(FileSystemType type) const = 0; |
62 }; | 62 }; |
63 | 63 |
64 SandboxContext( | 64 SandboxFileSystemBackendDelegate( |
65 quota::QuotaManagerProxy* quota_manager_proxy, | 65 quota::QuotaManagerProxy* quota_manager_proxy, |
66 base::SequencedTaskRunner* file_task_runner, | 66 base::SequencedTaskRunner* file_task_runner, |
67 const base::FilePath& profile_path, | 67 const base::FilePath& profile_path, |
68 quota::SpecialStoragePolicy* special_storage_policy, | 68 quota::SpecialStoragePolicy* special_storage_policy, |
69 const FileSystemOptions& file_system_options); | 69 const FileSystemOptions& file_system_options); |
70 | 70 |
71 ~SandboxContext(); | 71 ~SandboxFileSystemBackendDelegate(); |
72 | 72 |
73 // Performs API-specific validity checks on the given path |url|. | 73 // Performs API-specific validity checks on the given path |url|. |
74 // Returns true if access to |url| is valid in this filesystem. | 74 // Returns true if access to |url| is valid in this filesystem. |
75 bool IsAccessValid(const FileSystemURL& url) const; | 75 bool IsAccessValid(const FileSystemURL& url) const; |
76 | 76 |
77 // Returns true if the given |url|'s scheme is allowed to access | 77 // Returns true if the given |url|'s scheme is allowed to access |
78 // filesystem. | 78 // filesystem. |
79 bool IsAllowedScheme(const GURL& url) const; | 79 bool IsAllowedScheme(const GURL& url) const; |
80 | 80 |
81 // Returns an origin enumerator of sandbox filesystem. | 81 // Returns an origin enumerator of sandbox filesystem. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 FileSystemOptions file_system_options_; | 178 FileSystemOptions file_system_options_; |
179 | 179 |
180 // Acccessed only on the file thread. | 180 // Acccessed only on the file thread. |
181 std::set<GURL> visited_origins_; | 181 std::set<GURL> visited_origins_; |
182 | 182 |
183 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_; | 183 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_; |
184 | 184 |
185 base::Time next_release_time_for_open_filesystem_stat_; | 185 base::Time next_release_time_for_open_filesystem_stat_; |
186 | 186 |
187 base::WeakPtrFactory<SandboxContext> weak_factory_; | 187 base::WeakPtrFactory<SandboxFileSystemBackendDelegate> weak_factory_; |
188 | 188 |
189 DISALLOW_COPY_AND_ASSIGN(SandboxContext); | 189 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackendDelegate); |
190 }; | 190 }; |
191 | 191 |
192 } // namespace fileapi | 192 } // namespace fileapi |
193 | 193 |
194 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_ | 194 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ |
OLD | NEW |