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

Side by Side Diff: android_webview/lib/main/webview_jni_onload_delegate.cc

Issue 935413004: Separate OnJNIOnLoad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « android_webview/lib/main/webview_jni_onload_delegate.h ('k') | base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_delegate.h"
6
7 #include "android_webview/lib/main/aw_main_delegate.h"
8 #include "android_webview/native/android_webview_jni_registrar.h"
9 #include "base/android/jni_android.h"
10 #include "base/android/jni_registrar.h"
11 #include "components/navigation_interception/component_jni_registrar.h"
12 #include "components/web_contents_delegate_android/component_jni_registrar.h"
13 #include "content/public/app/content_jni_onload.h"
14 #include "content/public/app/content_main.h"
15 #include "url/url_util.h"
16
17 namespace android_webview {
18
19 namespace {
20
21 static base::android::RegistrationMethod
22 kWebViewDependencyRegisteredMethods[] = {
23 { "NavigationInterception",
24 navigation_interception::RegisterNavigationInterceptionJni },
25 { "WebContentsDelegateAndroid",
26 web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni },
27 };
28
29 } // namespace
30
31 bool WebViewJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) {
32 // Register JNI for components we depend on.
33 if (!RegisterNativeMethods(
34 env,
35 kWebViewDependencyRegisteredMethods,
36 arraysize(kWebViewDependencyRegisteredMethods)) ||
37 !android_webview::RegisterJni(env)) {
38 return false;
39 }
40 return true;
41 }
42
43 bool WebViewJNIOnLoadDelegate::Init() {
44 content::SetContentMainDelegate(new android_webview::AwMainDelegate());
45
46 // Initialize url lib here while we are still single-threaded, in case we use
47 // CookieManager before initializing Chromium (which would normally have done
48 // this). It's safe to call this multiple times.
49 url::Initialize();
50 return true;
51 }
52
53 bool OnJNIOnLoad(JavaVM* vm) {
54 WebViewJNIOnLoadDelegate delegate;
55 return content::android::OnJNIOnLoad(vm, &delegate);
56 }
57
58 } // android_webview
OLDNEW
« no previous file with comments | « android_webview/lib/main/webview_jni_onload_delegate.h ('k') | base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698