summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-27 18:36:26 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-27 18:36:26 +0000
commite7bee399b0d064cdd281bc567a2736852079e87a (patch)
treee9c1b83b4d70a1d8bc52021db2d96a91f33eb8e7
parent0d2cb888776e6a8e0dd4939390a2b9c220ff40fa (diff)
downloadchromium_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
-rw-r--r--android_webview/android_webview.gyp2
-rw-r--r--android_webview/common/url_constants.cc20
-rw-r--r--android_webview/common/url_constants.h19
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AndroidProtocolHandler.java (renamed from chrome/android/java/src/org/chromium/chrome/browser/AndroidProtocolAdapter.java)8
-rw-r--r--android_webview/lib/DEPS3
-rw-r--r--android_webview/lib/aw_browser_dependency_factory_impl.cc17
-rw-r--r--android_webview/lib/aw_browser_dependency_factory_impl.h4
-rw-r--r--android_webview/lib/main/aw_main_delegate.cc13
-rw-r--r--android_webview/native/android_protocol_handler.cc (renamed from chrome/browser/android/android_protocol_adapter.cc)51
-rw-r--r--android_webview/native/android_protocol_handler.h (renamed from chrome/browser/android/android_protocol_adapter.h)17
-rw-r--r--android_webview/native/android_stream_reader_url_request_job.cc (renamed from chrome/browser/android/android_stream_reader_url_request_job.cc)10
-rw-r--r--android_webview/native/android_stream_reader_url_request_job.h (renamed from chrome/browser/android/android_stream_reader_url_request_job.h)11
-rw-r--r--android_webview/native/android_webview_jni_registrar.cc5
-rw-r--r--android_webview/native/webview_native.gyp18
-rw-r--r--chrome/chrome_browser.gypi18
-rw-r--r--chrome/common/url_constants.cc6
-rw-r--r--chrome/common/url_constants.h7
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc5
18 files changed, 139 insertions, 95 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp
index 25005f9..6962450 100644
--- a/android_webview/android_webview.gyp
+++ b/android_webview/android_webview.gyp
@@ -26,6 +26,8 @@
'common/android_webview_message_generator.h',
'common/render_view_messages.cc',
'common/render_view_messages.h',
+ 'common/url_constants.cc',
+ 'common/url_constants.h',
'browser/aw_cookie_access_policy.cc',
'browser/aw_cookie_access_policy.h',
'browser/aw_http_auth_handler_base.cc',
diff --git a/android_webview/common/url_constants.cc b/android_webview/common/url_constants.cc
new file mode 100644
index 0000000..e56bf0f
--- /dev/null
+++ b/android_webview/common/url_constants.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/common/url_constants.h"
+
+namespace android_webview {
+
+// The content: scheme is used in Android for interacting with content
+// provides.
+// See http://developer.android.com/reference/android/content/ContentUris.html
+const char kContentScheme[] = "content";
+
+// These are special paths used with the file: scheme to access application
+// assets and resources.
+// See http://developer.android.com/reference/android/webkit/WebSettings.html
+const char kAndroidAssetPath[] = "/android_asset/";
+const char kAndroidResourcePath[] = "/android_res/";
+
+} // namespace android_webview
diff --git a/android_webview/common/url_constants.h b/android_webview/common/url_constants.h
new file mode 100644
index 0000000..c340ca7
--- /dev/null
+++ b/android_webview/common/url_constants.h
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Contains constants for known URLs and portions thereof.
+
+#ifndef ANDROID_WEBVIEW_COMMON_URL_CONSTANTS_H_
+#define ANDROID_WEBVIEW_COMMON_URL_CONSTANTS_H_
+
+namespace android_webview {
+
+extern const char kContentScheme[];
+// Special Android file paths.
+extern const char kAndroidAssetPath[];
+extern const char kAndroidResourcePath[];
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_COMMON_URL_CONSTANTS_H_
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AndroidProtocolAdapter.java b/android_webview/java/src/org/chromium/android_webview/AndroidProtocolHandler.java
index d9134a7..dbec123 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/AndroidProtocolAdapter.java
+++ b/android_webview/java/src/org/chromium/android_webview/AndroidProtocolHandler.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser;
+package org.chromium.android_webview;
import android.content.Context;
import android.content.res.AssetManager;
@@ -19,10 +19,10 @@ import org.chromium.base.CalledByNativeUnchecked;
/**
* Implements the Java side of Android URL protocol jobs.
- * See android_protocol_adapter.cc.
+ * See android_protocol_handler.cc.
*/
-public class AndroidProtocolAdapter {
- private static final String TAG = "AndroidProtocolAdapter";
+public class AndroidProtocolHandler {
+ private static final String TAG = "AndroidProtocolHandler";
// Supported URL schemes. This needs to be kept in sync with
// clank/native/framework/chrome/url_request_android_job.cc.
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);
+ }
};
}
diff --git a/chrome/browser/android/android_protocol_adapter.cc b/android_webview/native/android_protocol_handler.cc
index 242da11..d8ef423 100644
--- a/chrome/browser/android/android_protocol_adapter.cc
+++ b/android_webview/native/android_protocol_handler.cc
@@ -4,16 +4,17 @@
// URL request job for reading from resources and assets.
-#include "chrome/browser/android/android_protocol_adapter.h"
+#include "android_webview/native/android_protocol_handler.h"
+#include "android_webview/common/url_constants.h"
+#include "android_webview/native/android_stream_reader_url_request_job.h"
#include "base/android/jni_android.h"
#include "base/android/jni_helper.h"
#include "base/android/jni_string.h"
#include "base/string_util.h"
-#include "chrome/browser/android/android_stream_reader_url_request_job.h"
-#include "chrome/common/url_constants.h"
+#include "content/public/common/url_constants.h"
#include "googleurl/src/gurl.h"
-#include "jni/AndroidProtocolAdapter_jni.h"
+#include "jni/AndroidProtocolHandler_jni.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
@@ -90,17 +91,12 @@ class AssetFileProtocolInterceptor :
} // namespace
-static bool InitJNIBindings(JNIEnv* env) {
- return RegisterNativesImpl(env) &&
- AndroidStreamReaderURLRequestJob::InitJNIBindings(env);
-}
-
// static
-net::URLRequestJob* AndroidProtocolAdapter::Factory(
+net::URLRequestJob* AndroidProtocolHandler::Factory(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& scheme) {
- DCHECK(scheme == chrome::kContentScheme);
+ DCHECK(scheme == android_webview::kContentScheme);
return new AndroidStreamReaderURLRequestJob(
request,
network_delegate,
@@ -116,25 +112,22 @@ static void AddFileSchemeInterceptorOnIOThread(
new AssetFileProtocolInterceptor());
}
-// static
-void AndroidProtocolAdapter::RegisterProtocols(
- JNIEnv* env, net::URLRequestContextGetter* context_getter) {
- DCHECK(env);
- if (!InitJNIBindings(env)) {
- // Must not fail.
- NOTREACHED();
- }
+bool RegisterAndroidProtocolHandler(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+// static
+void AndroidProtocolHandler::RegisterProtocols(
+ net::URLRequestContextGetter* context_getter) {
// 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
// RenderViewHost.
- //
// TODO(mnaganov): Convert into a ProtocolHandler.
net::URLRequestJobManager* job_manager =
net::URLRequestJobManager::GetInstance();
- job_manager->RegisterProtocolFactory(chrome::kContentScheme,
- &AndroidProtocolAdapter::Factory);
+ job_manager->RegisterProtocolFactory(android_webview::kContentScheme,
+ &AndroidProtocolHandler::Factory);
// Register a file: scheme interceptor for application assets.
context_getter->GetNetworkTaskRunner()->PostTask(
@@ -162,12 +155,14 @@ static void SetResourceContextForTesting(JNIEnv* env, jclass /*clazz*/,
static jstring GetAndroidAssetPath(JNIEnv* env, jclass /*clazz*/) {
// OK to release, JNI binding.
- return ConvertUTF8ToJavaString(env, chrome::kAndroidAssetPath).Release();
+ return ConvertUTF8ToJavaString(
+ env, android_webview::kAndroidAssetPath).Release();
}
static jstring GetAndroidResourcePath(JNIEnv* env, jclass /*clazz*/) {
// OK to release, JNI binding.
- return ConvertUTF8ToJavaString(env, chrome::kAndroidResourcePath).Release();
+ return ConvertUTF8ToJavaString(
+ env, android_webview::kAndroidResourcePath).Release();
}
static ScopedJavaLocalRef<jobject> GetResourceContext(JNIEnv* env) {
@@ -198,7 +193,7 @@ AndroidStreamReaderURLRequestJobDelegateImpl::OpenInputStream(
// Open the input stream.
ScopedJavaLocalRef<jstring> url =
ConvertUTF8ToJavaString(env, request->url().spec());
- ScopedJavaLocalRef<jobject> stream = Java_AndroidProtocolAdapter_open(
+ ScopedJavaLocalRef<jobject> stream = Java_AndroidProtocolHandler_open(
env,
GetResourceContext(env).obj(),
url.obj());
@@ -228,7 +223,7 @@ bool AndroidStreamReaderURLRequestJobDelegateImpl::GetMimeType(
ScopedJavaLocalRef<jstring> url =
ConvertUTF8ToJavaString(env, request->url().spec());
ScopedJavaLocalRef<jstring> returned_type =
- Java_AndroidProtocolAdapter_getMimeType(env,
+ Java_AndroidProtocolHandler_getMimeType(env,
GetResourceContext(env).obj(),
stream, url.obj());
if (ClearException(env) || returned_type.is_null())
@@ -250,10 +245,10 @@ bool AndroidStreamReaderURLRequestJobDelegateImpl::GetCharset(
AssetFileProtocolInterceptor::AssetFileProtocolInterceptor()
: asset_prefix_(std::string(chrome::kFileScheme) +
std::string(content::kStandardSchemeSeparator) +
- chrome::kAndroidAssetPath),
+ android_webview::kAndroidAssetPath),
resource_prefix_(std::string(chrome::kFileScheme) +
std::string(content::kStandardSchemeSeparator) +
- chrome::kAndroidResourcePath) {
+ android_webview::kAndroidResourcePath) {
}
AssetFileProtocolInterceptor::~AssetFileProtocolInterceptor() {
diff --git a/chrome/browser/android/android_protocol_adapter.h b/android_webview/native/android_protocol_handler.h
index 108c1c9..a60b1f1 100644
--- a/chrome/browser/android/android_protocol_adapter.h
+++ b/android_webview/native/android_protocol_handler.h
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_ANDROID_ANDROID_PROTOCOL_ADAPTER_H_
-#define CHROME_BROWSER_ANDROID_ANDROID_PROTOCOL_ADAPTER_H_
-
-#include <jni.h>
+#ifndef ANDROID_WEBVIEW_NATIVE_ANDROID_PROTOCOL_HANDLER_H_
+#define ANDROID_WEBVIEW_NATIVE_ANDROID_PROTOCOL_HANDLER_H_
+#include "base/android/jni_android.h"
#include "net/url_request/url_request.h"
namespace net {
@@ -26,16 +25,18 @@ class URLRequestContextGetter;
// http://developer.android.com/reference/android/webkit/
// WebSettings.html#setAllowFileAccess(boolean)
//
-class AndroidProtocolAdapter {
+class AndroidProtocolHandler {
public:
static net::URLRequest::ProtocolFactory Factory;
// Register handlers for all supported Android protocol schemes.
static void RegisterProtocols(
- JNIEnv* env, net::URLRequestContextGetter* context_getter);
+ net::URLRequestContextGetter* context_getter);
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(AndroidProtocolAdapter);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AndroidProtocolHandler);
};
-#endif // CHROME_BROWSER_ANDROID_ANDROID_PROTOCOL_ADAPTER_H_
+bool RegisterAndroidProtocolHandler(JNIEnv* env);
+
+#endif // ANDROID_WEBVIEW_NATIVE_ANDROID_PROTOCOL_HANDLER_H_
diff --git a/chrome/browser/android/android_stream_reader_url_request_job.cc b/android_webview/native/android_stream_reader_url_request_job.cc
index 49c1d6b..b288da6 100644
--- a/chrome/browser/android/android_stream_reader_url_request_job.cc
+++ b/android_webview/native/android_stream_reader_url_request_job.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/android/android_stream_reader_url_request_job.h"
+#include "android_webview/native/android_stream_reader_url_request_job.h"
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
@@ -38,6 +38,10 @@ const int kBufferSize = 4096;
} // namespace
+bool RegisterAndroidStreamReaderUrlRequestJob(JNIEnv* env) {
+ return JNI_InputStream::RegisterNativesImpl(env);
+}
+
AndroidStreamReaderURLRequestJob::AndroidStreamReaderURLRequestJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
@@ -50,10 +54,6 @@ AndroidStreamReaderURLRequestJob::AndroidStreamReaderURLRequestJob(
AndroidStreamReaderURLRequestJob::~AndroidStreamReaderURLRequestJob() {
}
-bool AndroidStreamReaderURLRequestJob::InitJNIBindings(JNIEnv* env) {
- return JNI_InputStream::RegisterNativesImpl(env);
-}
-
void AndroidStreamReaderURLRequestJob::Start() {
JNIEnv* env = AttachCurrentThread();
DCHECK(env);
diff --git a/chrome/browser/android/android_stream_reader_url_request_job.h b/android_webview/native/android_stream_reader_url_request_job.h
index 06394f8..2e46572 100644
--- a/chrome/browser/android/android_stream_reader_url_request_job.h
+++ b/android_webview/native/android_stream_reader_url_request_job.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_ANDROID_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
-#define CHROME_BROWSER_ANDROID_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
+#ifndef ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
+#define ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
#include "base/android/scoped_java_ref.h"
#include "base/memory/scoped_ptr.h"
@@ -48,9 +48,6 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob {
net::NetworkDelegate* network_delegate,
scoped_ptr<Delegate> delegate);
- // Register JNI methods.
- static bool InitJNIBindings(JNIEnv* env);
-
// URLRequestJob:
virtual void Start() OVERRIDE;
virtual bool ReadRawData(net::IOBuffer* buf,
@@ -79,4 +76,6 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob {
DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob);
};
-#endif // CHROME_BROWSER_ANDROID_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
+bool RegisterAndroidStreamReaderUrlRequestJob(JNIEnv* env);
+
+#endif // ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
diff --git a/android_webview/native/android_webview_jni_registrar.cc b/android_webview/native/android_webview_jni_registrar.cc
index ba497db..8e877e1 100644
--- a/android_webview/native/android_webview_jni_registrar.cc
+++ b/android_webview/native/android_webview_jni_registrar.cc
@@ -4,6 +4,8 @@
#include "android_webview/native/android_webview_jni_registrar.h"
+#include "android_webview/native/android_protocol_handler.h"
+#include "android_webview/native/android_stream_reader_url_request_job.h"
#include "android_webview/native/android_web_view_util.h"
#include "android_webview/native/aw_contents.h"
#include "android_webview/native/aw_contents_io_thread_client.h"
@@ -17,6 +19,9 @@
namespace android_webview {
static base::android::RegistrationMethod kWebViewRegisteredMethods[] = {
+ { "AndroidProtocolHandler", RegisterAndroidProtocolHandler },
+ { "AndroidStreamReaderUrlRequestJob",
+ RegisterAndroidStreamReaderUrlRequestJob },
{ "AndroidWebViewUtil", RegisterAndroidWebViewUtil },
{ "AwContents", RegisterAwContents },
{ "AwContentsIoThreadClient", RegisterAwContentsIoThreadClient},
diff --git a/android_webview/native/webview_native.gyp b/android_webview/native/webview_native.gyp
index 83a537f..57d0e89 100644
--- a/android_webview/native/webview_native.gyp
+++ b/android_webview/native/webview_native.gyp
@@ -20,6 +20,10 @@
'<(SHARED_INTERMEDIATE_DIR)/android_webview',
],
'sources': [
+ 'android_protocol_handler.cc',
+ 'android_protocol_handler.h',
+ 'android_stream_reader_url_request_job.cc',
+ 'android_stream_reader_url_request_job.h',
'android_web_view_util.cc',
'android_web_view_util.h',
'android_webview_jni_registrar.cc',
@@ -46,9 +50,20 @@
],
},
{
+ 'target_name': 'android_jar_jni_headers',
+ 'type': 'none',
+ 'variables': {
+ 'jni_gen_dir': 'android_webview',
+ 'input_java_class': 'java/io/InputStream.class',
+ 'input_jar_file': '<(android_sdk)/android.jar',
+ },
+ 'includes': [ '../../build/jar_file_jni_generator.gypi' ],
+ },
+ {
'target_name': 'android_webview_native_jni',
'type': 'none',
'sources': [
+ '../java/src/org/chromium/android_webview/AndroidProtocolHandler.java',
'../java/src/org/chromium/android_webview/AndroidWebViewUtil.java',
'../java/src/org/chromium/android_webview/AwContents.java',
'../java/src/org/chromium/android_webview/AwContentsIoThreadClient.java',
@@ -61,6 +76,9 @@
'jni_gen_dir': 'android_webview',
},
'includes': [ '../../build/jni_generator.gypi' ],
+ 'dependencies': [
+ 'android_jar_jni_headers',
+ ],
},
],
}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 8050ae7..6042d60 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -112,10 +112,6 @@
'browser/accessibility/invert_bubble_prefs.h',
'browser/alternate_nav_url_fetcher.cc',
'browser/alternate_nav_url_fetcher.h',
- 'browser/android/android_protocol_adapter.cc',
- 'browser/android/android_protocol_adapter.h',
- 'browser/android/android_stream_reader_url_request_job.cc',
- 'browser/android/android_stream_reader_url_request_job.h',
'browser/android/chrome_jni_registrar.cc',
'browser/android/chrome_jni_registrar.h',
'browser/android/chrome_startup_flags.cc',
@@ -2814,20 +2810,9 @@
['OS == "android"', {
'targets': [
{
- 'target_name': 'android_jar_jni_headers',
- 'type': 'none',
- 'variables': {
- 'jni_gen_dir': 'chrome',
- 'input_java_class': 'java/io/InputStream.class',
- 'input_jar_file': '<(android_sdk)/android.jar',
- },
- 'includes': [ '../build/jar_file_jni_generator.gypi' ],
- },
- {
'target_name': 'chrome_browser_jni_headers',
'type': 'none',
'sources': [
- 'android/java/src/org/chromium/chrome/browser/AndroidProtocolAdapter.java',
'android/java/src/org/chromium/chrome/browser/ChromeBrowserProvider.java',
'android/java/src/org/chromium/chrome/browser/ChromeHttpAuthHandler.java',
'android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java',
@@ -2842,9 +2827,6 @@
'jni_gen_dir': 'chrome',
},
'includes': [ '../build/jni_generator.gypi' ],
- 'dependencies': [
- 'android_jar_jni_headers',
- ],
},
],
},
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 5cb8234..a76bcc7 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -13,12 +13,6 @@ const char kCrosScheme[] = "cros";
const char kDriveScheme[] = "drive";
#endif
-#if defined(OS_ANDROID)
-const char kContentScheme[] = "content";
-const char kAndroidAssetPath[] = "/android_asset/";
-const char kAndroidResourcePath[] = "/android_res/";
-#endif
-
const char kAboutPluginsURL[] = "about:plugins";
const char kAboutVersionURL[] = "about:version";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index dee73b7..ab3b4df 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -402,13 +402,6 @@ extern const char kExtensionResourceScheme[];
extern const char kDriveScheme[];
#endif
-#if defined(OS_ANDROID)
-extern const char kContentScheme[];
-// Special Android file paths.
-extern const char kAndroidAssetPath[];
-extern const char kAndroidResourcePath[];
-#endif
-
#if defined(OS_CHROMEOS)
// "Learn more" URL for the Cloud Print section under Options.
extern const char kCloudPrintLearnMoreURL[];
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 5023229..bbd8208 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -209,11 +209,6 @@ void ChromeContentRendererClient::RenderThreadStarted() {
WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme);
#endif
-#if defined(OS_ANDROID)
- WebString content_scheme(ASCIIToUTF16(chrome::kContentScheme));
- WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme);
-#endif
-
// chrome: pages should not be accessible by bookmarklets or javascript:
// URLs typed in the omnibox.
WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs(