diff options
Diffstat (limited to 'webkit/browser')
9 files changed, 14 insertions, 113 deletions
diff --git a/webkit/browser/fileapi/external_mount_points.h b/webkit/browser/fileapi/external_mount_points.h index 1748a09..9fb3cc3 100644 --- a/webkit/browser/fileapi/external_mount_points.h +++ b/webkit/browser/fileapi/external_mount_points.h @@ -21,8 +21,10 @@ class FilePath; } namespace fileapi { - class FileSystemURL; +} + +namespace fileapi { // Manages external filesystem namespaces that are identified by 'mount name' // and are persisted until RevokeFileSystem is called. diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc index 067b25b..c42eadb 100644 --- a/webkit/browser/fileapi/file_system_context.cc +++ b/webkit/browser/fileapi/file_system_context.cc @@ -8,7 +8,6 @@ #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/task_runner_util.h" -#include "net/url_request/url_request.h" #include "url/gurl.h" #include "webkit/browser/blob/file_stream_reader.h" #include "webkit/browser/fileapi/copy_or_move_file_validator.h" @@ -114,7 +113,6 @@ FileSystemContext::FileSystemContext( quota::SpecialStoragePolicy* special_storage_policy, quota::QuotaManagerProxy* quota_manager_proxy, ScopedVector<FileSystemBackend> additional_backends, - const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, const base::FilePath& partition_path, const FileSystemOptions& options) : io_task_runner_(io_task_runner), @@ -135,7 +133,6 @@ FileSystemContext::FileSystemContext( special_storage_policy, options)), additional_backends_(additional_backends.Pass()), - auto_mount_handlers_(auto_mount_handlers), external_mount_points_(external_mount_points), partition_path_(partition_path), is_incognito_(options.is_incognito()), @@ -340,22 +337,6 @@ void FileSystemContext::ResolveURL( callback)); } -void FileSystemContext::AttemptAutoMountForURLRequest( - const net::URLRequest* url_request, - const std::string& storage_domain, - const StatusCallback& callback) { - FileSystemURL filesystem_url(url_request->url()); - if (filesystem_url.type() == kFileSystemTypeExternal) { - for (size_t i = 0; i < auto_mount_handlers_.size(); i++) { - if (auto_mount_handlers_[i].Run(url_request, filesystem_url, - storage_domain, callback)) { - return; - } - } - } - callback.Run(base::File::FILE_ERROR_NOT_FOUND); -} - void FileSystemContext::DeleteFileSystem( const GURL& origin_url, FileSystemType type, diff --git a/webkit/browser/fileapi/file_system_context.h b/webkit/browser/fileapi/file_system_context.h index ba91af7..62841d1 100644 --- a/webkit/browser/fileapi/file_system_context.h +++ b/webkit/browser/fileapi/file_system_context.h @@ -38,10 +38,6 @@ class QuotaManagerProxy; class SpecialStoragePolicy; } -namespace net { -class URLRequest; -} - namespace webkit_blob { class BlobURLRequestJobTest; class FileStreamReader; @@ -69,18 +65,6 @@ class SandboxFileSystemBackend; struct DefaultContextDeleter; struct FileSystemInfo; -// An auto mount handler will attempt to mount the file system requested in -// |url_request|. If the URL is for this auto mount handler, it returns true -// and calls |callback| when the attempt is complete. If the auto mounter -// does not recognize the URL, it returns false and does not call |callback|. -// Called on the IO thread. -typedef base::Callback<bool( - const net::URLRequest* url_request, - const FileSystemURL& filesystem_url, - const std::string& storage_domain, - const base::Callback<void(base::File::Error result)>& callback)> - URLRequestAutoMountHandler; - // This class keeps and provides a file system context for FileSystem API. // An instance of this class is created and owned by profile. class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext @@ -111,10 +95,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext // to serve filesystem requests for non-regular types. // If none is given, this context only handles HTML5 Sandbox FileSystem // and Drag-and-drop Isolated FileSystem requests. - // - // |auto_mount_handlers| are used to resolve calls to - // AttemptAutoMountForURLRequest. Only external filesystems are auto mounted - // when a filesystem: URL request is made. FileSystemContext( base::SingleThreadTaskRunner* io_task_runner, base::SequencedTaskRunner* file_task_runner, @@ -122,7 +102,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext quota::SpecialStoragePolicy* special_storage_policy, quota::QuotaManagerProxy* quota_manager_proxy, ScopedVector<FileSystemBackend> additional_backends, - const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, const base::FilePath& partition_path, const FileSystemOptions& options); @@ -214,13 +193,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext const FileSystemURL& url, const ResolveURLCallback& callback); - // Attempts to mount the filesystem needed to satisfy |url_request| made - // from |storage_domain|. If an appropriate file system is not found, - // callback will return an error. - void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, - const std::string& storage_domain, - const StatusCallback& callback); - // Deletes the filesystem for the given |origin_url| and |type|. This should // be called on the IO thread. void DeleteFileSystem( @@ -371,8 +343,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext scoped_ptr<PluginPrivateFileSystemBackend> plugin_private_backend_; ScopedVector<FileSystemBackend> additional_backends_; - std::vector<URLRequestAutoMountHandler> auto_mount_handlers_; - // Registered file system backends. // The map must be constructed in the constructor since it can be accessed // on multiple threads. diff --git a/webkit/browser/fileapi/file_system_dir_url_request_job.cc b/webkit/browser/fileapi/file_system_dir_url_request_job.cc index fffe739..b0f1966 100644 --- a/webkit/browser/fileapi/file_system_dir_url_request_job.cc +++ b/webkit/browser/fileapi/file_system_dir_url_request_job.cc @@ -35,10 +35,8 @@ namespace fileapi { FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( URLRequest* request, NetworkDelegate* network_delegate, - const std::string& storage_domain, FileSystemContext* file_system_context) : URLRequestJob(request, network_delegate), - storage_domain_(storage_domain), file_system_context_(file_system_context), weak_factory_(this) { } @@ -83,14 +81,6 @@ void FileSystemDirURLRequestJob::StartAsync() { if (!request_) return; url_ = file_system_context_->CrackURL(request_->url()); - if (!url_.is_valid()) { - file_system_context_->AttemptAutoMountForURLRequest( - request_, - storage_domain_, - base::Bind(&FileSystemDirURLRequestJob::DidAttemptAutoMount, - weak_factory_.GetWeakPtr())); - return; - } if (!file_system_context_->CanServeURLRequest(url_)) { // In incognito mode the API is not usable and there should be no data. if (url_.is_valid() && VirtualPath::IsRootPath(url_.virtual_path())) { @@ -109,16 +99,6 @@ void FileSystemDirURLRequestJob::StartAsync() { base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); } -void FileSystemDirURLRequestJob::DidAttemptAutoMount(base::File::Error result) { - if (result >= 0 && - file_system_context_->CrackURL(request_->url()).is_valid()) { - StartAsync(); - } else { - NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, - net::ERR_FILE_NOT_FOUND)); - } -} - void FileSystemDirURLRequestJob::DidReadDirectory( base::File::Error result, const std::vector<DirectoryEntry>& entries, diff --git a/webkit/browser/fileapi/file_system_dir_url_request_job.h b/webkit/browser/fileapi/file_system_dir_url_request_job.h index 67e9df3..7346225 100644 --- a/webkit/browser/fileapi/file_system_dir_url_request_job.h +++ b/webkit/browser/fileapi/file_system_dir_url_request_job.h @@ -28,7 +28,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemDirURLRequestJob FileSystemDirURLRequestJob( net::URLRequest* request, net::NetworkDelegate* network_delegate, - const std::string& storage_domain, FileSystemContext* file_system_context); // URLRequestJob methods: @@ -50,14 +49,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemDirURLRequestJob virtual ~FileSystemDirURLRequestJob(); void StartAsync(); - void DidAttemptAutoMount(base::File::Error result); void DidReadDirectory(base::File::Error result, const std::vector<DirectoryEntry>& entries, bool has_more); std::string data_; FileSystemURL url_; - const std::string storage_domain_; FileSystemContext* file_system_context_; base::WeakPtrFactory<FileSystemDirURLRequestJob> weak_factory_; diff --git a/webkit/browser/fileapi/file_system_url_request_job.cc b/webkit/browser/fileapi/file_system_url_request_job.cc index 8ccc5bb..fe445649 100644 --- a/webkit/browser/fileapi/file_system_url_request_job.cc +++ b/webkit/browser/fileapi/file_system_url_request_job.cc @@ -57,10 +57,8 @@ static net::HttpResponseHeaders* CreateHttpResponseHeaders() { FileSystemURLRequestJob::FileSystemURLRequestJob( URLRequest* request, NetworkDelegate* network_delegate, - const std::string& storage_domain, FileSystemContext* file_system_context) : URLRequestJob(request, network_delegate), - storage_domain_(storage_domain), file_system_context_(file_system_context), is_directory_(false), remaining_bytes_(0), @@ -159,14 +157,6 @@ void FileSystemURLRequestJob::StartAsync() { return; DCHECK(!reader_.get()); url_ = file_system_context_->CrackURL(request_->url()); - if (!url_.is_valid()) { - file_system_context_->AttemptAutoMountForURLRequest( - request_, - storage_domain_, - base::Bind(&FileSystemURLRequestJob::DidAttemptAutoMount, - weak_factory_.GetWeakPtr())); - return; - } if (!file_system_context_->CanServeURLRequest(url_)) { // In incognito mode the API is not usable and there should be no data. NotifyFailed(net::ERR_FILE_NOT_FOUND); @@ -178,15 +168,6 @@ void FileSystemURLRequestJob::StartAsync() { weak_factory_.GetWeakPtr())); } -void FileSystemURLRequestJob::DidAttemptAutoMount(base::File::Error result) { - if (result >= 0 && - file_system_context_->CrackURL(request_->url()).is_valid()) { - StartAsync(); - } else { - NotifyFailed(net::ERR_FILE_NOT_FOUND); - } -} - void FileSystemURLRequestJob::DidGetMetadata( base::File::Error error_code, const base::File::Info& file_info) { diff --git a/webkit/browser/fileapi/file_system_url_request_job.h b/webkit/browser/fileapi/file_system_url_request_job.h index 29b42a5..8fa766c 100644 --- a/webkit/browser/fileapi/file_system_url_request_job.h +++ b/webkit/browser/fileapi/file_system_url_request_job.h @@ -36,7 +36,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemURLRequestJob FileSystemURLRequestJob( net::URLRequest* request, net::NetworkDelegate* network_delegate, - const std::string& storage_domain, FileSystemContext* file_system_context); // URLRequestJob methods: @@ -61,13 +60,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemURLRequestJob virtual ~FileSystemURLRequestJob(); void StartAsync(); - void DidAttemptAutoMount(base::File::Error result); - void DidGetMetadata(base::File::Error error_code, - const base::File::Info& file_info); + void DidGetMetadata( + base::File::Error error_code, + const base::File::Info& file_info); void DidRead(int result); void NotifyFailed(int rv); - const std::string storage_domain_; FileSystemContext* file_system_context_; scoped_ptr<webkit_blob::FileStreamReader> reader_; FileSystemURL url_; diff --git a/webkit/browser/fileapi/file_system_url_request_job_factory.cc b/webkit/browser/fileapi/file_system_url_request_job_factory.cc index 3add372..76ae7c9 100644 --- a/webkit/browser/fileapi/file_system_url_request_job_factory.cc +++ b/webkit/browser/fileapi/file_system_url_request_job_factory.cc @@ -19,8 +19,7 @@ namespace { class FileSystemProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { public: - FileSystemProtocolHandler(const std::string& storage_domain, - FileSystemContext* context); + explicit FileSystemProtocolHandler(FileSystemContext* context); virtual ~FileSystemProtocolHandler(); virtual net::URLRequestJob* MaybeCreateJob( @@ -28,8 +27,6 @@ class FileSystemProtocolHandler net::NetworkDelegate* network_delegate) const OVERRIDE; private: - const std::string storage_domain_; - // No scoped_refptr because |file_system_context_| is owned by the // ProfileIOData, which also owns this ProtocolHandler. FileSystemContext* const file_system_context_; @@ -38,10 +35,8 @@ class FileSystemProtocolHandler }; FileSystemProtocolHandler::FileSystemProtocolHandler( - const std::string& storage_domain, FileSystemContext* context) - : storage_domain_(storage_domain), - file_system_context_(context) { + : file_system_context_(context) { DCHECK(file_system_context_); } @@ -56,18 +51,18 @@ net::URLRequestJob* FileSystemProtocolHandler::MaybeCreateJob( // redirects back here, by adding a / to the URL. if (!path.empty() && path[path.size() - 1] == '/') { return new FileSystemDirURLRequestJob( - request, network_delegate, storage_domain_, file_system_context_); + request, network_delegate, file_system_context_); } return new FileSystemURLRequestJob( - request, network_delegate, storage_domain_, file_system_context_); + request, network_delegate, file_system_context_); } } // anonymous namespace -net::URLRequestJobFactory::ProtocolHandler* CreateFileSystemProtocolHandler( - const std::string& storage_domain, FileSystemContext* context) { +net::URLRequestJobFactory::ProtocolHandler* +CreateFileSystemProtocolHandler(FileSystemContext* context) { DCHECK(context); - return new FileSystemProtocolHandler(storage_domain, context); + return new FileSystemProtocolHandler(context); } } // namespace fileapi diff --git a/webkit/browser/fileapi/file_system_url_request_job_factory.h b/webkit/browser/fileapi/file_system_url_request_job_factory.h index bcc55dc..5bd3c0f 100644 --- a/webkit/browser/fileapi/file_system_url_request_job_factory.h +++ b/webkit/browser/fileapi/file_system_url_request_job_factory.h @@ -5,8 +5,6 @@ #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_FACTORY_H_ #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_FACTORY_H_ -#include <string> - #include "net/url_request/url_request_job_factory.h" #include "webkit/browser/webkit_storage_browser_export.h" @@ -23,8 +21,7 @@ class FileSystemContext; // Currently, this is only used by ProfileIOData which owns |context| and the // ProtocolHandler. WEBKIT_STORAGE_BROWSER_EXPORT net::URLRequestJobFactory::ProtocolHandler* - CreateFileSystemProtocolHandler(const std::string& storage_domain, - FileSystemContext* context); + CreateFileSystemProtocolHandler(FileSystemContext* context); } // namespace fileapi |