1 // Copyright (c) 2012 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.
5 #include "chrome/browser/android/chrome_jni_registrar.h"
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_registrar.h"
9 #include "base/debug/trace_event.h"
10 #include "chrome/browser/android/accessibility_util.h"
11 #include "chrome/browser/android/banners/app_banner_manager.h"
12 #include "chrome/browser/android/bookmarks/bookmarks_bridge.h"
13 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
14 #include "chrome/browser/android/chromium_application.h"
15 #include "chrome/browser/android/content_view_util.h"
16 #include "chrome/browser/android/dev_tools_server.h"
17 #include "chrome/browser/android/dom_distiller/feedback_reporter_android.h"
18 #include "chrome/browser/android/favicon_helper.h"
19 #include "chrome/browser/android/field_trial_helper.h"
20 #include "chrome/browser/android/foreign_session_helper.h"
21 #include "chrome/browser/android/intent_helper.h"
22 #include "chrome/browser/android/logo_bridge.h"
23 #include "chrome/browser/android/most_visited_sites.h"
24 #include "chrome/browser/android/new_tab_page_prefs.h"
25 #include "chrome/browser/android/omnibox/omnibox_prerender.h"
26 #include "chrome/browser/android/password_authentication_manager.h"
27 #include "chrome/browser/android/password_ui_view_android.h"
28 #include "chrome/browser/android/profiles/profile_downloader_android.h"
29 #include "chrome/browser/android/provider/chrome_browser_provider.h"
30 #include "chrome/browser/android/recently_closed_tabs_bridge.h"
31 #include "chrome/browser/android/shortcut_helper.h"
32 #include "chrome/browser/android/signin/account_management_screen_helper.h"
33 #include "chrome/browser/android/signin/signin_manager_android.h"
34 #include "chrome/browser/android/tab_android.h"
35 #include "chrome/browser/android/uma_bridge.h"
36 #include "chrome/browser/android/uma_utils.h"
37 #include "chrome/browser/android/url_utilities.h"
38 #include "chrome/browser/android/voice_search_tab_helper.h"
39 #include "chrome/browser/autofill/android/personal_data_manager_android.h"
40 #include "chrome/browser/history/android/sqlite_cursor.h"
41 #include "chrome/browser/invalidation/invalidation_controller_android.h"
42 #include "chrome/browser/lifetime/application_lifetime_android.h"
43 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h"
44 #include "chrome/browser/prerender/external_prerender_handler_android.h"
45 #include "chrome/browser/profiles/profile_android.h"
46 #include "chrome/browser/search_engines/template_url_service_android.h"
47 #include "chrome/browser/signin/android_profile_oauth2_token_service.h"
48 #include "chrome/browser/speech/tts_android.h"
49 #include "chrome/browser/sync/profile_sync_service_android.h"
50 #include "chrome/browser/ui/android/autofill/autofill_dialog_controller_android.h"
51 #include "chrome/browser/ui/android/autofill/autofill_dialog_result.h"
52 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h"
53 #include "chrome/browser/ui/android/autofill/autofill_popup_view_android.h"
54 #include "chrome/browser/ui/android/chrome_http_auth_handler.h"
55 #include "chrome/browser/ui/android/context_menu_helper.h"
56 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.h"
57 #include "chrome/browser/ui/android/infobars/confirm_infobar.h"
58 #include "chrome/browser/ui/android/infobars/infobar_android.h"
59 #include "chrome/browser/ui/android/infobars/infobar_container_android.h"
60 #include "chrome/browser/ui/android/infobars/save_password_infobar.h"
61 #include "chrome/browser/ui/android/infobars/translate_infobar.h"
62 #include "chrome/browser/ui/android/javascript_app_modal_dialog_android.h"
63 #include "chrome/browser/ui/android/navigation_popup.h"
64 #include "chrome/browser/ui/android/ssl_client_certificate_request.h"
65 #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h"
66 #include "chrome/browser/ui/android/website_settings_popup_android.h"
67 #include "components/autofill/core/browser/android/component_jni_registrar.h"
68 #include "components/dom_distiller/android/component_jni_registrar.h"
69 #include "components/navigation_interception/component_jni_registrar.h"
70 #include "components/web_contents_delegate_android/component_jni_registrar.h"
72 #if defined(ENABLE_PRINTING) && !defined(ENABLE_FULL_PRINTING)
73 #include "printing/printing_context_android.h"
76 bool RegisterCertificateViewer(JNIEnv
* env
);
81 static base::android::RegistrationMethod kChromeRegisteredMethods
[] = {
82 // Register JNI for components we depend on.
83 { "DomDistiller", dom_distiller::android::RegisterDomDistiller
},
84 { "NavigationInterception",
85 navigation_interception::RegisterNavigationInterceptionJni
},
86 { "WebContentsDelegateAndroid",
87 web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni
},
88 { "RegisterAuxiliaryProfileLoader", autofill::RegisterAutofillAndroidJni
},
89 // Register JNI for chrome classes.
90 { "AccessibilityUtils", AccessibilityUtil::Register
},
91 { "AccountManagementScreenHelper", AccountManagementScreenHelper::Register
},
92 { "AndroidProfileOAuth2TokenService",
93 AndroidProfileOAuth2TokenService::Register
},
94 { "AppBannerManager", banners::RegisterAppBannerManager
},
95 { "ApplicationLifetime", RegisterApplicationLifetimeAndroid
},
96 { "AutofillDialogControllerAndroid",
97 autofill::AutofillDialogControllerAndroid::
98 RegisterAutofillDialogControllerAndroid
},
99 { "AutofillDialogResult",
100 autofill::AutofillDialogResult::RegisterAutofillDialogResult
},
101 { "AutofillLoggerAndroid",
102 autofill::AutofillLoggerAndroid::Register
},
104 autofill::AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid
},
105 { "AutoLoginDelegate", AutoLoginInfoBarDelegateAndroid::Register
},
106 { "BookmarksBridge", BookmarksBridge::RegisterBookmarksBridge
},
107 { "CertificateViewer", RegisterCertificateViewer
},
108 { "ChromeBrowserProvider",
109 ChromeBrowserProvider::RegisterChromeBrowserProvider
},
110 { "ChromeHttpAuthHandler",
111 ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler
},
112 { "ChromeWebContentsDelegateAndroid",
113 RegisterChromeWebContentsDelegateAndroid
},
114 { "ChromiumApplication",
115 ChromiumApplication::RegisterBindings
},
116 { "ConfirmInfoBarDelegate", RegisterConfirmInfoBarDelegate
},
117 { "ContentViewUtil", RegisterContentViewUtil
},
118 { "ContextMenuHelper", RegisterContextMenuHelper
},
119 { "DataReductionProxySettings", DataReductionProxySettingsAndroid::Register
},
120 { "DevToolsServer", RegisterDevToolsServer
},
121 { "ExternalPrerenderRequestHandler",
122 prerender::ExternalPrerenderHandlerAndroid::
123 RegisterExternalPrerenderHandlerAndroid
},
124 { "FaviconHelper", FaviconHelper::RegisterFaviconHelper
},
125 { "FeedbackReporter", dom_distiller::android::RegisterFeedbackReporter
},
126 { "FieldTrialHelper", RegisterFieldTrialHelper
},
127 { "ForeignSessionHelper",
128 ForeignSessionHelper::RegisterForeignSessionHelper
},
129 { "InfoBarContainer", RegisterInfoBarContainer
},
130 { "ShortcutHelper", ShortcutHelper::RegisterShortcutHelper
},
131 { "IntentHelper", RegisterIntentHelper
},
132 { "InvalidationController", invalidation::RegisterInvalidationController
},
133 { "JavascriptAppModalDialog",
134 JavascriptAppModalDialogAndroid::RegisterJavascriptAppModalDialog
},
135 { "LogoBridge", RegisterLogoBridge
},
136 { "MostVisitedSites", MostVisitedSites::Register
},
137 { "NativeInfoBar", RegisterNativeInfoBar
},
138 { "NavigationPopup", NavigationPopup::RegisterNavigationPopup
},
140 NewTabPagePrefs::RegisterNewTabPagePrefs
},
141 { "OmniboxPrerender", RegisterOmniboxPrerender
},
142 { "PasswordAuthenticationManager",
143 PasswordAuthenticationManager::RegisterPasswordAuthenticationManager
},
144 { "PasswordUIViewAndroid",
145 PasswordUIViewAndroid::RegisterPasswordUIViewAndroid
},
146 { "PersonalDataManagerAndroid",
147 autofill::PersonalDataManagerAndroid::Register
},
148 { "ProfileAndroid", ProfileAndroid::RegisterProfileAndroid
},
149 { "ProfileDownloaderAndroid", ProfileDownloaderAndroid::Register
},
150 { "ProfileSyncService", ProfileSyncServiceAndroid::Register
},
151 { "RecentlyClosedBridge", RecentlyClosedTabsBridge::Register
},
152 { "SavePasswordInfoBar", RegisterSavePasswordInfoBar
},
153 { "SigninManager", SigninManagerAndroid::Register
},
154 { "SqliteCursor", SQLiteCursor::RegisterSqliteCursor
},
155 { "SSLClientCertificateRequest", RegisterSSLClientCertificateRequestAndroid
},
156 { "StartupMetricUtils", RegisterStartupMetricUtils
},
157 { "TabAndroid", TabAndroid::RegisterTabAndroid
},
158 { "TemplateUrlServiceAndroid", TemplateUrlServiceAndroid::Register
},
159 { "ToolbarModelAndroid", ToolbarModelAndroid::RegisterToolbarModelAndroid
},
160 { "TranslateInfoBarDelegate", RegisterTranslateInfoBarDelegate
},
161 { "TtsPlatformImpl", TtsPlatformImplAndroid::Register
},
162 { "UmaBridge", RegisterUmaBridge
},
163 { "UrlUtilities", RegisterUrlUtilities
},
164 { "VoiceSearchTabHelper", RegisterVoiceSearchTabHelper
},
165 { "WebsiteSettingsPopupAndroid",
166 WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid
},
167 #if defined(ENABLE_PRINTING) && !defined(ENABLE_FULL_PRINTING)
169 printing::PrintingContextAndroid::RegisterPrintingContext
},
173 bool RegisterJni(JNIEnv
* env
) {
174 TRACE_EVENT0("startup", "chrome_android::RegisterJni");
175 return RegisterNativeMethods(env
, kChromeRegisteredMethods
,
176 arraysize(kChromeRegisteredMethods
));
179 } // namespace android
180 } // namespace chrome