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