| 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_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Returns a FileSystemBackend instance for external filesystem | 147 // Returns a FileSystemBackend instance for external filesystem |
| 148 // type, which is used only by chromeos for now. This is equivalent to | 148 // type, which is used only by chromeos for now. This is equivalent to |
| 149 // calling GetFileSystemBackend(kFileSystemTypeExternal). | 149 // calling GetFileSystemBackend(kFileSystemTypeExternal). |
| 150 ExternalFileSystemBackend* external_backend() const; | 150 ExternalFileSystemBackend* external_backend() const; |
| 151 | 151 |
| 152 // Used for OpenFileSystem. | 152 // Used for OpenFileSystem. |
| 153 typedef base::Callback<void(base::PlatformFileError result, | 153 typedef base::Callback<void(base::PlatformFileError result, |
| 154 const std::string& name, | 154 const std::string& name, |
| 155 const GURL& root)> OpenFileSystemCallback; | 155 const GURL& root)> OpenFileSystemCallback; |
| 156 | 156 |
| 157 // Used for ResolveURL. |
| 158 typedef base::Callback<void(base::PlatformFileError result, |
| 159 const std::string& name, |
| 160 const GURL& root, |
| 161 const base::FilePath& file_path, |
| 162 bool is_directory)> ResolveURLCallback; |
| 163 |
| 157 // Used for DeleteFileSystem. | 164 // Used for DeleteFileSystem. |
| 158 typedef base::Callback<void(base::PlatformFileError result)> | 165 typedef base::Callback<void(base::PlatformFileError result)> |
| 159 DeleteFileSystemCallback; | 166 DeleteFileSystemCallback; |
| 160 | 167 |
| 161 // Opens the filesystem for the given |origin_url| and |type|, and dispatches | 168 // Opens the filesystem for the given |origin_url| and |type|, and dispatches |
| 162 // |callback| on completion. | 169 // |callback| on completion. |
| 163 // If |create| is true this may actually set up a filesystem instance | 170 // If |create| is true this may actually set up a filesystem instance |
| 164 // (e.g. by creating the root directory or initializing the database | 171 // (e.g. by creating the root directory or initializing the database |
| 165 // entry etc). | 172 // entry etc). |
| 166 void OpenFileSystem( | 173 void OpenFileSystem( |
| 167 const GURL& origin_url, | 174 const GURL& origin_url, |
| 168 FileSystemType type, | 175 FileSystemType type, |
| 169 OpenFileSystemMode mode, | 176 OpenFileSystemMode mode, |
| 170 const OpenFileSystemCallback& callback); | 177 const OpenFileSystemCallback& callback); |
| 171 | 178 |
| 179 // TODO(nhiroki): writing a comment. |
| 180 void ResolveURL( |
| 181 const GURL& filesystem_url, |
| 182 const ResolveURLCallback& callback); |
| 183 |
| 172 // Deletes the filesystem for the given |origin_url| and |type|. This should | 184 // Deletes the filesystem for the given |origin_url| and |type|. This should |
| 173 // be called on the IO Thread. | 185 // be called on the IO Thread. |
| 174 void DeleteFileSystem( | 186 void DeleteFileSystem( |
| 175 const GURL& origin_url, | 187 const GURL& origin_url, |
| 176 FileSystemType type, | 188 FileSystemType type, |
| 177 const DeleteFileSystemCallback& callback); | 189 const DeleteFileSystemCallback& callback); |
| 178 | 190 |
| 179 // Creates new FileStreamReader instance to read a file pointed by the given | 191 // Creates new FileStreamReader instance to read a file pointed by the given |
| 180 // filesystem URL |url| starting from |offset|. |expected_modification_time| | 192 // filesystem URL |url| starting from |offset|. |expected_modification_time| |
| 181 // specifies the expected last modification if the value is non-null, the | 193 // specifies the expected last modification if the value is non-null, the |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // FileSystemURL. | 275 // FileSystemURL. |
| 264 // | 276 // |
| 265 // If the original url does not point to an isolated or external filesystem, | 277 // If the original url does not point to an isolated or external filesystem, |
| 266 // returns the original url, without attempting to crack it. | 278 // returns the original url, without attempting to crack it. |
| 267 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; | 279 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; |
| 268 | 280 |
| 269 // For initial backend_map construction. This must be called only from | 281 // For initial backend_map construction. This must be called only from |
| 270 // the constructor. | 282 // the constructor. |
| 271 void RegisterBackend(FileSystemBackend* backend); | 283 void RegisterBackend(FileSystemBackend* backend); |
| 272 | 284 |
| 285 void DidOpenFileSystemForResolveURL( |
| 286 const FileSystemURL& url, |
| 287 const ResolveURLCallback& callback, |
| 288 const GURL& filesystem_root, |
| 289 const std::string& filesystem_name, |
| 290 base::PlatformFileError error); |
| 291 void DidGetMetadataForResolveURL( |
| 292 const FileSystemURL& url, |
| 293 const FileSystemContext::ResolveURLCallback& callback, |
| 294 const GURL& filesystem_roor, |
| 295 const std::string& filesystem_name, |
| 296 base::PlatformFileError error, |
| 297 const base::PlatformFileInfo& file_info); |
| 298 |
| 273 // Returns a FileSystemBackend, used only by test code. | 299 // Returns a FileSystemBackend, used only by test code. |
| 274 SandboxFileSystemBackend* sandbox_backend() const { | 300 SandboxFileSystemBackend* sandbox_backend() const { |
| 275 return sandbox_backend_.get(); | 301 return sandbox_backend_.get(); |
| 276 } | 302 } |
| 277 | 303 |
| 278 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 304 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 279 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; | 305 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; |
| 280 | 306 |
| 281 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 307 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 282 | 308 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 341 |
| 316 struct DefaultContextDeleter { | 342 struct DefaultContextDeleter { |
| 317 static void Destruct(const FileSystemContext* context) { | 343 static void Destruct(const FileSystemContext* context) { |
| 318 context->DeleteOnCorrectThread(); | 344 context->DeleteOnCorrectThread(); |
| 319 } | 345 } |
| 320 }; | 346 }; |
| 321 | 347 |
| 322 } // namespace fileapi | 348 } // namespace fileapi |
| 323 | 349 |
| 324 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 350 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |