Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1448)

Unified Diff: mojo/shell/android/library_loader.cc

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/android/keyboard_impl.cc ('k') | mojo/shell/android/main.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/android/library_loader.cc
diff --git a/mojo/shell/android/library_loader.cc b/mojo/shell/android/library_loader.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cd3f7d248e817714aae7e9cd29b61d30e0c8d641
--- /dev/null
+++ b/mojo/shell/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/services/native_viewport/platform_viewport_android.h"
+#include "mojo/shell/android/android_handler.h"
+#include "mojo/shell/android/keyboard_impl.h"
+#include "mojo/shell/android/main.h"
+
+namespace {
+
+base::android::RegistrationMethod kMojoRegisteredMethods[] = {
+ {"AndroidHandler", mojo::shell::RegisterAndroidHandlerJni},
+ {"Keyboard", mojo::shell::RegisterKeyboardJni},
+ {"PlatformViewportAndroid",
+ native_viewport::PlatformViewportAndroid::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;
+}
« no previous file with comments | « mojo/shell/android/keyboard_impl.cc ('k') | mojo/shell/android/main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698