diff options
author | ben <ben@chromium.org> | 2016-01-25 17:44:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-26 01:45:26 +0000 |
commit | f7946d59b741c0ceec77c5118c195950affba71f (patch) | |
tree | b8c1df9ccd79c22c19ced58222a05a18fc69b011 /mojo/shell/standalone/android/library_loader.cc | |
parent | cc3c3267d1aed05830c9b891ad3d413cae3b10b6 (diff) | |
download | chromium_src-f7946d59b741c0ceec77c5118c195950affba71f.zip chromium_src-f7946d59b741c0ceec77c5118c195950affba71f.tar.gz chromium_src-f7946d59b741c0ceec77c5118c195950affba71f.tar.bz2 |
Move mojo/runner to mojo/shell/standalone
BUG=
Review URL: https://codereview.chromium.org/1630823002
Cr-Commit-Position: refs/heads/master@{#371411}
Diffstat (limited to 'mojo/shell/standalone/android/library_loader.cc')
-rw-r--r-- | mojo/shell/standalone/android/library_loader.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mojo/shell/standalone/android/library_loader.cc b/mojo/shell/standalone/android/library_loader.cc new file mode 100644 index 0000000..9ef3d97 --- /dev/null +++ b/mojo/shell/standalone/android/library_loader.cc @@ -0,0 +1,46 @@ +// Copyright 2013 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 "base/android/base_jni_onload.h" +#include "base/android/base_jni_registrar.h" +#include "base/android/jni_android.h" +#include "base/android/jni_registrar.h" +#include "base/bind.h" +#include "mojo/shell/standalone/android/android_handler.h" +#include "mojo/shell/standalone/android/main.h" +#include "ui/platform_window/android/platform_ime_controller_android.h" +#include "ui/platform_window/android/platform_window_android.h" + +namespace { + +base::android::RegistrationMethod kMojoRegisteredMethods[] = { + {"AndroidHandler", mojo::shell::RegisterAndroidHandlerJni}, + {"PlatformImeControllerAndroid", + ui::PlatformImeControllerAndroid::Register}, + {"PlatformWindowAndroid", ui::PlatformWindowAndroid::Register}, + {"ShellMain", mojo::shell::RegisterShellMain}, +}; + +bool RegisterJNI(JNIEnv* env) { + if (!base::android::RegisterJni(env)) + return false; + + return RegisterNativeMethods(env, kMojoRegisteredMethods, + arraysize(kMojoRegisteredMethods)); +} + +} // namespace + +// This is called by the VM when the shared library is first loaded. +JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { + std::vector<base::android::RegisterCallback> register_callbacks; + register_callbacks.push_back(base::Bind(&RegisterJNI)); + if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || + !base::android::OnJNIOnLoadInit( + std::vector<base::android::InitCallback>())) { + return -1; + } + + return JNI_VERSION_1_4; +} |