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

Unified Diff: mojo/shell/url_request_context_getter.cc

Issue 38303002: Enable Mojo to download from file URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 | « mojo/shell/url_request_context_getter.h ('k') | net/base/network_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/url_request_context_getter.cc
diff --git a/mojo/shell/url_request_context_getter.cc b/mojo/shell/url_request_context_getter.cc
index aafe1a2eec9112456b5f6cfe1873501df3e83f55..1d01c5ec19f92afa08f3057b3aea262c7bc0c128 100644
--- a/mojo/shell/url_request_context_getter.cc
+++ b/mojo/shell/url_request_context_getter.cc
@@ -10,6 +10,7 @@
#include "net/http/http_server_properties_impl.h"
#include "net/proxy/proxy_service.h"
#include "net/ssl/ssl_config_service_defaults.h"
+#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_job_factory_impl.h"
@@ -20,10 +21,14 @@ namespace shell {
URLRequestContextGetter::URLRequestContextGetter(
base::FilePath base_path,
base::SingleThreadTaskRunner* network_task_runner,
- base::MessageLoopProxy* cache_task_runner)
+ base::SingleThreadTaskRunner* file_task_runner,
+ base::MessageLoopProxy* cache_task_runner,
+ scoped_ptr<net::NetworkDelegate> network_delegate)
: base_path_(base_path),
+ file_task_runner_(file_task_runner),
network_task_runner_(network_task_runner),
cache_task_runner_(cache_task_runner),
+ network_delegate_(network_delegate.Pass()),
net_log_(new net::NetLog()) {
}
@@ -34,6 +39,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
if (!url_request_context_) {
url_request_context_.reset(new net::URLRequestContext());
url_request_context_->set_net_log(net_log_.get());
+ url_request_context_->set_network_delegate(network_delegate_.get());
storage_.reset(
new net::URLRequestContextStorage(url_request_context_.get()));
@@ -78,7 +84,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
-
+ job_factory->SetProtocolHandler(
+ "file",
+ new net::FileProtocolHandler(file_task_runner_));
storage_->set_job_factory(job_factory.release());
}
« no previous file with comments | « mojo/shell/url_request_context_getter.h ('k') | net/base/network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698