| 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 "android_webview/lib/main/webview_jni_onload.h" | |
| 6 | |
| 7 #include "android_webview/browser/android_webview_jni_registrar.h" | |
| 8 #include "android_webview/common/aw_version_info_values.h" | |
| 9 #include "android_webview/lib/main/aw_main_delegate.h" | |
| 10 #include "base/android/jni_android.h" | |
| 11 #include "base/android/jni_registrar.h" | |
| 12 #include "base/android/library_loader/library_loader_hooks.h" | |
| 13 #include "base/bind.h" | |
| 14 #include "components/web_contents_delegate_android/component_jni_registrar.h" | |
| 15 #include "content/public/app/content_jni_onload.h" | |
| 16 #include "content/public/app/content_main.h" | |
| 17 #include "url/url_util.h" | |
| 18 | |
| 19 namespace android_webview { | |
| 20 | |
| 21 namespace { | |
| 22 | |
| 23 static base::android::RegistrationMethod | |
| 24 kWebViewDependencyRegisteredMethods[] = { | |
| 25 { "WebContentsDelegateAndroid", | |
| 26 web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni }, | |
| 27 }; | |
| 28 | |
| 29 } // namespace | |
| 30 | |
| 31 bool OnJNIOnLoadRegisterJNI(JNIEnv* env) { | |
| 32 if (!content::android::OnJNIOnLoadRegisterJNI(env)) | |
| 33 return false; | |
| 34 | |
| 35 // Register JNI for components we depend on. | |
| 36 if (!RegisterNativeMethods( | |
| 37 env, | |
| 38 kWebViewDependencyRegisteredMethods, | |
| 39 arraysize(kWebViewDependencyRegisteredMethods)) || | |
| 40 !android_webview::RegisterJni(env)) { | |
| 41 return false; | |
| 42 } | |
| 43 return true; | |
| 44 } | |
| 45 | |
| 46 bool OnJNIOnLoadInit() { | |
| 47 if (!content::android::OnJNIOnLoadInit()) | |
| 48 return false; | |
| 49 | |
| 50 base::android::SetVersionNumber(PRODUCT_VERSION); | |
| 51 content::SetContentMainDelegate(new android_webview::AwMainDelegate()); | |
| 52 | |
| 53 // Initialize url lib here while we are still single-threaded, in case we use | |
| 54 // CookieManager before initializing Chromium (which would normally have done | |
| 55 // this). It's safe to call this multiple times. | |
| 56 url::Initialize(); | |
| 57 return true; | |
| 58 } | |
| 59 | |
| 60 } // android_webview | |
| OLD | NEW |