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