summaryrefslogtreecommitdiffstats
path: root/android_webview/lib
diff options
context:
space:
mode:
authormkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 16:28:51 +0000
committermkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 16:28:51 +0000
commit5b15e13c68d8ca8165698d50410557f44b012b31 (patch)
tree08ce7da669bd4a0eb41b3b0fa0ca2f9e0b9040b7 /android_webview/lib
parent81b9ab27d60b4645099c14e6a45eb66a59c5137e (diff)
downloadchromium_src-5b15e13c68d8ca8165698d50410557f44b012b31.zip
chromium_src-5b15e13c68d8ca8165698d50410557f44b012b31.tar.gz
chromium_src-5b15e13c68d8ca8165698d50410557f44b012b31.tar.bz2
Implement android_webview url intercepting.
This implements the WebViewClient shouldInterceptRequest and onLoadResource callbacks. BUG=138481 Android-only change - ran through android try. NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11110013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/lib')
-rw-r--r--android_webview/lib/aw_browser_dependency_factory_impl.cc14
-rw-r--r--android_webview/lib/aw_browser_dependency_factory_impl.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/android_webview/lib/aw_browser_dependency_factory_impl.cc b/android_webview/lib/aw_browser_dependency_factory_impl.cc
index 4eba90a..dccf033 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/aw_request_interceptor.h"
#include "android_webview/native/android_protocol_handler.h"
#include "android_webview/native/aw_contents_container.h"
#include "base/bind.h"
@@ -59,10 +60,10 @@ void AwBrowserDependencyFactoryImpl::InstallInstance() {
SetInstance(g_lazy_instance.Pointer());
}
-// Initializing the Network Delegate here is only a temporary solution until we
-// build an Android WebView specific BrowserContext that can handle building
-// this internally.
-void AwBrowserDependencyFactoryImpl::InitializeNetworkDelegateOnIOThread(
+// Initializing the Network Delegate here is only a temporary solution until
+// an Android WebView specific BrowserContext (which can then handle building
+// this internally is) available.
+void AwBrowserDependencyFactoryImpl::InitOnIOThreadWithBrowserContext(
net::URLRequestContextGetter* normal_context,
net::URLRequestContextGetter* incognito_context) {
network_delegate_.reset(new AwNetworkDelegate());
@@ -70,6 +71,9 @@ void AwBrowserDependencyFactoryImpl::InitializeNetworkDelegateOnIOThread(
network_delegate_.get());
incognito_context->GetURLRequestContext()->set_network_delegate(
network_delegate_.get());
+
+ AwRequestInterceptor::RegisterInterceptorOnIOThread(normal_context);
+ AwRequestInterceptor::RegisterInterceptorOnIOThread(incognito_context);
}
void AwBrowserDependencyFactoryImpl::EnsureContextDependentHooksInitialized()
@@ -81,7 +85,7 @@ void AwBrowserDependencyFactoryImpl::EnsureContextDependentHooksInitialized()
profile->GetRequestContext()->GetNetworkTaskRunner()->PostTask(
FROM_HERE,
base::Bind(
- &AwBrowserDependencyFactoryImpl::InitializeNetworkDelegateOnIOThread,
+ &AwBrowserDependencyFactoryImpl::InitOnIOThreadWithBrowserContext,
base::Unretained(this),
make_scoped_refptr(profile->GetRequestContext()),
make_scoped_refptr(
diff --git a/android_webview/lib/aw_browser_dependency_factory_impl.h b/android_webview/lib/aw_browser_dependency_factory_impl.h
index 08eb1ef..f7cc270 100644
--- a/android_webview/lib/aw_browser_dependency_factory_impl.h
+++ b/android_webview/lib/aw_browser_dependency_factory_impl.h
@@ -33,7 +33,7 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory {
content::WebContents* contents) OVERRIDE;
private:
- void InitializeNetworkDelegateOnIOThread(
+ void InitOnIOThreadWithBrowserContext(
net::URLRequestContextGetter* normal_context,
net::URLRequestContextGetter* incognito_context);
void EnsureContextDependentHooksInitialized();