| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/app/content_jni_onload.h" | 5 #include "content/public/app/content_jni_onload.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/android/base_jni_onload.h" | 9 #include "base/android/base_jni_onload.h" |
| 10 #include "base/android/jni_android.h" |
| 10 #include "base/android/library_loader/library_loader_hooks.h" | 11 #include "base/android/library_loader/library_loader_hooks.h" |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "content/app/android/library_loader_hooks.h" | 13 #include "content/app/android/library_loader_hooks.h" |
| 13 #include "content/public/app/content_main.h" | 14 #include "content/public/app/content_main.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 namespace android { | 17 namespace android { |
| 17 | 18 |
| 18 namespace { | 19 bool OnJNIOnLoadRegisterJNI(JavaVM* vm) { |
| 20 if (!base::android::OnJNIOnLoadRegisterJNI(vm)) |
| 21 return false; |
| 19 | 22 |
| 20 bool RegisterJNI(JNIEnv* env) { | 23 return content::EnsureJniRegistered(base::android::AttachCurrentThread()); |
| 21 return content::EnsureJniRegistered(env); | |
| 22 } | 24 } |
| 23 | 25 |
| 24 bool Init() { | 26 bool OnJNIOnLoadInit() { |
| 27 if (!base::android::OnJNIOnLoadInit()) |
| 28 return false; |
| 29 |
| 25 base::android::SetLibraryLoadedHook(&content::LibraryLoaded); | 30 base::android::SetLibraryLoadedHook(&content::LibraryLoaded); |
| 26 return true; | 31 return true; |
| 27 } | 32 } |
| 28 | 33 |
| 29 } // namespace | |
| 30 | |
| 31 | |
| 32 bool OnJNIOnLoadRegisterJNI( | |
| 33 JavaVM* vm, | |
| 34 std::vector<base::android::RegisterCallback> callbacks) { | |
| 35 callbacks.push_back(base::Bind(&RegisterJNI)); | |
| 36 return base::android::OnJNIOnLoadRegisterJNI(vm, callbacks); | |
| 37 } | |
| 38 | |
| 39 bool OnJNIOnLoadInit( | |
| 40 std::vector<base::android::InitCallback> callbacks) { | |
| 41 callbacks.push_back(base::Bind(&Init)); | |
| 42 return base::android::OnJNIOnLoadInit(callbacks); | |
| 43 } | |
| 44 | |
| 45 } // namespace android | 34 } // namespace android |
| 46 } // namespace content | 35 } // namespace content |
| OLD | NEW |