diff options
Diffstat (limited to 'android_webview/lib')
-rw-r--r-- | android_webview/lib/main/webview_entry_point.cc | 9 | ||||
-rw-r--r-- | android_webview/lib/main/webview_jni_onload.cc (renamed from android_webview/lib/main/webview_jni_onload_delegate.cc) | 12 | ||||
-rw-r--r-- | android_webview/lib/main/webview_jni_onload.h | 17 | ||||
-rw-r--r-- | android_webview/lib/main/webview_jni_onload_delegate.h | 22 |
4 files changed, 26 insertions, 34 deletions
diff --git a/android_webview/lib/main/webview_entry_point.cc b/android_webview/lib/main/webview_entry_point.cc index 6827ead..f9c0940 100644 --- a/android_webview/lib/main/webview_entry_point.cc +++ b/android_webview/lib/main/webview_entry_point.cc @@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/lib/main/webview_jni_onload_delegate.h" +#include "android_webview/lib/main/webview_jni_onload.h" #include "base/android/jni_android.h" +#include "base/bind.h" #include "content/public/app/content_jni_onload.h" // This is called by the VM when the shared library is first loaded. @@ -13,8 +14,10 @@ JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { // improve startup peformance. base::android::DisableManualJniRegistration(); - if (!android_webview::OnJNIOnLoad(vm)) + if (!content::android::OnJNIOnLoadRegisterJNI( + vm, base::Bind(&android_webview::RegisterJNI)) || + !content::android::OnJNIOnLoadInit(base::Bind(&android_webview::Init))) { return -1; - + } return JNI_VERSION_1_4; } diff --git a/android_webview/lib/main/webview_jni_onload_delegate.cc b/android_webview/lib/main/webview_jni_onload.cc index 94be6ab..3e01190 100644 --- a/android_webview/lib/main/webview_jni_onload_delegate.cc +++ b/android_webview/lib/main/webview_jni_onload.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 "android_webview/lib/main/webview_jni_onload_delegate.h" +#include "android_webview/lib/main/webview_jni_onload.h" #include "android_webview/lib/main/aw_main_delegate.h" #include "android_webview/native/android_webview_jni_registrar.h" @@ -10,7 +10,6 @@ #include "base/android/jni_registrar.h" #include "components/navigation_interception/component_jni_registrar.h" #include "components/web_contents_delegate_android/component_jni_registrar.h" -#include "content/public/app/content_jni_onload.h" #include "content/public/app/content_main.h" #include "url/url_util.h" @@ -28,7 +27,7 @@ static base::android::RegistrationMethod } // namespace -bool WebViewJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) { +bool RegisterJNI(JNIEnv* env) { // Register JNI for components we depend on. if (!RegisterNativeMethods( env, @@ -40,7 +39,7 @@ bool WebViewJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) { return true; } -bool WebViewJNIOnLoadDelegate::Init() { +bool Init() { content::SetContentMainDelegate(new android_webview::AwMainDelegate()); // Initialize url lib here while we are still single-threaded, in case we use @@ -50,9 +49,4 @@ bool WebViewJNIOnLoadDelegate::Init() { return true; } -bool OnJNIOnLoad(JavaVM* vm) { - WebViewJNIOnLoadDelegate delegate; - return content::android::OnJNIOnLoad(vm, &delegate); -} - } // android_webview diff --git a/android_webview/lib/main/webview_jni_onload.h b/android_webview/lib/main/webview_jni_onload.h new file mode 100644 index 0000000..5805dd3 --- /dev/null +++ b/android_webview/lib/main/webview_jni_onload.h @@ -0,0 +1,17 @@ +// 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. + +#ifndef ANDROID_WEBVIEW_LIB_MAIN_WEBVIEW_JNI_ONLOAD__H_ +#define ANDROID_WEBVIEW_LIB_MAIN_WEBVIEW_JNI_ONLOAD__H_ + +#include <jni.h> + +namespace android_webview { + +bool RegisterJNI(JNIEnv* env); +bool Init(); + +} // android_webview + +#endif // ANDROID_WEBVIEW_LIB_MAIN_WEBVIEW_JNI_ONLOAD__H_ diff --git a/android_webview/lib/main/webview_jni_onload_delegate.h b/android_webview/lib/main/webview_jni_onload_delegate.h deleted file mode 100644 index 6307910..0000000 --- a/android_webview/lib/main/webview_jni_onload_delegate.h +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -#ifndef ANDROID_WEBVIEW_LIB_MAIN_JNI_ONLOAD_DELEGATE_H_ -#define ANDROID_WEBVIEW_LIB_MAIN_JNI_ONLOAD_DELEGATE_H_ - -#include "base/android/jni_onload_delegate.h" - -namespace android_webview { - -class WebViewJNIOnLoadDelegate : public base::android::JNIOnLoadDelegate { - public: - bool RegisterJNI(JNIEnv* env) override; - bool Init() override; -}; - -bool OnJNIOnLoad(JavaVM* vm); - -} // android_webview - -#endif // ANDROID_WEBVIEW_LIB_MAIN_JNI_ONLOAD_DELEGATE_H_ |