summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-02 17:36:07 +0000
committerpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-02 17:36:07 +0000
commit693845e44965a358274812ff75aa23ca80625658 (patch)
tree94a7e351f547338af6f61439b50fdffe285b1593
parentc29fa668ab381858720aefd63093ea4017604c71 (diff)
downloadchromium_src-693845e44965a358274812ff75aa23ca80625658.zip
chromium_src-693845e44965a358274812ff75aa23ca80625658.tar.gz
chromium_src-693845e44965a358274812ff75aa23ca80625658.tar.bz2
Convert AwRequestInerceptor to net::URLRequestJobFactory::ProtocolHandler
BUG=161534 Review URL: https://chromiumcodereview.appspot.com/11678008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174807 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/browser/aw_request_interceptor.cc24
-rw-r--r--android_webview/browser/aw_request_interceptor.h17
-rw-r--r--android_webview/browser/net/aw_url_request_context_getter.cc6
3 files changed, 10 insertions, 37 deletions
diff --git a/android_webview/browser/aw_request_interceptor.cc b/android_webview/browser/aw_request_interceptor.cc
index e0dd2ca..0e5e283 100644
--- a/android_webview/browser/aw_request_interceptor.cc
+++ b/android_webview/browser/aw_request_interceptor.cc
@@ -73,8 +73,7 @@ AwRequestInterceptor::QueryForInterceptedRequestData(
return io_thread_client->ShouldInterceptRequest(location, request).Pass();
}
-net::URLRequestJob* AwRequestInterceptor::MaybeInterceptInternal(
- const GURL& location,
+net::URLRequestJob* AwRequestInterceptor::MaybeCreateJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -93,7 +92,7 @@ net::URLRequestJob* AwRequestInterceptor::MaybeInterceptInternal(
// the result of that call is a valid InterceptedRequestData* pointer or
// NULL.
user_data = new URLRequestUserData(
- QueryForInterceptedRequestData(location, request));
+ QueryForInterceptedRequestData(request->url(), request));
request->SetUserData(kURLRequestUserDataKey, user_data);
}
@@ -105,23 +104,4 @@ net::URLRequestJob* AwRequestInterceptor::MaybeInterceptInternal(
return intercepted_request_data->CreateJobFor(request, network_delegate);
}
-net::URLRequestJob* AwRequestInterceptor::MaybeIntercept(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const {
- return MaybeInterceptInternal(request->url(), request, network_delegate);
-}
-
-net::URLRequestJob* AwRequestInterceptor::MaybeInterceptRedirect(
- const GURL& location,
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const {
- return MaybeInterceptInternal(location, request, network_delegate);
-}
-
-net::URLRequestJob* AwRequestInterceptor::MaybeInterceptResponse(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const {
- return NULL;
-}
-
} // namespace android_webview
diff --git a/android_webview/browser/aw_request_interceptor.h b/android_webview/browser/aw_request_interceptor.h
index 9079a46..51a7af8 100644
--- a/android_webview/browser/aw_request_interceptor.h
+++ b/android_webview/browser/aw_request_interceptor.h
@@ -24,28 +24,17 @@ class InterceptedRequestData;
// This class allows the Java-side embedder to substitute the default
// URLRequest of a given request for an alternative job that will read data
// from a Java stream.
-class AwRequestInterceptor : public net::URLRequestJobFactory::Interceptor {
+class AwRequestInterceptor : public net::URLRequestJobFactory::ProtocolHandler {
public:
AwRequestInterceptor();
virtual ~AwRequestInterceptor();
- // net::URLRequestJobFactory::Interceptor overrides -------------------------
- 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(
+ // net::URLRequestJobFactory::ProtocolHandler override -----------------------
+ virtual net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
- net::URLRequestJob* MaybeInterceptInternal(
- const GURL& location,
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const;
scoped_ptr<InterceptedRequestData> QueryForInterceptedRequestData(
const GURL& location,
net::URLRequest* request) const;
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 b6d3d25..f80f0c2 100644
--- a/android_webview/browser/net/aw_url_request_context_getter.cc
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -18,6 +18,7 @@
#include "net/proxy/proxy_service.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
+#include "net/url_request/protocol_intercept_job_factory.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_context.h"
@@ -101,7 +102,6 @@ void AwURLRequestContextGetter::Init() {
set_protocol = job_factory->SetProtocolHandler(
chrome::kDataScheme, new net::DataProtocolHandler());
DCHECK(set_protocol);
- job_factory->AddInterceptor(new AwRequestInterceptor());
// TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads.
net::HttpNetworkSession::Params network_session_params;
@@ -118,6 +118,10 @@ void AwURLRequestContextGetter::Init() {
job_factory_ = CreateAndroidJobFactoryAndCookieMonster(
url_request_context_.get(), job_factory.Pass());
+ job_factory_.reset(new net::ProtocolInterceptJobFactory(
+ job_factory_.Pass(),
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(
+ new AwRequestInterceptor())));
url_request_context_->set_job_factory(job_factory_.get());
}