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