Extract code handling PrinterProviderAPI from PrintPreviewHandler
[chromium-blink-merge.git] / chrome / browser / android / chrome_jni_registrar.cc
blob88eb4f0a43e112dfd8d14a1d79eee6f043749762
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/confirm_infobar.h"
84 #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h"
85 #include "chrome/browser/ui/android/infobars/generated_password_saved_infobar.h"
86 #include "chrome/browser/ui/android/infobars/infobar_android.h"
87 #include "chrome/browser/ui/android/infobars/infobar_container_android.h"
88 #include "chrome/browser/ui/android/infobars/translate_infobar.h"
89 #include "chrome/browser/ui/android/javascript_app_modal_dialog_android.h"
90 #include "chrome/browser/ui/android/navigation_popup.h"
91 #include "chrome/browser/ui/android/omnibox/omnibox_url_emphasizer.h"
92 #include "chrome/browser/ui/android/omnibox/omnibox_view_util.h"
93 #include "chrome/browser/ui/android/ssl_client_certificate_request.h"
94 #include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h"
95 #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h"
96 #include "chrome/browser/ui/android/website_settings_popup_android.h"
97 #include "components/bookmarks/common/android/component_jni_registrar.h"
98 #include "components/dom_distiller/android/component_jni_registrar.h"
99 #include "components/gcm_driver/android/component_jni_registrar.h"
100 #include "components/invalidation/android/component_jni_registrar.h"
101 #include "components/navigation_interception/component_jni_registrar.h"
102 #include "components/variations/android/component_jni_registrar.h"
103 #include "components/web_contents_delegate_android/component_jni_registrar.h"
105 #if defined(ENABLE_PRINTING) && !defined(ENABLE_PRINT_PREVIEW)
106 #include "printing/printing_context_android.h"
107 #endif
109 namespace chrome {
110 namespace android {
112 static base::android::RegistrationMethod kChromeRegisteredMethods[] = {
113 // Register JNI for components we depend on.
114 {"AppMenuDragHelper", RegisterAppMenuDragHelper},
115 {"Bookmarks", bookmarks::android::RegisterBookmarks},
116 {"DomDistiller", dom_distiller::android::RegisterDomDistiller},
117 {"ChromeDownloadDelegate", RegisterChromeDownloadDeleagte},
118 {"GCMDriver", gcm::android::RegisterGCMDriverJni},
119 {"Invalidation", invalidation::android::RegisterInvalidationJni},
120 {"NavigationInterception",
121 navigation_interception::RegisterNavigationInterceptionJni},
122 {"WebContentsDelegateAndroid",
123 web_contents_delegate_android::RegisterWebContentsDelegateAndroidJni},
124 // Register JNI for chrome classes.
125 {"AccessibilityUtils", AccessibilityUtil::Register},
126 {"AccountManagementScreenHelper", AccountManagementScreenHelper::Register},
127 {"AndroidProfileOAuth2TokenService",
128 AndroidProfileOAuth2TokenService::Register},
129 {"AnswersImageBridge", RegisterAnswersImageBridge},
130 {"AppBannerInfoBarDelegate", RegisterAppBannerInfoBarDelegate},
131 {"AppBannerManager", banners::RegisterAppBannerManager},
132 {"ApplicationLifetime", RegisterApplicationLifetimeAndroid},
133 {"AutocompleteControllerAndroid", RegisterAutocompleteControllerAndroid},
134 {"AutofillDialogControllerAndroid",
135 autofill::AutofillDialogControllerAndroid::
136 RegisterAutofillDialogControllerAndroid},
137 {"AutofillDialogResult",
138 autofill::AutofillDialogResult::RegisterAutofillDialogResult},
139 {"AutofillLoggerAndroid", autofill::AutofillLoggerAndroid::Register},
140 {"AutofillPopup",
141 autofill::AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid},
142 {"AutofillProfileBridge", autofill::RegisterAutofillProfileBridge},
143 {"BookmarksBridge", BookmarksBridge::RegisterBookmarksBridge},
144 {"CardUnmaskPrompt", autofill::CardUnmaskPromptViewAndroid::Register},
145 {"ChildAccountFeedbackReporter", RegisterChildAccountFeedbackReporter},
146 {"ChildAccountService", RegisterChildAccountService},
147 {"ChromeBrowserProvider",
148 ChromeBrowserProvider::RegisterChromeBrowserProvider},
149 {"ChromeHttpAuthHandler",
150 ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler},
151 {"ChromeWebContentsDelegateAndroid",
152 RegisterChromeWebContentsDelegateAndroid},
153 {"ChromiumApplication", ChromiumApplication::RegisterBindings},
154 {"ConfirmInfoBarDelegate", RegisterConfirmInfoBarDelegate},
155 {"ContentViewUtil", RegisterContentViewUtil},
156 {"ContextMenuHelper", RegisterContextMenuHelper},
157 {"CookiesFetcher", RegisterCookiesFetcher},
158 {"CreditCardScanner", autofill::CreditCardScannerViewAndroid::Register},
159 {"DataReductionProxyInfoBarDelegate", DataReductionProxyInfoBar::Register},
160 {"DataReductionProxySettings", DataReductionProxySettingsAndroid::Register},
161 {"DevToolsServer", RegisterDevToolsServer},
162 {"DomDistillerServiceFactory",
163 dom_distiller::android::DomDistillerServiceFactoryAndroid::Register},
164 {"DomDistillerTabUtils", RegisterDomDistillerTabUtils},
165 {"EnhancedBookmarksBridge",
166 enhanced_bookmarks::android::RegisterEnhancedBookmarksBridge},
167 {"ExternalPrerenderRequestHandler",
168 prerender::ExternalPrerenderHandlerAndroid::
169 RegisterExternalPrerenderHandlerAndroid},
170 {"FaviconHelper", FaviconHelper::RegisterFaviconHelper},
171 {"FeatureUtilities", RegisterFeatureUtilities},
172 {"FeedbackReporter", dom_distiller::android::RegisterFeedbackReporter},
173 {"FindInPageBridge", FindInPageBridge::RegisterFindInPageBridge},
174 {"FontSizePrefsAndroid", FontSizePrefsAndroid::Register},
175 {"ForeignSessionHelper",
176 ForeignSessionHelper::RegisterForeignSessionHelper},
177 {"GeneratedPasswordSavedInfoBarDelegate",
178 RegisterGeneratedPasswordSavedInfoBarDelegate},
179 {"InfoBarContainer", RegisterInfoBarContainer},
180 {"InvalidationServiceFactory",
181 invalidation::InvalidationServiceFactoryAndroid::Register},
182 {"ShortcutHelper", ShortcutHelper::RegisterShortcutHelper},
183 {"IntentHelper", RegisterIntentHelper},
184 {"JavascriptAppModalDialog",
185 JavascriptAppModalDialogAndroid::RegisterJavascriptAppModalDialog},
186 {"LayerTitleCache", chrome::android::RegisterLayerTitleCache},
187 {"LocationSettings", LocationSettingsImpl::Register},
188 {"LogoBridge", RegisterLogoBridge},
189 {"MostVisitedSites", MostVisitedSites::Register},
190 {"NativeInfoBar", RegisterNativeInfoBar},
191 {"NavigationPopup", NavigationPopup::RegisterNavigationPopup},
192 {"NewTabPagePrefs", NewTabPagePrefs::RegisterNewTabPagePrefs},
193 {"NotificationUIManager",
194 NotificationUIManagerAndroid::RegisterNotificationUIManager},
195 {"OmniboxPrerender", RegisterOmniboxPrerender},
196 {"OmniboxUrlEmphasizer",
197 OmniboxUrlEmphasizer::RegisterOmniboxUrlEmphasizer},
198 {"OmniboxViewUtil", OmniboxViewUtil::RegisterOmniboxViewUtil},
199 {"PartnerBookmarksReader",
200 PartnerBookmarksReader::RegisterPartnerBookmarksReader},
201 {"PasswordGenerationPopup",
202 autofill::PasswordGenerationPopupViewAndroid::Register},
203 {"PasswordUIViewAndroid",
204 PasswordUIViewAndroid::RegisterPasswordUIViewAndroid},
205 {"PersonalDataManagerAndroid",
206 autofill::PersonalDataManagerAndroid::Register},
207 {"PrefServiceBridge", RegisterPrefServiceBridge},
208 {"ProfileAndroid", ProfileAndroid::RegisterProfileAndroid},
209 {"ProfileDownloader", RegisterProfileDownloader},
210 {"ProfileSyncService", ProfileSyncServiceAndroid::Register},
211 {"RecentlyClosedBridge", RecentlyClosedTabsBridge::Register},
212 {"SceneLayer", chrome::android::RegisterSceneLayer},
213 {"ServiceTabLauncher", ServiceTabLauncher::RegisterServiceTabLauncher},
214 {"SigninManager", SigninManagerAndroid::Register},
215 {"SqliteCursor", SQLiteCursor::RegisterSqliteCursor},
216 {"SSLClientCertificateRequest", RegisterSSLClientCertificateRequestAndroid},
217 {"StartupMetricUtils", RegisterStartupMetricUtils},
218 {"StaticTabSceneLayer", chrome::android::RegisterStaticTabSceneLayer},
219 {"TabAndroid", TabAndroid::RegisterTabAndroid},
220 {"TabContentManager", chrome::android::RegisterTabContentManager},
221 {"TabModelJniBridge", TabModelJniBridge::Register},
222 {"TabState", RegisterTabState},
223 {"TemplateUrlServiceAndroid", TemplateUrlServiceAndroid::Register},
224 {"ToolbarModelAndroid", ToolbarModelAndroid::RegisterToolbarModelAndroid},
225 {"TranslateInfoBarDelegate", RegisterTranslateInfoBarDelegate},
226 {"TtsPlatformImpl", TtsPlatformImplAndroid::Register},
227 {"UmaBridge", RegisterUmaBridge},
228 {"UrlUtilities", RegisterUrlUtilities},
229 {"Variations", variations::android::RegisterVariations},
230 {"VoiceSearchTabHelper", RegisterVoiceSearchTabHelper},
231 {"WebsitePreferenceBridge", RegisterWebsitePreferenceBridge},
232 {"WebsiteSettingsPopupAndroid",
233 WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid},
234 #if defined(ENABLE_PRINTING) && !defined(ENABLE_PRINT_PREVIEW)
235 {"PrintingContext",
236 printing::PrintingContextAndroid::RegisterPrintingContext},
237 #endif
240 bool RegisterJni(JNIEnv* env) {
241 TRACE_EVENT0("startup", "chrome_android::RegisterJni");
242 return RegisterNativeMethods(env, kChromeRegisteredMethods,
243 arraysize(kChromeRegisteredMethods));
246 } // namespace android
247 } // namespace chrome