| 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 #ifndef WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
| 6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 15 #include "webkit/fileapi/file_system_mount_point_provider.h" | 16 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 16 #include "webkit/fileapi/file_system_options.h" | 17 #include "webkit/fileapi/file_system_options.h" |
| 17 #include "webkit/fileapi/file_system_quota_util.h" | 18 #include "webkit/fileapi/file_system_quota_util.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace quota { | 24 namespace quota { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 virtual void StartUpdateOriginOnFileThread( | 149 virtual void StartUpdateOriginOnFileThread( |
| 149 const GURL& origin_url, | 150 const GURL& origin_url, |
| 150 FileSystemType type) OVERRIDE; | 151 FileSystemType type) OVERRIDE; |
| 151 virtual void EndUpdateOriginOnFileThread( | 152 virtual void EndUpdateOriginOnFileThread( |
| 152 const GURL& origin_url, | 153 const GURL& origin_url, |
| 153 FileSystemType type) OVERRIDE; | 154 FileSystemType type) OVERRIDE; |
| 154 virtual void InvalidateUsageCache(const GURL& origin_url, | 155 virtual void InvalidateUsageCache(const GURL& origin_url, |
| 155 FileSystemType type) OVERRIDE; | 156 FileSystemType type) OVERRIDE; |
| 156 | 157 |
| 157 FileSystemQuotaUtil* quota_util() { return this; } | 158 FileSystemQuotaUtil* quota_util() { return this; } |
| 159 void CollectOpenFileSystemMetrics(base::PlatformFileError error_code); |
| 158 | 160 |
| 159 private: | 161 private: |
| 160 // Returns a path to the usage cache file. | 162 // Returns a path to the usage cache file. |
| 161 FilePath GetUsageCachePathForOriginAndType( | 163 FilePath GetUsageCachePathForOriginAndType( |
| 162 const GURL& origin_url, | 164 const GURL& origin_url, |
| 163 FileSystemType type) const; | 165 FileSystemType type) const; |
| 164 | 166 |
| 165 FilePath OldCreateFileSystemRootPath( | 167 FilePath OldCreateFileSystemRootPath( |
| 166 const GURL& origin_url, FileSystemType type); | 168 const GURL& origin_url, FileSystemType type); |
| 167 | 169 |
| 168 // Returns true if the given |url|'s scheme is allowed to access | 170 // Returns true if the given |url|'s scheme is allowed to access |
| 169 // filesystem. | 171 // filesystem. |
| 170 bool IsAllowedScheme(const GURL& url) const; | 172 bool IsAllowedScheme(const GURL& url) const; |
| 171 | 173 |
| 172 friend class FileSystemTestOriginHelper; | 174 friend class FileSystemTestOriginHelper; |
| 173 friend class SandboxMountPointProviderMigrationTest; | 175 friend class SandboxMountPointProviderMigrationTest; |
| 174 friend class SandboxMountPointProviderOriginEnumeratorTest; | 176 friend class SandboxMountPointProviderOriginEnumeratorTest; |
| 175 | 177 |
| 176 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 178 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 177 | 179 |
| 178 const FilePath profile_path_; | 180 const FilePath profile_path_; |
| 179 | 181 |
| 180 FileSystemOptions file_system_options_; | 182 FileSystemOptions file_system_options_; |
| 181 | 183 |
| 182 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_; | 184 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_; |
| 183 | 185 |
| 184 // Acccessed only on the file thread. | 186 // Acccessed only on the file thread. |
| 185 std::set<GURL> visited_origins_; | 187 std::set<GURL> visited_origins_; |
| 186 | 188 |
| 189 base::Time next_release_time_for_open_filesystem_stat_; |
| 190 |
| 191 base::WeakPtrFactory<SandboxMountPointProvider> weak_factory_; |
| 192 |
| 187 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); | 193 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); |
| 188 }; | 194 }; |
| 189 | 195 |
| 190 } // namespace fileapi | 196 } // namespace fileapi |
| 191 | 197 |
| 192 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 198 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
| OLD | NEW |