Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: webkit/browser/fileapi/obfuscated_file_util.h

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
6 #define WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 6 #define WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 16 matching lines...) Expand all
27 namespace base { 27 namespace base {
28 class SequencedTaskRunner; 28 class SequencedTaskRunner;
29 class TimeTicks; 29 class TimeTicks;
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 class ObfuscatedFileUtilTest; 33 class ObfuscatedFileUtilTest;
34 class QuotaBackendImplTest; 34 class QuotaBackendImplTest;
35 } 35 }
36 36
37 namespace quota { 37 namespace storage {
38 class SpecialStoragePolicy; 38 class SpecialStoragePolicy;
39 } 39 }
40 40
41 class GURL; 41 class GURL;
42 42
43 namespace fileapi { 43 namespace storage {
44 44
45 class FileSystemOperationContext; 45 class FileSystemOperationContext;
46 class SandboxOriginDatabaseInterface; 46 class SandboxOriginDatabaseInterface;
47 class TimedTaskHelper; 47 class TimedTaskHelper;
48 48
49 // This file util stores directory information in LevelDB to obfuscate 49 // This file util stores directory information in LevelDB to obfuscate
50 // and to neutralize virtual file paths given by arbitrary apps. 50 // and to neutralize virtual file paths given by arbitrary apps.
51 // Files are stored with two-level isolation: per-origin and per-type. 51 // Files are stored with two-level isolation: per-origin and per-type.
52 // The isolation is done by storing data in separate directory partitions. 52 // The isolation is done by storing data in separate directory partitions.
53 // For example, a file in Temporary file system for origin 'www.example.com' 53 // For example, a file in Temporary file system for origin 'www.example.com'
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // to provide per-type isolation in the sandboxed filesystem directory. 94 // to provide per-type isolation in the sandboxed filesystem directory.
95 // Note that this method is called on file_task_runner. 95 // Note that this method is called on file_task_runner.
96 // 96 //
97 // |known_type_strings| are known type string names that this file system 97 // |known_type_strings| are known type string names that this file system
98 // should care about. 98 // should care about.
99 // This info is used to determine whether we could delete the entire 99 // This info is used to determine whether we could delete the entire
100 // origin directory or not in DeleteDirectoryForOriginAndType. If no directory 100 // origin directory or not in DeleteDirectoryForOriginAndType. If no directory
101 // for any known type exists the origin directory may get deleted when 101 // for any known type exists the origin directory may get deleted when
102 // one origin/type pair is deleted. 102 // one origin/type pair is deleted.
103 // 103 //
104 ObfuscatedFileUtil( 104 ObfuscatedFileUtil(storage::SpecialStoragePolicy* special_storage_policy,
105 quota::SpecialStoragePolicy* special_storage_policy, 105 const base::FilePath& file_system_directory,
106 const base::FilePath& file_system_directory, 106 leveldb::Env* env_override,
107 leveldb::Env* env_override, 107 base::SequencedTaskRunner* file_task_runner,
108 base::SequencedTaskRunner* file_task_runner, 108 const GetTypeStringForURLCallback& get_type_string_for_url,
109 const GetTypeStringForURLCallback& get_type_string_for_url, 109 const std::set<std::string>& known_type_strings,
110 const std::set<std::string>& known_type_strings, 110 SandboxFileSystemBackendDelegate* sandbox_delegate);
111 SandboxFileSystemBackendDelegate* sandbox_delegate);
112 virtual ~ObfuscatedFileUtil(); 111 virtual ~ObfuscatedFileUtil();
113 112
114 // FileSystemFileUtil overrides. 113 // FileSystemFileUtil overrides.
115 virtual base::File CreateOrOpen( 114 virtual base::File CreateOrOpen(
116 FileSystemOperationContext* context, 115 FileSystemOperationContext* context,
117 const FileSystemURL& url, 116 const FileSystemURL& url,
118 int file_flags) OVERRIDE; 117 int file_flags) OVERRIDE;
119 virtual base::File::Error EnsureFileExists( 118 virtual base::File::Error EnsureFileExists(
120 FileSystemOperationContext* context, 119 FileSystemOperationContext* context,
121 const FileSystemURL& url, bool* created) OVERRIDE; 120 const FileSystemURL& url, bool* created) OVERRIDE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 virtual base::File::Error CopyInForeignFile( 153 virtual base::File::Error CopyInForeignFile(
155 FileSystemOperationContext* context, 154 FileSystemOperationContext* context,
156 const base::FilePath& src_file_path, 155 const base::FilePath& src_file_path,
157 const FileSystemURL& dest_url) OVERRIDE; 156 const FileSystemURL& dest_url) OVERRIDE;
158 virtual base::File::Error DeleteFile( 157 virtual base::File::Error DeleteFile(
159 FileSystemOperationContext* context, 158 FileSystemOperationContext* context,
160 const FileSystemURL& url) OVERRIDE; 159 const FileSystemURL& url) OVERRIDE;
161 virtual base::File::Error DeleteDirectory( 160 virtual base::File::Error DeleteDirectory(
162 FileSystemOperationContext* context, 161 FileSystemOperationContext* context,
163 const FileSystemURL& url) OVERRIDE; 162 const FileSystemURL& url) OVERRIDE;
164 virtual webkit_blob::ScopedFile CreateSnapshotFile( 163 virtual storage::ScopedFile CreateSnapshotFile(
165 FileSystemOperationContext* context, 164 FileSystemOperationContext* context,
166 const FileSystemURL& url, 165 const FileSystemURL& url,
167 base::File::Error* error, 166 base::File::Error* error,
168 base::File::Info* file_info, 167 base::File::Info* file_info,
169 base::FilePath* platform_path) OVERRIDE; 168 base::FilePath* platform_path) OVERRIDE;
170 169
171 // Same as the other CreateFileEnumerator, but with recursive support. 170 // Same as the other CreateFileEnumerator, but with recursive support.
172 scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( 171 scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator(
173 FileSystemOperationContext* context, 172 FileSystemOperationContext* context,
174 const FileSystemURL& root_url, 173 const FileSystemURL& root_url,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 typedef SandboxDirectoryDatabase::FileInfo FileInfo; 229 typedef SandboxDirectoryDatabase::FileInfo FileInfo;
231 230
232 friend class ObfuscatedFileEnumerator; 231 friend class ObfuscatedFileEnumerator;
233 friend class content::ObfuscatedFileUtilTest; 232 friend class content::ObfuscatedFileUtilTest;
234 friend class content::QuotaBackendImplTest; 233 friend class content::QuotaBackendImplTest;
235 234
236 // Helper method to create an obfuscated file util for regular 235 // Helper method to create an obfuscated file util for regular
237 // (temporary, persistent) file systems. Used only for testing. 236 // (temporary, persistent) file systems. Used only for testing.
238 // Note: this is implemented in sandbox_file_system_backend_delegate.cc. 237 // Note: this is implemented in sandbox_file_system_backend_delegate.cc.
239 static ObfuscatedFileUtil* CreateForTesting( 238 static ObfuscatedFileUtil* CreateForTesting(
240 quota::SpecialStoragePolicy* special_storage_policy, 239 storage::SpecialStoragePolicy* special_storage_policy,
241 const base::FilePath& file_system_directory, 240 const base::FilePath& file_system_directory,
242 leveldb::Env* env_override, 241 leveldb::Env* env_override,
243 base::SequencedTaskRunner* file_task_runner); 242 base::SequencedTaskRunner* file_task_runner);
244 243
245 base::FilePath GetDirectoryForURL( 244 base::FilePath GetDirectoryForURL(
246 const FileSystemURL& url, 245 const FileSystemURL& url,
247 bool create, 246 bool create,
248 base::File::Error* error_code); 247 base::File::Error* error_code);
249 248
250 // This just calls get_type_string_for_url_ callback that is given in ctor. 249 // This just calls get_type_string_for_url_ callback that is given in ctor.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 base::File CreateOrOpenInternal( 328 base::File CreateOrOpenInternal(
330 FileSystemOperationContext* context, 329 FileSystemOperationContext* context,
331 const FileSystemURL& url, 330 const FileSystemURL& url,
332 int file_flags); 331 int file_flags);
333 332
334 bool HasIsolatedStorage(const GURL& origin); 333 bool HasIsolatedStorage(const GURL& origin);
335 334
336 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap; 335 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap;
337 DirectoryMap directories_; 336 DirectoryMap directories_;
338 scoped_ptr<SandboxOriginDatabaseInterface> origin_database_; 337 scoped_ptr<SandboxOriginDatabaseInterface> origin_database_;
339 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 338 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
340 base::FilePath file_system_directory_; 339 base::FilePath file_system_directory_;
341 leveldb::Env* env_override_; 340 leveldb::Env* env_override_;
342 341
343 // Used to delete database after a certain period of inactivity. 342 // Used to delete database after a certain period of inactivity.
344 int64 db_flush_delay_seconds_; 343 int64 db_flush_delay_seconds_;
345 344
346 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 345 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
347 scoped_ptr<TimedTaskHelper> timer_; 346 scoped_ptr<TimedTaskHelper> timer_;
348 347
349 GetTypeStringForURLCallback get_type_string_for_url_; 348 GetTypeStringForURLCallback get_type_string_for_url_;
350 std::set<std::string> known_type_strings_; 349 std::set<std::string> known_type_strings_;
351 350
352 // Not owned. 351 // Not owned.
353 SandboxFileSystemBackendDelegate* sandbox_delegate_; 352 SandboxFileSystemBackendDelegate* sandbox_delegate_;
354 353
355 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); 354 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
356 }; 355 };
357 356
358 } // namespace fileapi 357 } // namespace storage
359 358
360 #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 359 #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/native_file_util.cc ('k') | webkit/browser/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698