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

Side by Side Diff: webkit/fileapi/sandbox_mount_point_provider.h

Issue 9016020: Cleanup FileSystemOperation for preparing for adding FSO-factory method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years 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) 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_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>
(...skipping 19 matching lines...) Expand all
30 30
31 // An interface to construct or crack sandboxed filesystem paths for 31 // An interface to construct or crack sandboxed filesystem paths for
32 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's 32 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's
33 // profile directory in a sandboxed way. 33 // profile directory in a sandboxed way.
34 // This interface also lets one enumerate and remove storage for the origins 34 // This interface also lets one enumerate and remove storage for the origins
35 // that use the filesystem. 35 // that use the filesystem.
36 class SandboxMountPointProvider 36 class SandboxMountPointProvider
37 : public FileSystemMountPointProvider, 37 : public FileSystemMountPointProvider,
38 public FileSystemQuotaUtil { 38 public FileSystemQuotaUtil {
39 public: 39 public:
40 typedef FileSystemMountPointProvider::GetRootPathCallback GetRootPathCallback; 40 typedef FileSystemMountPointProvider::ValidateFileSystemCallback
41 ValidateFileSystemCallback;
41 42
42 // Origin enumerator interface. 43 // Origin enumerator interface.
43 // An instance of this interface is assumed to be called on the file thread. 44 // An instance of this interface is assumed to be called on the file thread.
44 class OriginEnumerator { 45 class OriginEnumerator {
45 public: 46 public:
46 virtual ~OriginEnumerator() {} 47 virtual ~OriginEnumerator() {}
47 48
48 // Returns the next origin. Returns empty if there are no more origins. 49 // Returns the next origin. Returns empty if there are no more origins.
49 virtual GURL Next() = 0; 50 virtual GURL Next() = 0;
50 51
51 // Returns the current origin's information. 52 // Returns the current origin's information.
52 virtual bool HasFileSystemType(FileSystemType type) const = 0; 53 virtual bool HasFileSystemType(FileSystemType type) const = 0;
53 }; 54 };
54 55
55 // The legacy [pre-obfuscation] FileSystem directory name, kept around for 56 // The legacy [pre-obfuscation] FileSystem directory name, kept around for
56 // migration and migration testing. 57 // migration and migration testing.
57 static const FilePath::CharType kOldFileSystemDirectory[]; 58 static const FilePath::CharType kOldFileSystemDirectory[];
58 // The FileSystem directory name. 59 // The FileSystem directory name.
59 static const FilePath::CharType kNewFileSystemDirectory[]; 60 static const FilePath::CharType kNewFileSystemDirectory[];
60 // Where we move the old filesystem directory if migration fails. 61 // Where we move the old filesystem directory if migration fails.
61 static const FilePath::CharType kRenamedOldFileSystemDirectory[]; 62 static const FilePath::CharType kRenamedOldFileSystemDirectory[];
62 63
63 SandboxMountPointProvider( 64 SandboxMountPointProvider(
64 scoped_refptr<base::MessageLoopProxy> file_message_loop, 65 scoped_refptr<base::MessageLoopProxy> file_message_loop,
65 const FilePath& profile_path, 66 const FilePath& profile_path,
66 FileSystemOptions* file_system_options); 67 FileSystemOptions* file_system_options);
67 virtual ~SandboxMountPointProvider(); 68 virtual ~SandboxMountPointProvider();
68 69
69 // FileSystemMountPointProvider overrides. 70 // FileSystemMountPointProvider overrides.
71 virtual void ValidateFileSystemRoot(
72 const GURL& origin_url,
73 FileSystemType type,
74 bool create,
75 const ValidateFileSystemCallback& callback) OVERRIDE;
76 virtual FilePath GetFileSystemRootPathOnFileThread(
77 const GURL& origin_url,
78 FileSystemType type,
79 const FilePath& virtual_path,
80 bool create) OVERRIDE;
70 virtual bool IsAccessAllowed( 81 virtual bool IsAccessAllowed(
71 const GURL& origin_url, 82 const GURL& origin_url,
72 FileSystemType type, 83 FileSystemType type,
73 const FilePath& virtual_path) OVERRIDE; 84 const FilePath& virtual_path) OVERRIDE;
74 virtual void ValidateFileSystemRootAndGetURL(
75 const GURL& origin_url,
76 FileSystemType type,
77 bool create,
78 const GetRootPathCallback& callback) OVERRIDE;
79 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread(
80 const GURL& origin_url,
81 FileSystemType type,
82 const FilePath& unused,
83 bool create) OVERRIDE;
84 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; 85 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
85 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; 86 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE;
86 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE; 87 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE;
87 88
88 FilePath old_base_path() const; 89 FilePath old_base_path() const;
89 FilePath new_base_path() const; 90 FilePath new_base_path() const;
90 FilePath renamed_old_base_path() const; 91 FilePath renamed_old_base_path() const;
91 92
92 // Returns an origin enumerator of this provider. 93 // Returns an origin enumerator of this provider.
93 // This method can only be called on the file thread. 94 // This method can only be called on the file thread.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const GURL& origin_url, 149 const GURL& origin_url,
149 FileSystemType type) const; 150 FileSystemType type) const;
150 151
151 FilePath OldCreateFileSystemRootPath( 152 FilePath OldCreateFileSystemRootPath(
152 const GURL& origin_url, FileSystemType type); 153 const GURL& origin_url, FileSystemType type);
153 154
154 // Returns true if the given |url|'s scheme is allowed to access 155 // Returns true if the given |url|'s scheme is allowed to access
155 // filesystem. 156 // filesystem.
156 bool IsAllowedScheme(const GURL& url) const; 157 bool IsAllowedScheme(const GURL& url) const;
157 158
158 class GetFileSystemRootPathTask;
159
160 friend class FileSystemTestOriginHelper; 159 friend class FileSystemTestOriginHelper;
161 friend class SandboxMountPointProviderMigrationTest; 160 friend class SandboxMountPointProviderMigrationTest;
162 friend class SandboxMountPointProviderOriginEnumeratorTest; 161 friend class SandboxMountPointProviderOriginEnumeratorTest;
163 162
164 scoped_refptr<base::MessageLoopProxy> file_message_loop_; 163 scoped_refptr<base::MessageLoopProxy> file_message_loop_;
165 164
166 const FilePath profile_path_; 165 const FilePath profile_path_;
167 166
168 scoped_ptr<FileSystemOptions> file_system_options_; 167 scoped_ptr<FileSystemOptions> file_system_options_;
169 168
170 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_; 169 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_;
171 170
172 // Acccessed only on the file thread. 171 // Acccessed only on the file thread.
173 std::set<GURL> visited_origins_; 172 std::set<GURL> visited_origins_;
174 173
175 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); 174 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider);
176 }; 175 };
177 176
178 } // namespace fileapi 177 } // namespace fileapi
179 178
180 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ 179 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698