summaryrefslogtreecommitdiffstats
path: root/android_webview/lib
diff options
context:
space:
mode:
authormkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 10:07:56 +0000
committermkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 10:07:56 +0000
commit5c8453994c3fe90856adf357342e70916b52b496 (patch)
tree0baeb233ec3e35da4379a12456a3a48d5dcf987b /android_webview/lib
parent74f05e5f6b235f4d6ab81af8aa5a855ffea46def (diff)
downloadchromium_src-5c8453994c3fe90856adf357342e70916b52b496.zip
chromium_src-5c8453994c3fe90856adf357342e70916b52b496.tar.gz
chromium_src-5c8453994c3fe90856adf357342e70916b52b496.tar.bz2
[android_webview] Support intercepting for unhandled schemes.
This makes it possible to intercept navigations and resource requests for otherwise unsupported schemes. BUG=156354,148369 Review URL: https://codereview.chromium.org/11185051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/lib')
-rw-r--r--android_webview/lib/aw_browser_dependency_factory_impl.cc15
-rw-r--r--android_webview/lib/aw_browser_dependency_factory_impl.h2
2 files changed, 12 insertions, 5 deletions
diff --git a/android_webview/lib/aw_browser_dependency_factory_impl.cc b/android_webview/lib/aw_browser_dependency_factory_impl.cc
index dccf033..d390f8b 100644
--- a/android_webview/lib/aw_browser_dependency_factory_impl.cc
+++ b/android_webview/lib/aw_browser_dependency_factory_impl.cc
@@ -6,6 +6,7 @@
// TODO(joth): Componentize or remove chrome/... dependencies.
#include "android_webview/browser/net/aw_network_delegate.h"
+#include "android_webview/browser/net/aw_url_request_job_factory.h"
#include "android_webview/browser/aw_request_interceptor.h"
#include "android_webview/native/android_protocol_handler.h"
#include "android_webview/native/aw_contents_container.h"
@@ -72,8 +73,15 @@ void AwBrowserDependencyFactoryImpl::InitOnIOThreadWithBrowserContext(
incognito_context->GetURLRequestContext()->set_network_delegate(
network_delegate_.get());
- AwRequestInterceptor::RegisterInterceptorOnIOThread(normal_context);
- AwRequestInterceptor::RegisterInterceptorOnIOThread(incognito_context);
+ url_request_job_factory_.reset(new AwURLRequestJobFactory());
+ normal_context->GetURLRequestContext()->set_job_factory(
+ url_request_job_factory_.get());
+ incognito_context->GetURLRequestContext()->set_job_factory(
+ url_request_job_factory_.get());
+
+ AndroidProtocolHandler::RegisterProtocolsOnIOThread(
+ url_request_job_factory_.get());
+ url_request_job_factory_->AddInterceptor(new AwRequestInterceptor());
}
void AwBrowserDependencyFactoryImpl::EnsureContextDependentHooksInitialized()
@@ -90,9 +98,6 @@ void AwBrowserDependencyFactoryImpl::EnsureContextDependentHooksInitialized()
make_scoped_refptr(profile->GetRequestContext()),
make_scoped_refptr(
profile->GetOffTheRecordProfile()->GetRequestContext())));
-
- net::URLRequestContextGetter* context_getter = profile->GetRequestContext();
- AndroidProtocolHandler::RegisterProtocols(context_getter);
}
content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext(
diff --git a/android_webview/lib/aw_browser_dependency_factory_impl.h b/android_webview/lib/aw_browser_dependency_factory_impl.h
index f7cc270..629943e 100644
--- a/android_webview/lib/aw_browser_dependency_factory_impl.h
+++ b/android_webview/lib/aw_browser_dependency_factory_impl.h
@@ -17,6 +17,7 @@ class URLRequestContextGetter;
namespace android_webview {
class AwNetworkDelegate;
+class AwURLRequestJobFactory;
class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory {
public:
@@ -40,6 +41,7 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory {
// Constructed and assigned on the IO thread.
scoped_ptr<AwNetworkDelegate> network_delegate_;
+ scoped_ptr<AwURLRequestJobFactory> url_request_job_factory_;
// Set on the UI thread.
bool context_dependent_hooks_initialized_;