| Index: chrome/app/android/chrome_jni_onload.cc
|
| diff --git a/chrome/app/android/chrome_jni_onload.cc b/chrome/app/android/chrome_jni_onload.cc
|
| index a2052da67673cae567b48547170c97d0e460c3fd..124e3c2b7f05c18d9462228fddad4d7ba680b511 100644
|
| --- a/chrome/app/android/chrome_jni_onload.cc
|
| +++ b/chrome/app/android/chrome_jni_onload.cc
|
| @@ -2,35 +2,48 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/android/jni_android.h"
|
| +#include "chrome/app/android/chrome_jni_onload.h"
|
| +
|
| +#include "base/android/library_loader/library_loader_hooks.h"
|
| #include "base/bind.h"
|
| #include "chrome/app/android/chrome_android_initializer.h"
|
| +#include "chrome/browser/android/chrome_jni_registrar.h"
|
| #include "content/public/app/content_jni_onload.h"
|
|
|
| +namespace chrome {
|
| +namespace android {
|
| +
|
| namespace {
|
|
|
| bool RegisterJNI(JNIEnv* env) {
|
| + if (base::android::GetLibraryProcessType(env) ==
|
| + base::android::PROCESS_BROWSER) {
|
| + return RegisterBrowserJNI(env);
|
| + }
|
| return true;
|
| }
|
|
|
| bool Init() {
|
| - // TODO(michaelbai): Move the JNI registration from RunChrome() to
|
| - // RegisterJNI().
|
| return RunChrome();
|
| }
|
|
|
| } // namespace
|
|
|
| -
|
| -// This is called by the VM when the shared library is first loaded.
|
| -JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
| +bool OnJNIOnLoadRegisterJNI(
|
| + JavaVM* vm,
|
| + base::android::RegisterCallback callback) {
|
| std::vector<base::android::RegisterCallback> register_callbacks;
|
| + register_callbacks.push_back(callback);
|
| register_callbacks.push_back(base::Bind(&RegisterJNI));
|
| + return content::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks);
|
| +}
|
| +
|
| +bool OnJNIOnLoadInit(base::android::InitCallback callback) {
|
| std::vector<base::android::InitCallback> init_callbacks;
|
| + init_callbacks.push_back(callback);
|
| init_callbacks.push_back(base::Bind(&Init));
|
| - if (!content::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
|
| - !content::android::OnJNIOnLoadInit(init_callbacks)) {
|
| - return -1;
|
| - }
|
| - return JNI_VERSION_1_4;
|
| + return content::android::OnJNIOnLoadInit(init_callbacks);
|
| }
|
| +
|
| +} // namespace android
|
| +} // namespace chrome
|
|
|