| Index: android_webview/native/android_protocol_handler.cc
|
| diff --git a/android_webview/native/android_protocol_handler.cc b/android_webview/native/android_protocol_handler.cc
|
| index de6059f9df6f8c5f98060423e71b9930db16f1d0..4a88b5e20c1505be90aaccaaafcda27bb6f72417 100644
|
| --- a/android_webview/native/android_protocol_handler.cc
|
| +++ b/android_webview/native/android_protocol_handler.cc
|
| @@ -20,6 +20,7 @@
|
| #include "net/base/net_errors.h"
|
| #include "net/base/net_util.h"
|
| #include "net/http/http_util.h"
|
| +#include "net/url_request/protocol_intercept_job_factory.h"
|
| #include "net/url_request/url_request.h"
|
| #include "net/url_request/url_request_job_factory.h"
|
|
|
| @@ -65,22 +66,17 @@ class AndroidStreamReaderURLRequestJobDelegateImpl
|
| };
|
|
|
| class AssetFileProtocolInterceptor :
|
| - public net::URLRequestJobFactory::Interceptor {
|
| + public net::URLRequestJobFactory::ProtocolHandler {
|
| public:
|
| - AssetFileProtocolInterceptor();
|
| + static scoped_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
|
| + scoped_ptr<net::URLRequestJobFactory> base_job_factory);
|
| virtual ~AssetFileProtocolInterceptor() OVERRIDE;
|
| - virtual net::URLRequestJob* MaybeIntercept(
|
| - net::URLRequest* request,
|
| - net::NetworkDelegate* network_delegate) const OVERRIDE;
|
| - virtual net::URLRequestJob* MaybeInterceptRedirect(
|
| - const GURL& location,
|
| - net::URLRequest* request,
|
| - net::NetworkDelegate* network_delegate) const OVERRIDE;
|
| - virtual net::URLRequestJob* MaybeInterceptResponse(
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| net::URLRequest* request,
|
| net::NetworkDelegate* network_delegate) const OVERRIDE;
|
|
|
| private:
|
| + AssetFileProtocolInterceptor();
|
| // file:///android_asset/
|
| const std::string asset_prefix_;
|
| // file:///android_res/
|
| @@ -196,7 +192,18 @@ AssetFileProtocolInterceptor::AssetFileProtocolInterceptor()
|
| AssetFileProtocolInterceptor::~AssetFileProtocolInterceptor() {
|
| }
|
|
|
| -net::URLRequestJob* AssetFileProtocolInterceptor::MaybeIntercept(
|
| +// static
|
| +scoped_ptr<net::URLRequestJobFactory>
|
| +AssetFileProtocolInterceptor::CreateURLRequestJobFactory(
|
| + scoped_ptr<net::URLRequestJobFactory> base_job_factory) {
|
| + scoped_ptr<net::URLRequestJobFactory> top_job_factory(
|
| + new net::ProtocolInterceptJobFactory(base_job_factory.Pass(),
|
| + chrome::kFileScheme,
|
| + new AssetFileProtocolInterceptor()));
|
| + return top_job_factory.Pass();
|
| +}
|
| +
|
| +net::URLRequestJob* AssetFileProtocolInterceptor::MaybeCreateJob(
|
| net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| if (!request->url().SchemeIsFile()) return NULL;
|
|
|
| @@ -213,19 +220,6 @@ net::URLRequestJob* AssetFileProtocolInterceptor::MaybeIntercept(
|
| new AndroidStreamReaderURLRequestJobDelegateImpl()));
|
| }
|
|
|
| -net::URLRequestJob* AssetFileProtocolInterceptor::MaybeInterceptRedirect(
|
| - const GURL& location,
|
| - net::URLRequest* request,
|
| - net::NetworkDelegate* network_delegate) const {
|
| - return NULL;
|
| -}
|
| -
|
| -net::URLRequestJob* AssetFileProtocolInterceptor::MaybeInterceptResponse(
|
| - net::URLRequest* request,
|
| - net::NetworkDelegate* network_delegate) const {
|
| - return NULL;
|
| -}
|
| -
|
| } // namespace
|
|
|
| namespace android_webview {
|
| @@ -235,9 +229,9 @@ bool RegisterAndroidProtocolHandler(JNIEnv* env) {
|
| }
|
|
|
| // static
|
| -void RegisterAndroidProtocolsOnIOThread(
|
| +scoped_ptr<net::URLRequestJobFactory> RegisterAndroidProtocolsOnIOThread(
|
| net::URLRequestContext* context,
|
| - net::URLRequestJobFactory* job_factory) {
|
| + scoped_ptr<net::URLRequestJobFactory> job_factory) {
|
| // Register content://. Note that even though a scheme is
|
| // registered here, it cannot be used by child processes until access to it is
|
| // granted via ChildProcessSecurityPolicy::GrantScheme(). This is done in
|
| @@ -245,8 +239,8 @@ void RegisterAndroidProtocolsOnIOThread(
|
| // The job factory takes ownership of the handler.
|
| job_factory->SetProtocolHandler(android_webview::kContentScheme,
|
| new ContentSchemeProtocolHandler());
|
| - // The job factory takes ownership of the interceptor.
|
| - job_factory->AddInterceptor(new AssetFileProtocolInterceptor());
|
| + return AssetFileProtocolInterceptor::CreateURLRequestJobFactory(
|
| + job_factory.Pass());
|
| }
|
|
|
| // Set a context object to be used for resolving resource queries. This can
|
|
|