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

Unified Diff: webkit/fileapi/file_system_url_request_job_factory.cc

Issue 7036004: Remove more URLRequest::RegisterProtocolFactory calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup nits. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/file_system_url_request_job_factory.h ('k') | webkit/fileapi/webkit_fileapi.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_url_request_job_factory.cc
diff --git a/chrome/browser/net/file_system_url_request_job_factory.cc b/webkit/fileapi/file_system_url_request_job_factory.cc
similarity index 61%
rename from chrome/browser/net/file_system_url_request_job_factory.cc
rename to webkit/fileapi/file_system_url_request_job_factory.cc
index ba7b1aebdcbbd7776fd88ac452e2729442bb85d0..42b7ffc53d3081120b1409d8fbdb51af61a5996f 100644
--- a/chrome/browser/net/file_system_url_request_job_factory.cc
+++ b/webkit/fileapi/file_system_url_request_job_factory.cc
@@ -2,23 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/net/file_system_url_request_job_factory.h"
+#include "webkit/fileapi/file_system_url_request_job_factory.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/common/url_constants.h"
-#include "content/browser/browser_thread.h"
#include "net/url_request/url_request.h"
#include "webkit/fileapi/file_system_url_request_job.h"
#include "webkit/fileapi/file_system_dir_url_request_job.h"
+namespace fileapi {
+
namespace {
class FileSystemProtocolHandler
: public net::URLRequestJobFactory::ProtocolHandler {
public:
- explicit FileSystemProtocolHandler(fileapi::FileSystemContext* context);
+ explicit FileSystemProtocolHandler(
+ FileSystemContext* context,
+ base::MessageLoopProxy* loop_proxy);
virtual ~FileSystemProtocolHandler();
virtual net::URLRequestJob* MaybeCreateJob(
@@ -27,15 +28,19 @@ class FileSystemProtocolHandler
private:
// No scoped_refptr because |file_system_context_| is owned by the
// ProfileIOData, which also owns this ProtocolHandler.
- fileapi::FileSystemContext* const file_system_context_;
+ FileSystemContext* const file_system_context_;
+ const scoped_refptr<base::MessageLoopProxy> file_loop_proxy_;
DISALLOW_COPY_AND_ASSIGN(FileSystemProtocolHandler);
};
FileSystemProtocolHandler::FileSystemProtocolHandler(
- fileapi::FileSystemContext* context)
- : file_system_context_(context) {
+ FileSystemContext* context,
+ base::MessageLoopProxy* file_loop_proxy)
+ : file_system_context_(context),
+ file_loop_proxy_(file_loop_proxy) {
DCHECK(file_system_context_);
+ DCHECK(file_loop_proxy_);
}
FileSystemProtocolHandler::~FileSystemProtocolHandler() {}
@@ -48,19 +53,21 @@ net::URLRequestJob* FileSystemProtocolHandler::MaybeCreateJob(
// to a directory and gets dispatched to FileSystemURLRequestJob, that class
// redirects back here, by adding a / to the URL.
if (!path.empty() && path[path.size() - 1] == '/') {
- return new fileapi::FileSystemDirURLRequestJob(
- request, file_system_context_,
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
+ return new FileSystemDirURLRequestJob(
+ request, file_system_context_, file_loop_proxy_);
}
- return new fileapi::FileSystemURLRequestJob(
- request, file_system_context_,
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
+ return new FileSystemURLRequestJob(
+ request, file_system_context_, file_loop_proxy_);
}
} // anonymous namespace
net::URLRequestJobFactory::ProtocolHandler*
-CreateFileSystemProtocolHandler(fileapi::FileSystemContext* context) {
+CreateFileSystemProtocolHandler(FileSystemContext* context,
+ base::MessageLoopProxy* loop_proxy) {
DCHECK(context);
- return new FileSystemProtocolHandler(context);
+ DCHECK(loop_proxy);
+ return new FileSystemProtocolHandler(context, loop_proxy);
}
+
+} // namespace fileapi
« no previous file with comments | « webkit/fileapi/file_system_url_request_job_factory.h ('k') | webkit/fileapi/webkit_fileapi.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698