diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 18:36:26 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 18:36:26 +0000 |
commit | e7bee399b0d064cdd281bc567a2736852079e87a (patch) | |
tree | e9c1b83b4d70a1d8bc52021db2d96a91f33eb8e7 /android_webview/lib | |
parent | 0d2cb888776e6a8e0dd4939390a2b9c220ff40fa (diff) | |
download | chromium_src-e7bee399b0d064cdd281bc567a2736852079e87a.zip chromium_src-e7bee399b0d064cdd281bc567a2736852079e87a.tar.gz chromium_src-e7bee399b0d064cdd281bc567a2736852079e87a.tar.bz2 |
Move AndroidProtocolAdaptor into android_webview
Also move Android-specific URL constants into android_webview
R=benm@chromium.org,joth@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10985044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/lib')
-rw-r--r-- | android_webview/lib/DEPS | 3 | ||||
-rw-r--r-- | android_webview/lib/aw_browser_dependency_factory_impl.cc | 17 | ||||
-rw-r--r-- | android_webview/lib/aw_browser_dependency_factory_impl.h | 4 | ||||
-rw-r--r-- | android_webview/lib/main/aw_main_delegate.cc | 13 |
4 files changed, 29 insertions, 8 deletions
diff --git a/android_webview/lib/DEPS b/android_webview/lib/DEPS index c0baad3..3f7d100 100644 --- a/android_webview/lib/DEPS +++ b/android_webview/lib/DEPS @@ -7,6 +7,9 @@ include_rules = [ "!chrome/common/chrome_content_client.h", "!chrome/browser/chrome_content_browser_client.h", "!chrome/renderer/chrome_content_renderer_client.h", + # Needed for content: scheme registation, will be moved away together with *Client classes. + "!third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h", + "!third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h", # Temporary until services we use no longer depend on Chrome's path service. "!chrome/common/chrome_paths.h", diff --git a/android_webview/lib/aw_browser_dependency_factory_impl.cc b/android_webview/lib/aw_browser_dependency_factory_impl.cc index ff64ca6..4eba90a 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/native/android_protocol_handler.h" #include "android_webview/native/aw_contents_container.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -47,7 +48,9 @@ class WebContentsWrapper : public AwContentsContainer { } // namespace -AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {} +AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() + : context_dependent_hooks_initialized_(false) { +} AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {} @@ -69,11 +72,12 @@ void AwBrowserDependencyFactoryImpl::InitializeNetworkDelegateOnIOThread( network_delegate_.get()); } -void AwBrowserDependencyFactoryImpl::EnsureNetworkDelegateInitialized() { - if (initialized_network_delegate_) +void AwBrowserDependencyFactoryImpl::EnsureContextDependentHooksInitialized() +{ + if (context_dependent_hooks_initialized_) return; - initialized_network_delegate_ = true; Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile(); + context_dependent_hooks_initialized_ = true; profile->GetRequestContext()->GetNetworkTaskRunner()->PostTask( FROM_HERE, base::Bind( @@ -82,11 +86,14 @@ void AwBrowserDependencyFactoryImpl::EnsureNetworkDelegateInitialized() { 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( bool incognito) { - EnsureNetworkDelegateInitialized(); + EnsureContextDependentHooksInitialized(); Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile(); return incognito ? profile->GetOffTheRecordProfile() : profile; } diff --git a/android_webview/lib/aw_browser_dependency_factory_impl.h b/android_webview/lib/aw_browser_dependency_factory_impl.h index a3e7349..08eb1ef 100644 --- a/android_webview/lib/aw_browser_dependency_factory_impl.h +++ b/android_webview/lib/aw_browser_dependency_factory_impl.h @@ -36,12 +36,12 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory { void InitializeNetworkDelegateOnIOThread( net::URLRequestContextGetter* normal_context, net::URLRequestContextGetter* incognito_context); - void EnsureNetworkDelegateInitialized(); + void EnsureContextDependentHooksInitialized(); // Constructed and assigned on the IO thread. scoped_ptr<AwNetworkDelegate> network_delegate_; // Set on the UI thread. - bool initialized_network_delegate_; + bool context_dependent_hooks_initialized_; DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl); }; diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc index cd819ac..0d24080 100644 --- a/android_webview/lib/main/aw_main_delegate.cc +++ b/android_webview/lib/main/aw_main_delegate.cc @@ -4,15 +4,19 @@ #include "android_webview/lib/main/aw_main_delegate.h" +#include "android_webview/common/url_constants.h" #include "android_webview/lib/aw_browser_dependency_factory_impl.h" #include "android_webview/lib/aw_content_browser_client.h" #include "android_webview/renderer/aw_render_view_ext.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" #include "chrome/renderer/chrome_content_renderer_client.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/common/content_client.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" namespace android_webview { @@ -21,10 +25,17 @@ namespace { // TODO(joth): Remove chrome/ dependency; move into android_webview/renderer class AwContentRendererClient : public chrome::ChromeContentRendererClient { public: - virtual void RenderViewCreated(content::RenderView* render_view) { + virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE { chrome::ChromeContentRendererClient::RenderViewCreated(render_view); AwRenderViewExt::RenderViewCreated(render_view); } + + virtual void RenderThreadStarted() OVERRIDE { + chrome::ChromeContentRendererClient::RenderThreadStarted(); + WebKit::WebString content_scheme( + ASCIIToUTF16(android_webview::kContentScheme)); + WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme); + } }; } |