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

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

Issue 7057032: Integrated obfuscation with quota; all unit tests now pass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Eliminated a vector copy Created 9 years, 7 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
« no previous file with comments | « webkit/fileapi/file_system_util.cc ('k') | webkit/fileapi/obfuscated_file_system_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 virtual bool DirectoryExists( 116 virtual bool DirectoryExists(
117 FileSystemOperationContext* context, 117 FileSystemOperationContext* context,
118 const FilePath& file_path) OVERRIDE; 118 const FilePath& file_path) OVERRIDE;
119 119
120 virtual bool IsDirectoryEmpty( 120 virtual bool IsDirectoryEmpty(
121 FileSystemOperationContext* context, 121 FileSystemOperationContext* context,
122 const FilePath& file_path) OVERRIDE; 122 const FilePath& file_path) OVERRIDE;
123 123
124 // Gets the topmost directory specific to this origin and type. This will 124 // Gets the topmost directory specific to this origin and type. This will
125 // contain both the directory database's files and all the backing file 125 // contain both the directory database's files and all the backing file
126 // subdirectories. If we decide to migrate in-place, without moving old files 126 // subdirectories.
127 // that were created by LocalFileSystemFileUtil, not all backing files will
128 // actually be in this directory.
129 FilePath GetDirectoryForOriginAndType( 127 FilePath GetDirectoryForOriginAndType(
130 const GURL& origin, FileSystemType type, bool create); 128 const GURL& origin, FileSystemType type, bool create);
131 129
132 // Gets the topmost directory specific to this origin. This will 130 // Gets the topmost directory specific to this origin. This will
133 // contain both the filesystem type subdirectories. See previous comment 131 // contain both the filesystem type subdirectories.
134 // about migration; TODO(ericu): implement migration and fix these comments.
135 FilePath GetDirectoryForOrigin(const GURL& origin, bool create); 132 FilePath GetDirectoryForOrigin(const GURL& origin, bool create);
136 133
137 // This will migrate a filesystem from the old passthrough sandbox into the 134 // This will migrate a filesystem from the old passthrough sandbox into the
138 // new obfuscated one. It won't obfuscate the old filenames [it will maintain 135 // new obfuscated one. It won't obfuscate the old filenames [it will maintain
139 // the old structure, but move it to a new root], but any new files created 136 // the old structure, but move it to a new root], but any new files created
140 // will go into the new standard locations. This will be completely 137 // will go into the new standard locations. This will be completely
141 // transparent to the user. This migration is atomic in that it won't alter 138 // transparent to the user. This migration is atomic in that it won't alter
142 // the source data until it's done, and that will be with a single directory 139 // the source data until it's done, and that will be with a single directory
143 // move [the directory with the unguessable name will move into the new 140 // move [the directory with the unguessable name will move into the new
144 // filesystem storage directory]. However, if this fails partway through, it 141 // filesystem storage directory]. However, if this fails partway through, it
145 // might leave a seemingly-valid database for this origin. When it starts up, 142 // might leave a seemingly-valid database for this origin. When it starts up,
146 // it will clear any such database, just in case. 143 // it will clear any such database, just in case.
147 bool MigrateFromOldSandbox( 144 bool MigrateFromOldSandbox(
148 const GURL& origin, FileSystemType type, const FilePath& root); 145 const GURL& origin, FileSystemType type, const FilePath& root);
149 146
150 FilePath::StringType GetDirectoryNameForType(FileSystemType type) const; 147 // TODO(ericu): This doesn't really feel like it belongs in this class.
148 // The previous version lives in FileSystemPathManager, but perhaps
149 // SandboxMountPointProvider would be better?
150 static FilePath::StringType GetDirectoryNameForType(FileSystemType type);
151
152 // Origin enumerator interface.
153 // An instance of this interface is assumed to be called on the file thread.
154 class AbstractOriginEnumerator {
155 public:
156 virtual ~AbstractOriginEnumerator() {}
157
158 // Returns the next origin. Returns empty if there are no more origins.
159 virtual GURL Next() = 0;
160
161 // Returns the current origin's information.
162 virtual bool HasFileSystemType(FileSystemType type) const = 0;
163 };
164
165 // This method and all methods of its returned class must be called only on
166 // the FILE thread. The caller is responsible for deleting the returned
167 // object.
168 AbstractOriginEnumerator* CreateOriginEnumerator();
151 169
152 protected: 170 protected:
153 virtual AbstractFileEnumerator* CreateFileEnumerator( 171 virtual AbstractFileEnumerator* CreateFileEnumerator(
154 FileSystemOperationContext* context, 172 FileSystemOperationContext* context,
155 const FilePath& root_path) OVERRIDE; 173 const FilePath& root_path) OVERRIDE;
156 174
157 private: 175 private:
158 typedef FileSystemDirectoryDatabase::FileId FileId; 176 typedef FileSystemDirectoryDatabase::FileId FileId;
159 typedef FileSystemDirectoryDatabase::FileInfo FileInfo; 177 typedef FileSystemDirectoryDatabase::FileInfo FileInfo;
160 178
(...skipping 27 matching lines...) Expand all
188 FilePath DataPathToLocalPath( 206 FilePath DataPathToLocalPath(
189 const GURL& origin, FileSystemType type, const FilePath& data_path); 207 const GURL& origin, FileSystemType type, const FilePath& data_path);
190 // This does the reverse of DataPathToLocalPath. 208 // This does the reverse of DataPathToLocalPath.
191 FilePath LocalPathToDataPath( 209 FilePath LocalPathToDataPath(
192 const GURL& origin, FileSystemType type, const FilePath& local_path); 210 const GURL& origin, FileSystemType type, const FilePath& local_path);
193 FileSystemDirectoryDatabase* GetDirectoryDatabase( 211 FileSystemDirectoryDatabase* GetDirectoryDatabase(
194 const GURL& origin_url, FileSystemType type); 212 const GURL& origin_url, FileSystemType type);
195 void MarkUsed(); 213 void MarkUsed();
196 void DropDatabases(); 214 void DropDatabases();
197 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type); 215 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type);
216 bool InitOriginDatabase(bool create);
198 217
199 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; 218 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap;
200 DirectoryMap directories_; 219 DirectoryMap directories_;
201 scoped_ptr<FileSystemOriginDatabase> origin_database_; 220 scoped_ptr<FileSystemOriginDatabase> origin_database_;
202 FilePath file_system_directory_; 221 FilePath file_system_directory_;
203 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_; 222 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_;
204 223
205 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil); 224 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil);
206 }; 225 };
207 226
208 } // namespace fileapi 227 } // namespace fileapi
209 228
210 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 229 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_util.cc ('k') | webkit/fileapi/obfuscated_file_system_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698