Chromium Code Reviews| 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 1d6e8a1f2d57abac40775bd0c498fc3ef586aa4b..a3cc2ea65e80d75e39bf2a43c92612064ad735ee 100644 |
| --- a/chrome/app/android/chrome_jni_onload.cc |
| +++ b/chrome/app/android/chrome_jni_onload.cc |
| @@ -2,16 +2,37 @@ |
| // 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 "base/android/jni_onload_delegate.h" |
| #include "chrome/app/android/chrome_android_initializer.h" |
| -#include "chrome/app/android/chrome_main_delegate_android.h" |
| +#include "content/public/app/content_jni_onload.h" |
| + |
| +namespace { |
| + |
| +class ChromeJNIOnLoadDelegate : public base::android::JNIOnLoadDelegate { |
| + public: |
| + virtual bool RegisterJNI(JNIEnv* env) override; |
|
David Trainor- moved to gerrit
2015/01/28 19:13:25
I'm not 100% sure, but I just looked at web_conten
michaelbai
2015/01/28 19:50:58
Done.
|
| + virtual bool Init() override; |
| +}; |
| + |
| +bool ChromeJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) { |
| + return true; |
| +} |
| + |
| +bool ChromeJNIOnLoadDelegate::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. |
| -// Note that this file must be included in the final shared_library build step |
| -// and not in a static library or the JNI_OnLoad symbol won't be included |
| -// because the Android build is compiled with exclude-libs=ALL to reduce symbol |
| -// size. |
| JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| - return RunChrome(vm, ChromeMainDelegateAndroid::Create()); |
| + ChromeJNIOnLoadDelegate delegate; |
| + if (!content::android::OnJNIOnLoad(vm, &delegate)) |
| + return -1; |
| + |
| + return JNI_VERSION_1_4; |
| } |