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