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

Unified Diff: content/shell/shell_url_request_context_getter.cc

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another rebase Created 7 years, 9 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 | « content/shell/shell_url_request_context_getter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/shell_url_request_context_getter.cc
diff --git a/content/shell/shell_url_request_context_getter.cc b/content/shell/shell_url_request_context_getter.cc
index c5ba28a5a4dd506a1ef4a0d1f8249f1d3cf512b0..b4c25c22b9021b3d868344a2120913c63d0c8fed 100644
--- a/content/shell/shell_url_request_context_getter.cc
+++ b/content/shell/shell_url_request_context_getter.cc
@@ -35,34 +35,38 @@
namespace content {
+namespace {
+
+void InstallProtocolHandlers(net::URLRequestJobFactoryImpl* job_factory,
+ ProtocolHandlerMap* protocol_handlers) {
+ for (ProtocolHandlerMap::iterator it =
+ protocol_handlers->begin();
+ it != protocol_handlers->end();
+ ++it) {
+ bool set_protocol = job_factory->SetProtocolHandler(
+ it->first, it->second.release());
+ DCHECK(set_protocol);
+ }
+ protocol_handlers->clear();
+}
+
+} // namespace
+
ShellURLRequestContextGetter::ShellURLRequestContextGetter(
bool ignore_certificate_errors,
const base::FilePath& base_path,
MessageLoop* io_loop,
MessageLoop* file_loop,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler)
+ ProtocolHandlerMap* protocol_handlers)
: ignore_certificate_errors_(ignore_certificate_errors),
base_path_(base_path),
io_loop_(io_loop),
- file_loop_(file_loop),
- blob_protocol_handler_(blob_protocol_handler.Pass()),
- file_system_protocol_handler_(file_system_protocol_handler.Pass()),
- developer_protocol_handler_(developer_protocol_handler.Pass()),
- chrome_protocol_handler_(chrome_protocol_handler.Pass()),
- chrome_devtools_protocol_handler_(
- chrome_devtools_protocol_handler.Pass()) {
+ file_loop_(file_loop) {
// Must first be created on the UI thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ std::swap(protocol_handlers_, *protocol_handlers);
+
// We must create the proxy config service on the UI loop on Linux because it
// must synchronously run on the glib message loop. This will be passed to
// the URLRequestContextStorage on the IO thread in GetURLRequestContext().
@@ -173,22 +177,8 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler_.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler_.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler_.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler_.release());
- DCHECK(set_protocol);
- storage_->set_job_factory(new net::ProtocolInterceptJobFactory(
- job_factory.PassAs<net::URLRequestJobFactory>(),
- developer_protocol_handler_.Pass()));
+ InstallProtocolHandlers(job_factory.get(), &protocol_handlers_);
+ storage_->set_job_factory(job_factory.release());
}
return url_request_context_.get();
« no previous file with comments | « content/shell/shell_url_request_context_getter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698