OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/public/app/content_jni_onload.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "base/android/base_jni_onload.h" |
| 10 #include "base/android/jni_onload_delegate.h" |
| 11 #include "base/android/library_loader/library_loader_hooks.h" |
| 12 #include "content/public/app/android_library_loader_hooks.h" |
| 13 #include "content/public/app/content_main.h" |
| 14 |
| 15 namespace content { |
| 16 namespace android { |
| 17 |
| 18 namespace { |
| 19 |
| 20 class ContentJNIOnLoadDelegate |
| 21 : public base::android::JNIOnLoadDelegate { |
| 22 public: |
| 23 bool RegisterJNI(JNIEnv* env) override; |
| 24 bool Init() override; |
| 25 }; |
| 26 |
| 27 bool ContentJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) { |
| 28 // TODO(michaelbai): Remove the EnsureJniRegistered from |
| 29 // content::LibraryLoaded and move android_library_loader_hooks.h to |
| 30 // content/app/android/. |
| 31 return content::EnsureJniRegistered(env); |
| 32 } |
| 33 |
| 34 bool ContentJNIOnLoadDelegate::Init() { |
| 35 base::android::SetLibraryLoadedHook(&content::LibraryLoaded); |
| 36 return true; |
| 37 } |
| 38 |
| 39 } // namespace |
| 40 |
| 41 |
| 42 bool OnJNIOnLoad(JavaVM* vm, |
| 43 base::android::JNIOnLoadDelegate* delegate) { |
| 44 std::vector<base::android::JNIOnLoadDelegate*> delegates; |
| 45 ContentJNIOnLoadDelegate content_delegate; |
| 46 delegates.push_back(delegate); |
| 47 delegates.push_back(&content_delegate); |
| 48 return base::android::OnJNIOnLoad(vm, &delegates); |
| 49 } |
| 50 |
| 51 } // namespace android |
| 52 } // namespace content |
OLD | NEW |