OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/basictypes.h" |
| 6 #include "base/android/jni_android.h" |
| 7 #include "base/android/jni_registrar.h" |
| 8 #include "content/public/browser/android_library_loader_hooks.h" |
| 9 #include "content/shell/shell_main_delegate.h" |
| 10 #include "content/shell/android/shell_manager.h" |
| 11 #include "content/shell/android/shell_view.h" |
| 12 |
| 13 static base::android::RegistrationMethod kRegistrationMethods[] = { |
| 14 { "ShellManager", content::RegisterShellManager }, |
| 15 { "ShellView", content::ShellView::Register }, |
| 16 }; |
| 17 |
| 18 // This is called by the VM when the shared library is first loaded. |
| 19 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 20 base::android::InitVM(vm); |
| 21 JNIEnv* env = base::android::AttachCurrentThread(); |
| 22 if (!RegisterLibraryLoaderEntryHook(env)) { |
| 23 return -1; |
| 24 } |
| 25 |
| 26 // To be called only from the UI thread. If loading the library is done on |
| 27 // a separate thread, this should be moved elsewhere. |
| 28 if (!base::android::RegisterNativeMethods(env, kRegistrationMethods, |
| 29 arraysize(kRegistrationMethods))) |
| 30 return -1; |
| 31 |
| 32 // TODO(tedchoc): Set this to the main delegate once the Android specific |
| 33 // browser process initialization gets checked in. |
| 34 new ShellMainDelegate(); |
| 35 |
| 36 return JNI_VERSION_1_4; |
| 37 } |
OLD | NEW |