| Index: android_webview/browser/net/aw_url_request_context_getter.cc
|
| diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc
|
| index 1b7177b641a846cb6198c2bd460a835ab24a48ec..af23b500a976dc1df718125a164a4b111b84bceb 100644
|
| --- a/android_webview/browser/net/aw_url_request_context_getter.cc
|
| +++ b/android_webview/browser/net/aw_url_request_context_getter.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "android_webview/browser/net/aw_url_request_context_getter.h"
|
|
|
| +#include <vector>
|
| +
|
| #include "android_webview/browser/aw_browser_context.h"
|
| #include "android_webview/browser/aw_request_interceptor.h"
|
| #include "android_webview/browser/net/aw_network_delegate.h"
|
| @@ -123,18 +125,37 @@ net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() {
|
| chrome::kChromeDevToolsScheme,
|
| chrome_devtools_protocol_handler_.release());
|
| DCHECK(set_protocol);
|
| - // Create a chain of URLRequestJobFactories. Keep |job_factory_| pointed
|
| - // at the beginning of the chain.
|
| - job_factory_ = CreateAndroidJobFactory(job_factory.Pass());
|
| - job_factory_.reset(new net::ProtocolInterceptJobFactory(
|
| - job_factory_.Pass(),
|
| - scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(
|
| - new AwRequestInterceptor())));
|
| - job_factory_.reset(new net::ProtocolInterceptJobFactory(
|
| - job_factory_.Pass(),
|
| - developer_protocol_handler_.Pass()));
|
| +
|
| + // Create a chain of URLRequestJobFactories. The handlers will be invoked
|
| + // in the order in which they appear in the protocol_handlers vector.
|
| + typedef std::vector<net::URLRequestJobFactory::ProtocolHandler*>
|
| + ProtocolHandlerVector;
|
| + ProtocolHandlerVector protocol_handlers;
|
| +
|
| + protocol_handlers.push_back(
|
| + CreateAndroidContentProtocolHandler().release());
|
| + protocol_handlers.push_back(
|
| + CreateAndroidAssetFileProtocolHandler().release());
|
| + protocol_handlers.push_back(developer_protocol_handler_.release());
|
| + // The AwRequestInterceptor must come after the content and asset file job
|
| + // factories. This for WebViewClassic compatibility where it was not
|
| + // possible to intercept resource loads to resolvable content:// and
|
| + // file:// URIs.
|
| + protocol_handlers.push_back(new AwRequestInterceptor());
|
| + job_factory_ = job_factory.PassAs<net::URLRequestJobFactory>();
|
| +
|
| + // The chain of responsibility will execute the handlers in reverse to the
|
| + // order in which the elements of the chain are created.
|
| + for (ProtocolHandlerVector::reverse_iterator i = protocol_handlers.rbegin();
|
| + i != protocol_handlers.rend();
|
| + ++i) {
|
| + job_factory_.reset(new net::ProtocolInterceptJobFactory(
|
| + job_factory_.Pass(), make_scoped_ptr(*i)));
|
| + }
|
| +
|
| url_request_context_->set_job_factory(job_factory_.get());
|
| }
|
| +
|
| return url_request_context_.get();
|
| }
|
|
|
|
|