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