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/trace_event/trace_event.h"
10 #include "chrome/browser/android/accessibility/font_size_prefs_android.h"
11 #include "chrome/browser/android/accessibility_util.h"
12 #include "chrome/browser/android/appmenu/app_menu_drag_helper.h"
13 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
14 #include "chrome/browser/android/banners/app_banner_manager_android.h"
15 #include "chrome/browser/android/bookmarks/bookmarks_bridge.h"
16 #include "chrome/browser/android/bookmarks/partner_bookmarks_reader.h"
17 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
18 #include "chrome/browser/android/chromium_application.h"
19 #include "chrome/browser/android/compositor/layer_title_cache.h"
20 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h"
21 #include "chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h"
22 #include "chrome/browser/android/compositor/tab_content_manager.h"
23 #include "chrome/browser/android/content_view_util.h"
24 #include "chrome/browser/android/cookies/cookies_fetcher.h"
25 #include "chrome/browser/android/dev_tools_server.h"
26 #include "chrome/browser/android/dom_distiller/external_feedback_reporter_android.h"
27 #include "chrome/browser/android/download/chrome_download_delegate.h"
28 #include "chrome/browser/android/favicon_helper.h"
29 #include "chrome/browser/android/feature_utilities.h"
30 #include "chrome/browser/android/feedback/connectivity_checker.h"
31 #include "chrome/browser/android/find_in_page/find_in_page_bridge.h"
32 #include "chrome/browser/android/foreign_session_helper.h"
33 #include "chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h"
34 #include "chrome/browser/android/history_report/history_report_jni_bridge.h"
35 #include "chrome/browser/android/intent_helper.h"
36 #include "chrome/browser/android/java_exception_reporter.h"
37 #include "chrome/browser/android/large_icon_bridge.h"
38 #include "chrome/browser/android/location_settings_impl.h"
39 #include "chrome/browser/android/logo_bridge.h"
40 #include "chrome/browser/android/metrics/launch_metrics.h"
41 #include "chrome/browser/android/metrics/uma_session_stats.h"
42 #include "chrome/browser/android/metrics/uma_utils.h"
43 #include "chrome/browser/android/metrics/variations_session.h"
44 #include "chrome/browser/android/most_visited_sites.h"
45 #include "chrome/browser/android/new_tab_page_prefs.h"
46 #include "chrome/browser/android/omnibox/answers_image_bridge.h"
47 #include "chrome/browser/android/omnibox/autocomplete_controller_android.h"
48 #include "chrome/browser/android/omnibox/omnibox_prerender.h"
49 #include "chrome/browser/android/password_ui_view_android.h"
50 #include "chrome/browser/android/policy/policy_manager.h"
51 #include "chrome/browser/android/precache/precache_launcher.h"
52 #include "chrome/browser/android/preferences/autofill/autofill_profile_bridge.h"
53 #include "chrome/browser/android/preferences/pref_service_bridge.h"
54 #include "chrome/browser/android/preferences/website_preference_bridge.h"
55 #include "chrome/browser/android/profiles/profile_downloader_android.h"
56 #include "chrome/browser/android/provider/chrome_browser_provider.h"
57 #include "chrome/browser/android/recently_closed_tabs_bridge.h"
58 #include "chrome/browser/android/shortcut_helper.h"
59 #include "chrome/browser/android/signin/account_management_screen_helper.h"
60 #include "chrome/browser/android/signin/signin_manager_android.h"
61 #include "chrome/browser/android/tab/background_content_view_helper.h"
62 #include "chrome/browser/android/tab_android.h"
63 #include "chrome/browser/android/tab_state.h"
64 #include "chrome/browser/android/url_utilities.h"
65 #include "chrome/browser/android/voice_search_tab_helper.h"
66 #include "chrome/browser/android/warmup_manager.h"
67 #include "chrome/browser/autofill/android/personal_data_manager_android.h"
68 #include "chrome/browser/dom_distiller/dom_distiller_service_factory_android.h"
69 #include "chrome/browser/dom_distiller/tab_utils_android.h"
70 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h"
71 #include "chrome/browser/history/android/sqlite_cursor.h"
72 #include "chrome/browser/invalidation/invalidation_service_factory_android.h"
73 #include "chrome/browser/lifetime/application_lifetime_android.h"
74 #include "chrome/browser/media/android/remote/record_cast_action.h"
75 #include "chrome/browser/media/android/remote/remote_media_player_bridge.h"
76 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h"
77 #include "chrome/browser/notifications/notification_ui_manager_android.h"
78 #include "chrome/browser/password_manager/credential_android.h"
79 #include "chrome/browser/prerender/external_prerender_handler_android.h"
80 #include "chrome/browser/profiles/profile_android.h"
81 #include "chrome/browser/search_engines/template_url_service_android.h"
82 #include "chrome/browser/signin/android_profile_oauth2_token_service.h"
83 #include "chrome/browser/speech/tts_android.h"
84 #include "chrome/browser/ssl/connection_security_helper_android.h"
85 #include "chrome/browser/supervised_user/child_accounts/child_account_feedback_reporter_android.h"
86 #include "chrome/browser/supervised_user/child_accounts/child_account_service_android.h"
87 #include "chrome/browser/sync/profile_sync_service_android.h"
88 #include "chrome/browser/ui/android/autofill/autofill_dialog_controller_android.h"
89 #include "chrome/browser/ui/android/autofill/autofill_dialog_result.h"
90 #include "chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h"
91 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h"
92 #include "chrome/browser/ui/android/autofill/autofill_popup_view_android.h"
93 #include "chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.h"
94 #include "chrome/browser/ui/android/autofill/credit_card_scanner_view_android.h"
95 #include "chrome/browser/ui/android/autofill/password_generation_popup_view_android.h"
96 #include "chrome/browser/ui/android/certificate_viewer_android.h"
97 #include "chrome/browser/ui/android/chrome_http_auth_handler.h"
98 #include "chrome/browser/ui/android/connection_info_popup_android.h"
99 #include "chrome/browser/ui/android/context_menu_helper.h"
100 #include "chrome/browser/ui/android/infobars/account_chooser_infobar.h"
101 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h"
102 #include "chrome/browser/ui/android/infobars/confirm_infobar.h"
103 #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h"
104 #include "chrome/browser/ui/android/infobars/download_overwrite_infobar.h"
105 #include "chrome/browser/ui/android/infobars/generated_password_saved_infobar.h"
106 #include "chrome/browser/ui/android/infobars/infobar_android.h"
107 #include "chrome/browser/ui/android/infobars/infobar_container_android.h"
108 #include "chrome/browser/ui/android/infobars/save_password_infobar.h"
109 #include "chrome/browser/ui/android/infobars/translate_infobar.h"
110 #include "chrome/browser/ui/android/javascript_app_modal_dialog_android.h"
111 #include "chrome/browser/ui/android/navigation_popup.h"
112 #include "chrome/browser/ui/android/omnibox/omnibox_url_emphasizer.h"
113 #include "chrome/browser/ui/android/omnibox/omnibox_view_util.h"
114 #include "chrome/browser/ui/android/ssl_client_certificate_request.h"
115 #include "chrome/browser/ui/android/tab_model/single_tab_model.h"
116 #include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h"
117 #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h"
118 #include "chrome/browser/ui/android/website_settings_popup_android.h"
119 #include "components/bookmarks/common/android/component_jni_registrar.h"
120 #include "components/dom_distiller/android/component_jni_registrar.h"
121 #include "components/gcm_driver/android/component_jni_registrar.h"
122 #include "components/invalidation/android/component_jni_registrar.h"
123 #include "components/navigation_interception/component_jni_registrar.h"
124 #include "components/service_tab_launcher/component_jni_registrar.h"
125 #include "components/variations/android/component_jni_registrar.h"
126 #include "components/web_contents_delegate_android/component_jni_registrar.h"
128 #if defined(ENABLE_PRINTING) && !defined(ENABLE_PRINT_PREVIEW)
129 #include "printing/printing_context_android.h"
135 static base::android::RegistrationMethod kChromeRegisteredMethods
[] = {
136 // Register JNI for components we depend on.
137 {"AppMenuDragHelper", RegisterAppMenuDragHelper
},
138 {"Bookmarks", bookmarks::android::RegisterBookmarks
},
139 {"DomDistiller", dom_distiller::android::RegisterDomDistiller
},
140 {"ChromeDownloadDelegate", RegisterChromeDownloadDelegate
},
141 {"GCMDriver", gcm::android::RegisterGCMDriverJni
},
142 {"Invalidation", invalidation::android::RegisterInvalidationJni
},
143 {"NavigationInterception",
144 navigation_interception::RegisterNavigationInterceptionJni
},
145 {"WebContentsDelegateAndroid",
146 web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni
},
147 // Register JNI for chrome classes.
148 {"AccessibilityUtils", AccessibilityUtil::Register
},
149 {"AccountChooserInfoBar", RegisterAccountChooserInfoBar
},
150 {"AccountManagementScreenHelper", AccountManagementScreenHelper::Register
},
151 {"AndroidProfileOAuth2TokenService",
152 AndroidProfileOAuth2TokenService::Register
},
153 {"AnswersImageBridge", RegisterAnswersImageBridge
},
154 {"AppBannerInfoBarAndroid", RegisterAppBannerInfoBarAndroid
},
155 {"AppBannerInfoBarDelegateAndroid",
156 banners::RegisterAppBannerInfoBarDelegateAndroid
},
157 {"AppBannerManagerAndroid", banners::AppBannerManagerAndroid::Register
},
158 {"ApplicationLifetime", RegisterApplicationLifetimeAndroid
},
159 {"AutocompleteControllerAndroid", RegisterAutocompleteControllerAndroid
},
160 {"AutofillDialogControllerAndroid",
161 autofill::AutofillDialogControllerAndroid::
162 RegisterAutofillDialogControllerAndroid
},
163 {"AutofillDialogResult",
164 autofill::AutofillDialogResult::RegisterAutofillDialogResult
},
165 {"AutofillKeyboardAccessory",
166 autofill::AutofillKeyboardAccessoryView::
167 RegisterAutofillKeyboardAccessoryView
},
168 {"AutofillLoggerAndroid", autofill::AutofillLoggerAndroid::Register
},
170 autofill::AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid
},
171 {"AutofillProfileBridge", autofill::RegisterAutofillProfileBridge
},
172 {"BackgroundContentViewHelper", BackgroundContentViewHelper::Register
},
173 {"BookmarksBridge", BookmarksBridge::RegisterBookmarksBridge
},
174 {"CardUnmaskPrompt", autofill::CardUnmaskPromptViewAndroid::Register
},
175 {"CertificateViewer", RegisterCertificateViewer
},
176 {"ChildAccountFeedbackReporter", RegisterChildAccountFeedbackReporter
},
177 {"ChildAccountService", RegisterChildAccountService
},
178 {"ChromeBrowserProvider",
179 ChromeBrowserProvider::RegisterChromeBrowserProvider
},
180 {"ChromeHttpAuthHandler",
181 ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler
},
182 {"ChromeWebContentsDelegateAndroid",
183 RegisterChromeWebContentsDelegateAndroid
},
184 {"ChromiumApplication", ChromiumApplication::RegisterBindings
},
185 {"ConfirmInfoBarDelegate", RegisterConfirmInfoBarDelegate
},
186 {"ConnectionInfoPopupAndroid",
187 ConnectionInfoPopupAndroid::RegisterConnectionInfoPopupAndroid
},
188 {"ConnectionSecurityHelper", RegisterConnectionSecurityHelperAndroid
},
189 {"ConnectivityChecker", RegisterConnectivityChecker
},
190 {"ContentViewUtil", RegisterContentViewUtil
},
191 {"ContextMenuHelper", RegisterContextMenuHelper
},
192 {"CookiesFetcher", RegisterCookiesFetcher
},
193 {"Credential", RegisterCredential
},
194 {"CreditCardScanner", autofill::CreditCardScannerViewAndroid::Register
},
195 {"DataReductionProxyInfoBarDelegate", DataReductionProxyInfoBar::Register
},
196 {"DataReductionProxySettings", DataReductionProxySettingsAndroid::Register
},
197 {"DevToolsServer", RegisterDevToolsServer
},
198 {"DomDistillerServiceFactory",
199 dom_distiller::android::DomDistillerServiceFactoryAndroid::Register
},
200 {"DomDistillerTabUtils", RegisterDomDistillerTabUtils
},
201 {"DownloadOverwriteInfoBarDelegate",
202 RegisterDownloadOverwriteInfoBarDelegate
},
203 {"EnhancedBookmarksBridge",
204 enhanced_bookmarks::android::RegisterEnhancedBookmarksBridge
},
205 {"ExternalPrerenderRequestHandler",
206 prerender::ExternalPrerenderHandlerAndroid::
207 RegisterExternalPrerenderHandlerAndroid
},
208 {"FaviconHelper", FaviconHelper::RegisterFaviconHelper
},
209 {"FeatureUtilities", RegisterFeatureUtilities
},
210 {"FeedbackReporter", dom_distiller::android::RegisterFeedbackReporter
},
211 {"FindInPageBridge", FindInPageBridge::RegisterFindInPageBridge
},
212 {"FontSizePrefsAndroid", FontSizePrefsAndroid::Register
},
213 {"ForeignSessionHelper",
214 ForeignSessionHelper::RegisterForeignSessionHelper
},
215 {"FullscreenInfoBarDelegate",
216 FullscreenInfoBarDelegate::RegisterFullscreenInfoBarDelegate
},
217 {"GeneratedPasswordSavedInfoBarDelegate",
218 RegisterGeneratedPasswordSavedInfoBarDelegate
},
219 {"HistoryReportJniBridge", history_report::RegisterHistoryReportJniBridge
},
220 {"InfoBarContainer", RegisterInfoBarContainer
},
221 {"InvalidationServiceFactory",
222 invalidation::InvalidationServiceFactoryAndroid::Register
},
223 {"ShortcutHelper", ShortcutHelper::RegisterShortcutHelper
},
224 {"IntentHelper", RegisterIntentHelper
},
225 {"JavaExceptionReporter", RegisterJavaExceptionReporterJni
},
226 {"JavascriptAppModalDialog",
227 JavascriptAppModalDialogAndroid::RegisterJavascriptAppModalDialog
},
228 {"LargeIconBridge", LargeIconBridge::RegisterLargeIconBridge
},
229 {"LaunchMetrics", metrics::RegisterLaunchMetrics
},
230 {"LayerTitleCache", chrome::android::RegisterLayerTitleCache
},
231 {"LocationSettings", LocationSettingsImpl::Register
},
232 {"LogoBridge", RegisterLogoBridge
},
233 {"MostVisitedSites", MostVisitedSites::Register
},
234 {"NativeInfoBar", RegisterNativeInfoBar
},
235 {"NavigationPopup", NavigationPopup::RegisterNavigationPopup
},
236 {"NewTabPagePrefs", NewTabPagePrefs::RegisterNewTabPagePrefs
},
237 {"NotificationUIManager",
238 NotificationUIManagerAndroid::RegisterNotificationUIManager
},
239 {"OmniboxPrerender", RegisterOmniboxPrerender
},
240 {"OmniboxUrlEmphasizer",
241 OmniboxUrlEmphasizer::RegisterOmniboxUrlEmphasizer
},
242 {"OmniboxViewUtil", OmniboxViewUtil::RegisterOmniboxViewUtil
},
243 {"PartnerBookmarksReader",
244 PartnerBookmarksReader::RegisterPartnerBookmarksReader
},
245 {"PasswordGenerationPopup",
246 autofill::PasswordGenerationPopupViewAndroid::Register
},
247 {"PasswordUIViewAndroid",
248 PasswordUIViewAndroid::RegisterPasswordUIViewAndroid
},
249 {"PersonalDataManagerAndroid",
250 autofill::PersonalDataManagerAndroid::Register
},
251 {"PolicyManager", RegisterPolicyManager
},
252 {"PrecacheLauncher", RegisterPrecacheLauncher
},
253 {"PrefServiceBridge", RegisterPrefServiceBridge
},
254 {"ProfileAndroid", ProfileAndroid::RegisterProfileAndroid
},
255 {"ProfileDownloader", RegisterProfileDownloader
},
256 {"ProfileSyncService", ProfileSyncServiceAndroid::Register
},
257 {"RecentlyClosedBridge", RecentlyClosedTabsBridge::Register
},
258 {"RecordCastAction", remote_media::RegisterRecordCastAction
},
259 {"RemoteMediaPlayerBridge",
260 remote_media::RemoteMediaPlayerBridge::RegisterRemoteMediaPlayerBridge
},
261 {"SavePasswordInfoBar", SavePasswordInfoBar::Register
},
262 {"SceneLayer", chrome::android::RegisterSceneLayer
},
263 {"ServiceTabLauncher", service_tab_launcher::RegisterServiceTabLauncherJni
},
264 {"SigninManager", SigninManagerAndroid::Register
},
265 {"SingleTabModel", RegisterSingleTabModel
},
266 {"SqliteCursor", SQLiteCursor::RegisterSqliteCursor
},
267 {"SSLClientCertificateRequest", RegisterSSLClientCertificateRequestAndroid
},
268 {"StartupMetricUtils", RegisterStartupMetricUtils
},
269 {"StaticTabSceneLayer", chrome::android::RegisterStaticTabSceneLayer
},
270 {"TabAndroid", TabAndroid::RegisterTabAndroid
},
271 {"TabContentManager", chrome::android::RegisterTabContentManager
},
272 {"TabModelJniBridge", TabModelJniBridge::Register
},
273 {"TabState", RegisterTabState
},
274 {"TemplateUrlServiceAndroid", TemplateUrlServiceAndroid::Register
},
275 {"ToolbarModelAndroid", ToolbarModelAndroid::RegisterToolbarModelAndroid
},
276 {"TranslateInfoBarDelegate", RegisterTranslateInfoBarDelegate
},
277 {"TtsPlatformImpl", TtsPlatformImplAndroid::Register
},
278 {"UmaSessionStats", RegisterUmaSessionStats
},
279 {"UrlUtilities", RegisterUrlUtilities
},
280 {"Variations", variations::android::RegisterVariations
},
281 {"VariationsSession", chrome::android::RegisterVariationsSession
},
282 {"WarmupManager", RegisterWarmupManager
},
283 {"WebsitePreferenceBridge", RegisterWebsitePreferenceBridge
},
284 {"WebsiteSettingsPopupAndroid",
285 WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid
},
286 #if defined(ENABLE_PRINTING) && !defined(ENABLE_PRINT_PREVIEW)
288 printing::PrintingContextAndroid::RegisterPrintingContext
},
292 bool RegisterBrowserJNI(JNIEnv
* env
) {
293 TRACE_EVENT0("startup", "chrome_android::RegisterJni");
294 return RegisterNativeMethods(env
, kChromeRegisteredMethods
,
295 arraysize(kChromeRegisteredMethods
));
298 } // namespace android
299 } // namespace chrome