1 // Copyright 2019 The Chromium Authors
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/chrome_browser_interface_binders.h"
9 #include "base/feature_list.h"
10 #include "base/functional/bind.h"
11 #include "build/build_config.h"
12 #include "build/chromeos_buildflags.h"
13 #include "build/config/chromebox_for_meetings/buildflags.h"
14 #include "chrome/browser/accessibility/accessibility_labels_service.h"
15 #include "chrome/browser/accessibility/accessibility_labels_service_factory.h"
16 #include "chrome/browser/ash/drive/file_system_util.h"
17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/buildflags.h"
19 #include "chrome/browser/cart/commerce_hint_service.h"
20 #include "chrome/browser/chromeos/upload_office_to_cloud/upload_office_to_cloud.h"
21 #include "chrome/browser/companion/core/features.h"
22 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
23 #include "chrome/browser/history_clusters/history_clusters_service_factory.h"
24 #include "chrome/browser/media/history/media_history_store.mojom.h"
25 #include "chrome/browser/media/media_engagement_score_details.mojom.h"
26 #include "chrome/browser/navigation_predictor/navigation_predictor.h"
27 #include "chrome/browser/optimization_guide/optimization_guide_internals_ui.h"
28 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
29 #include "chrome/browser/predictors/lcp_critical_path_predictor/lcp_critical_path_predictor_host.h"
30 #include "chrome/browser/predictors/network_hints_handler_impl.h"
31 #include "chrome/browser/preloading/prefetch/no_state_prefetch/chrome_no_state_prefetch_contents_delegate.h"
32 #include "chrome/browser/preloading/prefetch/no_state_prefetch/chrome_no_state_prefetch_processor_impl_delegate.h"
33 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/profiles/profile_manager.h"
35 #include "chrome/browser/signin/identity_manager_factory.h"
36 #include "chrome/browser/ssl/security_state_tab_helper.h"
37 #include "chrome/browser/translate/translate_frame_binder.h"
38 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
39 #include "chrome/browser/ui/side_panel/companion/companion_utils.h"
40 #include "chrome/browser/ui/ui_features.h"
41 #include "chrome/browser/ui/web_applications/draggable_region_host_impl.h"
42 #include "chrome/browser/ui/webui/browsing_topics/browsing_topics_internals_ui.h"
43 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
44 #include "chrome/browser/ui/webui/internals/internals_ui.h"
45 #include "chrome/browser/ui/webui/location_internals/location_internals.mojom.h"
46 #include "chrome/browser/ui/webui/location_internals/location_internals_ui.h"
47 #include "chrome/browser/ui/webui/media/media_engagement_ui.h"
48 #include "chrome/browser/ui/webui/media/media_history_ui.h"
49 #include "chrome/browser/ui/webui/omnibox/omnibox.mojom.h"
50 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
51 #include "chrome/browser/ui/webui/segmentation_internals/segmentation_internals_ui.h"
52 #include "chrome/browser/ui/webui/suggest_internals/suggest_internals.mojom.h"
53 #include "chrome/browser/ui/webui/suggest_internals/suggest_internals_ui.h"
54 #include "chrome/browser/ui/webui/usb_internals/usb_internals.mojom.h"
55 #include "chrome/browser/ui/webui/usb_internals/usb_internals_ui.h"
56 #include "chrome/browser/web_applications/web_app_utils.h"
57 #include "chrome/common/chrome_features.h"
58 #include "chrome/common/pref_names.h"
59 #include "chrome/common/webui_url_constants.h"
60 #include "chrome/services/speech/buildflags/buildflags.h"
61 #include "components/browsing_topics/mojom/browsing_topics_internals.mojom.h"
62 #include "components/commerce/content/browser/commerce_internals_ui.h"
63 #include "components/commerce/core/internals/mojom/commerce_internals.mojom.h"
64 #include "components/compose/buildflags.h"
65 #include "components/dom_distiller/content/browser/distillability_driver.h"
66 #include "components/dom_distiller/content/browser/distiller_javascript_service_impl.h"
67 #include "components/dom_distiller/content/common/mojom/distillability_service.mojom.h"
68 #include "components/dom_distiller/content/common/mojom/distiller_javascript_service.mojom.h"
69 #include "components/dom_distiller/core/dom_distiller_service.h"
70 #include "components/feed/buildflags.h"
71 #include "components/feed/feed_feature_list.h"
72 #include "components/history_clusters/core/features.h"
73 #include "components/history_clusters/core/history_clusters_service.h"
74 #include "components/history_clusters/history_clusters_internals/webui/history_clusters_internals_ui.h"
75 #include "components/live_caption/caption_util.h"
76 #include "components/live_caption/pref_names.h"
77 #include "components/no_state_prefetch/browser/no_state_prefetch_contents.h"
78 #include "components/no_state_prefetch/browser/no_state_prefetch_processor_impl.h"
79 #include "components/payments/content/payment_credential_factory.h"
80 #include "components/performance_manager/embedder/binders.h"
81 #include "components/performance_manager/public/features.h"
82 #include "components/performance_manager/public/performance_manager.h"
83 #include "components/prefs/pref_service.h"
84 #include "components/reading_list/features/reading_list_switches.h"
85 #include "components/safe_browsing/buildflags.h"
86 #include "components/search_engines/search_engine_choice_utils.h"
87 #include "components/security_state/content/content_utils.h"
88 #include "components/security_state/core/security_state.h"
89 #include "components/services/screen_ai/buildflags/buildflags.h"
90 #include "components/signin/public/base/signin_buildflags.h"
91 #include "components/signin/public/identity_manager/identity_manager.h"
92 #include "components/site_engagement/core/mojom/site_engagement_details.mojom.h"
93 #include "components/translate/content/common/translate.mojom.h"
94 #include "components/user_notes/user_notes_features.h"
95 #include "content/public/browser/browser_context.h"
96 #include "content/public/browser/render_process_host.h"
97 #include "content/public/browser/web_ui_browser_interface_broker_registry.h"
98 #include "content/public/browser/web_ui_controller_interface_binder.h"
99 #include "content/public/common/content_features.h"
100 #include "content/public/common/url_constants.h"
101 #include "extensions/buildflags/buildflags.h"
102 #include "mojo/public/cpp/bindings/pending_receiver.h"
103 #include "mojo/public/cpp/bindings/self_owned_receiver.h"
104 #include "services/image_annotation/public/mojom/image_annotation.mojom.h"
105 #include "third_party/blink/public/common/features.h"
106 #include "third_party/blink/public/common/features_generated.h"
107 #include "third_party/blink/public/mojom/credentialmanagement/credential_manager.mojom.h"
108 #include "third_party/blink/public/mojom/lcp_critical_path_predictor/lcp_critical_path_predictor.mojom.h"
109 #include "third_party/blink/public/mojom/loader/navigation_predictor.mojom.h"
110 #include "third_party/blink/public/mojom/payments/payment_credential.mojom.h"
111 #include "third_party/blink/public/mojom/payments/payment_request.mojom.h"
112 #include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
113 #include "third_party/blink/public/public_buildflags.h"
114 #include "ui/accessibility/accessibility_features.h"
116 #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
117 #include "chrome/browser/screen_ai/screen_ai_service_router.h"
118 #include "chrome/browser/screen_ai/screen_ai_service_router_factory.h"
121 #if BUILDFLAG(ENABLE_UNHANDLED_TAP)
122 #include "chrome/browser/android/contextualsearch/unhandled_tap_notifier_impl.h"
123 #include "chrome/browser/android/contextualsearch/unhandled_tap_web_contents_observer.h"
124 #include "third_party/blink/public/mojom/unhandled_tap_notifier/unhandled_tap_notifier.mojom.h"
125 #endif // BUILDFLAG(ENABLE_UNHANDLED_TAP)
127 #if BUILDFLAG(FULL_SAFE_BROWSING)
128 #include "chrome/browser/ui/webui/reset_password/reset_password.mojom.h"
129 #include "chrome/browser/ui/webui/reset_password/reset_password_ui.h"
130 #endif // BUILDFLAG(FULL_SAFE_BROWSING)
132 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
133 BUILDFLAG(IS_CHROMEOS_ASH)
134 #include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h"
135 #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h"
138 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
139 BUILDFLAG(IS_FUCHSIA)
140 #include "chrome/browser/ui/webui/app_settings/web_app_settings_ui.h"
141 #include "ui/webui/resources/cr_components/app_management/app_management.mojom.h"
144 #if BUILDFLAG(IS_ANDROID)
145 #include "chrome/browser/android/dom_distiller/distiller_ui_handle_android.h"
146 #include "chrome/browser/offline_pages/android/offline_page_auto_fetcher.h"
147 #include "chrome/browser/ui/webui/feed_internals/feed_internals.mojom.h"
148 #include "chrome/browser/ui/webui/feed_internals/feed_internals_ui.h"
149 #include "chrome/common/offline_page_auto_fetcher.mojom.h"
150 #include "components/commerce/core/commerce_feature_list.h"
151 #include "components/environment_integrity/android/android_environment_integrity_service.h"
152 #include "services/service_manager/public/cpp/interface_provider.h"
153 #include "third_party/blink/public/mojom/digital_goods/digital_goods.mojom.h"
154 #include "third_party/blink/public/mojom/environment_integrity/environment_integrity_service.mojom.h"
155 #include "third_party/blink/public/mojom/installedapp/installed_app_provider.mojom.h"
157 #include "chrome/browser/badging/badge_manager.h"
158 #include "chrome/browser/cart/chrome_cart.mojom.h"
159 #include "chrome/browser/new_tab_page/modules/drive/drive.mojom.h"
160 #include "chrome/browser/new_tab_page/modules/feed/feed.mojom.h"
161 #include "chrome/browser/new_tab_page/modules/history_clusters/history_clusters.mojom.h"
162 #include "chrome/browser/new_tab_page/modules/photos/photos.mojom.h"
163 #include "chrome/browser/new_tab_page/modules/recipes/recipes.mojom.h"
164 #include "chrome/browser/new_tab_page/modules/v2/history_clusters/history_clusters_v2.mojom.h"
165 #include "chrome/browser/new_tab_page/new_tab_page_util.h"
166 #include "chrome/browser/payments/payment_request_factory.h"
167 #include "chrome/browser/ui/webui/access_code_cast/access_code_cast.mojom.h"
168 #include "chrome/browser/ui/webui/access_code_cast/access_code_cast_ui.h"
169 #include "chrome/browser/ui/webui/app_service_internals/app_service_internals.mojom.h"
170 #include "chrome/browser/ui/webui/app_service_internals/app_service_internals_ui.h"
171 #include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
172 #include "chrome/browser/ui/webui/downloads/downloads_ui.h"
173 #include "chrome/browser/ui/webui/feed/feed.mojom.h"
174 #include "chrome/browser/ui/webui/feed/feed_ui.h"
175 #include "chrome/browser/ui/webui/on_device_internals/on_device_internals_ui.h"
176 #include "chrome/browser/ui/webui/web_app_internals/web_app_internals.mojom.h"
177 #include "chrome/browser/ui/webui/web_app_internals/web_app_internals_ui.h"
178 #include "components/omnibox/browser/omnibox.mojom.h"
179 #include "services/on_device_model/public/cpp/features.h"
180 #if !defined(OFFICIAL_BUILD)
181 #include "chrome/browser/ui/webui/new_tab_page/foo/foo.mojom.h" // nogncheck crbug.com/1125897
183 #include "chrome/browser/ui/side_panel/customize_chrome/customize_chrome_utils.h"
184 #include "chrome/browser/ui/webui/commerce/shopping_insights_side_panel_ui.h"
185 #include "chrome/browser/ui/webui/hats/hats_ui.h"
186 #include "chrome/browser/ui/webui/history/history_ui.h"
187 #include "chrome/browser/ui/webui/internals/user_education/user_education_internals.mojom.h"
188 #include "chrome/browser/ui/webui/new_tab_page/new_tab_page.mojom.h"
189 #include "chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h"
190 #include "chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_ui.h"
191 #include "chrome/browser/ui/webui/omnibox_popup/omnibox_popup_ui.h"
192 #include "chrome/browser/ui/webui/password_manager/password_manager_ui.h"
193 #include "chrome/browser/ui/webui/settings/settings_ui.h"
194 #include "chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.h"
195 #include "chrome/browser/ui/webui/side_panel/companion/companion_side_panel_untrusted_ui.h"
196 #include "chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome.mojom.h"
197 #include "chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_ui.h"
198 #include "chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search.mojom.h"
199 #include "chrome/browser/ui/webui/side_panel/history_clusters/history_clusters_side_panel_ui.h"
200 #include "chrome/browser/ui/webui/side_panel/performance_controls/performance_side_panel_ui.h"
201 #include "chrome/browser/ui/webui/side_panel/read_anything/read_anything_untrusted_ui.h"
202 #include "chrome/browser/ui/webui/side_panel/reading_list/reading_list.mojom.h"
203 #include "chrome/browser/ui/webui/side_panel/reading_list/reading_list_ui.h"
204 #include "chrome/browser/ui/webui/side_panel/user_notes/user_notes.mojom.h"
205 #include "chrome/browser/ui/webui/side_panel/user_notes/user_notes_side_panel_ui.h"
206 #include "chrome/browser/ui/webui/tab_search/tab_search.mojom.h"
207 #include "chrome/browser/ui/webui/tab_search/tab_search_ui.h"
208 #include "chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.h"
209 #include "chrome/browser/ui/webui/whats_new/whats_new_ui.h"
210 #include "chrome/common/webui_url_constants.h"
211 #include "components/commerce/core/mojom/shopping_list.mojom.h" // nogncheck crbug.com/1125897
212 #include "components/optimization_guide/core/optimization_guide_features.h"
213 #include "components/page_image_service/mojom/page_image_service.mojom.h"
214 #include "components/search/ntp_features.h"
215 #include "ui/webui/resources/cr_components/color_change_listener/color_change_listener.mojom.h"
216 #include "ui/webui/resources/cr_components/customize_color_scheme_mode/customize_color_scheme_mode.mojom.h"
217 #include "ui/webui/resources/cr_components/customize_themes/customize_themes.mojom.h"
218 #include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom.h"
219 #include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"
220 #include "ui/webui/resources/cr_components/most_visited/most_visited.mojom.h"
221 #include "ui/webui/resources/cr_components/theme_color_picker/theme_color_picker.mojom.h"
222 #include "ui/webui/resources/js/browser_command/browser_command.mojom.h"
223 #include "ui/webui/resources/js/metrics_reporter/metrics_reporter.mojom.h"
224 #endif // BUILDFLAG(IS_ANDROID)
226 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
227 BUILDFLAG(IS_CHROMEOS)
228 #include "chrome/browser/companion/visual_search/visual_search_suggestions_service_factory.h"
229 #include "chrome/browser/ui/web_applications/sub_apps_service_impl.h"
230 #include "chrome/browser/ui/webui/discards/discards.mojom.h"
231 #include "chrome/browser/ui/webui/discards/discards_ui.h"
232 #include "chrome/browser/ui/webui/discards/site_data.mojom.h"
233 #include "chrome/common/companion/visual_search.mojom.h"
234 #include "chrome/common/companion/visual_search/features.h"
235 #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
236 // BUILDFLAG(IS_CHROMEOS)
238 #if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
239 #include "chrome/browser/ui/webui/app_home/app_home.mojom.h"
240 #include "chrome/browser/ui/webui/app_home/app_home_ui.h"
241 #endif // !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
243 #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
244 #include "chrome/browser/ui/webui/signin/profile_customization_ui.h"
245 #include "chrome/browser/ui/webui/signin/profile_picker_ui.h"
246 #include "ui/webui/resources/cr_components/customize_themes/customize_themes.mojom.h"
247 #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
249 #if BUILDFLAG(IS_CHROMEOS_ASH)
250 #include "ash/constants/ash_features.h"
251 #include "ash/webui/camera_app_ui/camera_app_helper.mojom.h"
252 #include "ash/webui/camera_app_ui/camera_app_ui.h"
253 #include "ash/webui/color_internals/color_internals_ui.h"
254 #include "ash/webui/color_internals/mojom/color_internals.mojom.h"
255 #include "ash/webui/common/mojom/accessibility_features.mojom.h"
256 #include "ash/webui/common/mojom/shortcut_input_provider.mojom.h"
257 #include "ash/webui/connectivity_diagnostics/connectivity_diagnostics_ui.h"
258 #include "ash/webui/demo_mode_app_ui/demo_mode_app_untrusted_ui.h"
259 #include "ash/webui/diagnostics_ui/diagnostics_ui.h"
260 #include "ash/webui/diagnostics_ui/mojom/input_data_provider.mojom.h"
261 #include "ash/webui/diagnostics_ui/mojom/network_health_provider.mojom.h"
262 #include "ash/webui/diagnostics_ui/mojom/system_data_provider.mojom.h"
263 #include "ash/webui/diagnostics_ui/mojom/system_routine_controller.mojom.h"
264 #include "ash/webui/eche_app_ui/eche_app_ui.h"
265 #include "ash/webui/eche_app_ui/mojom/eche_app.mojom.h"
266 #include "ash/webui/face_ml_app_ui/face_ml_app_ui.h"
267 #include "ash/webui/face_ml_app_ui/mojom/face_ml_app_ui.mojom.h"
268 #include "ash/webui/file_manager/file_manager_ui.h"
269 #include "ash/webui/file_manager/mojom/file_manager.mojom.h"
270 #include "ash/webui/files_internals/files_internals_ui.h"
271 #include "ash/webui/files_internals/mojom/files_internals.mojom.h"
272 #include "ash/webui/firmware_update_ui/firmware_update_app_ui.h"
273 #include "ash/webui/firmware_update_ui/mojom/firmware_update.mojom.h"
274 #include "ash/webui/guest_os_installer/guest_os_installer_ui.h"
275 #include "ash/webui/guest_os_installer/mojom/guest_os_installer.mojom.h"
276 #include "ash/webui/help_app_ui/help_app_ui.h"
277 #include "ash/webui/help_app_ui/help_app_ui.mojom.h"
278 #include "ash/webui/help_app_ui/help_app_untrusted_ui.h"
279 #include "ash/webui/help_app_ui/search/search.mojom.h"
280 #include "ash/webui/media_app_ui/media_app_guest_ui.h"
281 #include "ash/webui/media_app_ui/media_app_ui.h"
282 #include "ash/webui/media_app_ui/media_app_ui.mojom.h"
283 #include "ash/webui/media_app_ui/media_app_ui_untrusted.mojom.h"
284 #include "ash/webui/multidevice_debug/proximity_auth_ui.h"
285 #include "ash/webui/os_feedback_ui/mojom/os_feedback_ui.mojom.h"
286 #include "ash/webui/os_feedback_ui/os_feedback_ui.h"
287 #include "ash/webui/os_feedback_ui/os_feedback_untrusted_ui.h"
288 #include "ash/webui/personalization_app/mojom/personalization_app.mojom.h"
289 #include "ash/webui/personalization_app/personalization_app_ui.h"
290 #include "ash/webui/personalization_app/search/search.mojom.h"
291 #include "ash/webui/print_management/print_management_ui.h"
292 #include "ash/webui/projector_app/mojom/untrusted_annotator.mojom.h"
293 #include "ash/webui/projector_app/mojom/untrusted_projector.mojom.h"
294 #include "ash/webui/projector_app/untrusted_projector_annotator_ui.h"
295 #include "ash/webui/projector_app/untrusted_projector_ui.h"
296 #include "ash/webui/scanning/mojom/scanning.mojom.h"
297 #include "ash/webui/scanning/scanning_ui.h"
298 #include "ash/webui/shimless_rma/shimless_rma.h"
299 #include "ash/webui/shortcut_customization_ui/backend/search/search.mojom.h"
300 #include "ash/webui/shortcut_customization_ui/mojom/shortcut_customization.mojom.h"
301 #include "ash/webui/shortcut_customization_ui/shortcut_customization_app_ui.h"
302 #include "ash/webui/system_extensions_internals_ui/mojom/system_extensions_internals_ui.mojom.h"
303 #include "ash/webui/system_extensions_internals_ui/system_extensions_internals_ui.h"
304 #include "chrome/browser/apps/digital_goods/digital_goods_factory_impl.h"
305 #include "chrome/browser/ash/system_extensions/system_extensions_internals_page_handler.h"
306 #include "chrome/browser/nearby_sharing/common/nearby_share_features.h"
307 #include "chrome/browser/speech/cros_speech_recognition_service_factory.h"
308 #include "chrome/browser/ui/webui/ash/add_supervision/add_supervision.mojom.h"
309 #include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui.h"
310 #include "chrome/browser/ui/webui/ash/audio/audio.mojom.h"
311 #include "chrome/browser/ui/webui/ash/audio/audio_ui.h"
312 #include "chrome/browser/ui/webui/ash/bluetooth_pairing_dialog.h"
313 #include "chrome/browser/ui/webui/ash/borealis_installer/borealis_installer.mojom.h"
314 #include "chrome/browser/ui/webui/ash/borealis_installer/borealis_installer_ui.h"
315 #include "chrome/browser/ui/webui/ash/cloud_upload/cloud_upload.mojom.h"
316 #include "chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.h"
317 #include "chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_ui.h"
318 #include "chrome/browser/ui/webui/ash/crostini_installer/crostini_installer.mojom.h"
319 #include "chrome/browser/ui/webui/ash/crostini_installer/crostini_installer_ui.h"
320 #include "chrome/browser/ui/webui/ash/crostini_upgrader/crostini_upgrader.mojom.h"
321 #include "chrome/browser/ui/webui/ash/crostini_upgrader/crostini_upgrader_ui.h"
322 #include "chrome/browser/ui/webui/ash/emoji/emoji_picker.mojom.h"
323 #include "chrome/browser/ui/webui/ash/emoji/emoji_ui.h"
324 #include "chrome/browser/ui/webui/ash/emoji/new_window_proxy.h"
325 #include "chrome/browser/ui/webui/ash/emoji/new_window_proxy.mojom.h"
326 #include "chrome/browser/ui/webui/ash/enterprise_reporting/enterprise_reporting.mojom.h"
327 #include "chrome/browser/ui/webui/ash/enterprise_reporting/enterprise_reporting_ui.h"
328 #include "chrome/browser/ui/webui/ash/internet_config_dialog.h"
329 #include "chrome/browser/ui/webui/ash/internet_detail_dialog.h"
330 #include "chrome/browser/ui/webui/ash/launcher_internals/launcher_internals.mojom.h"
331 #include "chrome/browser/ui/webui/ash/launcher_internals/launcher_internals_ui.h"
332 #include "chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_ui.h"
333 #include "chrome/browser/ui/webui/ash/login/oobe_ui.h"
334 #include "chrome/browser/ui/webui/ash/mako/mako_ui.h"
335 #include "chrome/browser/ui/webui/ash/manage_mirrorsync/manage_mirrorsync.mojom.h"
336 #include "chrome/browser/ui/webui/ash/manage_mirrorsync/manage_mirrorsync_ui.h"
337 #include "chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_dialog.h"
338 #include "chrome/browser/ui/webui/ash/network_ui.h"
339 #include "chrome/browser/ui/webui/ash/office_fallback/office_fallback.mojom.h"
340 #include "chrome/browser/ui/webui/ash/office_fallback/office_fallback_ui.h"
341 #include "chrome/browser/ui/webui/ash/parent_access/parent_access_ui.h"
342 #include "chrome/browser/ui/webui/ash/parent_access/parent_access_ui.mojom.h"
343 #include "chrome/browser/ui/webui/ash/sensor_info/sensor.mojom.h"
344 #include "chrome/browser/ui/webui/ash/sensor_info/sensor_info_ui.h"
345 #include "chrome/browser/ui/webui/ash/set_time_ui.h"
346 #include "chrome/browser/ui/webui/ash/settings/os_settings_ui.h"
347 #include "chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_notification_handler.mojom.h"
348 #include "chrome/browser/ui/webui/ash/settings/pages/device/display_settings/display_settings_provider.mojom.h"
349 #include "chrome/browser/ui/webui/ash/settings/pages/device/input_device_settings/input_device_settings_provider.mojom.h"
350 #include "chrome/browser/ui/webui/ash/settings/pages/files/mojom/google_drive_handler.mojom.h"
351 #include "chrome/browser/ui/webui/ash/settings/pages/files/mojom/one_drive_handler.mojom.h"
352 #include "chrome/browser/ui/webui/ash/settings/pages/privacy/mojom/app_permission_handler.mojom.h"
353 #include "chrome/browser/ui/webui/ash/settings/search/mojom/search.mojom.h"
354 #include "chrome/browser/ui/webui/ash/settings/search/mojom/user_action_recorder.mojom.h"
355 #include "chrome/browser/ui/webui/ash/smb_shares/smb_credentials_dialog.h"
356 #include "chrome/browser/ui/webui/ash/smb_shares/smb_share_dialog.h"
357 #include "chrome/browser/ui/webui/ash/vm/vm.mojom.h"
358 #include "chrome/browser/ui/webui/ash/vm/vm_ui.h"
359 #include "chrome/browser/ui/webui/ash/web_app_install/web_app_install.mojom.h"
360 #include "chrome/browser/ui/webui/ash/web_app_install/web_app_install_ui.h"
361 #include "chrome/browser/ui/webui/feedback/feedback_ui.h"
362 #include "chrome/browser/ui/webui/nearby_share/nearby_share.mojom.h"
363 #include "chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.h"
364 #include "chromeos/ash/components/audio/public/mojom/cros_audio_config.mojom.h"
365 #include "chromeos/ash/components/local_search_service/public/mojom/index.mojom.h"
366 #include "chromeos/ash/services/auth_factor_config/public/mojom/auth_factor_config.mojom.h"
367 #include "chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom.h"
368 #include "chromeos/ash/services/cellular_setup/public/mojom/cellular_setup.mojom.h"
369 #include "chromeos/ash/services/cellular_setup/public/mojom/esim_manager.mojom.h"
370 #include "chromeos/ash/services/connectivity/public/mojom/passpoint.mojom.h"
371 #include "chromeos/ash/services/hotspot_config/public/mojom/cros_hotspot_config.mojom.h"
372 #include "chromeos/ash/services/multidevice_setup/multidevice_setup_service.h"
373 #include "chromeos/ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
374 #include "chromeos/ash/services/nearby/public/mojom/nearby_share_settings.mojom.h" // nogncheck crbug.com/1125897
375 #include "chromeos/ash/services/orca/public/mojom/orca_service.mojom.h"
376 #include "chromeos/components/print_management/mojom/printing_manager.mojom.h" // nogncheck
377 #include "chromeos/constants/chromeos_features.h"
378 #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
379 #include "chromeos/services/network_health/public/mojom/network_diagnostics.mojom.h" // nogncheck
380 #include "chromeos/services/network_health/public/mojom/network_health.mojom.h" // nogncheck
381 #include "media/capture/video/chromeos/mojom/camera_app.mojom.h"
382 #include "third_party/blink/public/mojom/digital_goods/digital_goods.mojom.h"
383 #include "ui/webui/resources/cr_components/app_management/app_management.mojom.h"
384 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
386 #if BUILDFLAG(IS_CHROMEOS_LACROS)
387 #include "chrome/browser/apps/digital_goods/digital_goods_factory_stub.h"
388 #include "chrome/browser/apps/digital_goods/digital_goods_lacros.h"
389 #include "chrome/browser/lacros/cros_apps/api/diagnostics/cros_diagnostics_impl.h"
390 #include "chromeos/constants/chromeos_features.h"
391 #include "chromeos/lacros/lacros_service.h"
392 #include "third_party/blink/public/mojom/chromeos/diagnostics/cros_diagnostics.mojom.h"
394 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom.h" // nogncheck
395 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h" // nogncheck
396 #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
398 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
399 BUILDFLAG(IS_ANDROID)
400 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
401 #include "chrome/browser/webshare/share_service_impl.h"
403 #include "third_party/blink/public/mojom/webshare/webshare.mojom.h"
406 #if BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD)
407 #include "ash/webui/sample_system_web_app_ui/mojom/sample_system_web_app_ui.mojom.h"
408 #include "ash/webui/sample_system_web_app_ui/sample_system_web_app_ui.h"
409 #include "ash/webui/sample_system_web_app_ui/sample_system_web_app_untrusted_ui.h"
410 #include "ash/webui/status_area_internals/mojom/status_area_internals.mojom.h"
411 #include "ash/webui/status_area_internals/status_area_internals_ui.h"
414 #if BUILDFLAG(ENABLE_SPEECH_SERVICE)
415 #include "chrome/browser/accessibility/live_caption/live_caption_speech_recognition_host.h"
416 #include "chrome/browser/accessibility/live_caption/live_caption_unavailability_notifier.h"
417 #include "chrome/browser/speech/speech_recognition_client_browser_interface.h"
418 #include "chrome/browser/speech/speech_recognition_client_browser_interface_factory.h"
419 #include "chrome/browser/speech/speech_recognition_service.h"
420 #include "media/mojo/mojom/renderer_extensions.mojom.h"
421 #include "media/mojo/mojom/speech_recognition.mojom.h" // nogncheck
422 #if BUILDFLAG(IS_CHROMEOS_LACROS)
423 #include "chrome/browser/accessibility/live_caption/live_caption_surface.h"
424 #include "chromeos/crosapi/mojom/speech_recognition.mojom.h"
425 #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
426 #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE)
428 #if BUILDFLAG(IS_WIN)
429 #include "chrome/browser/media/media_foundation_service_monitor.h"
430 #include "media/mojo/mojom/media_foundation_preferences.mojom.h"
431 #include "media/mojo/services/media_foundation_preferences.h"
432 #endif // BUILDFLAG(IS_WIN)
434 #if BUILDFLAG(ENABLE_BROWSER_SPEECH_SERVICE)
435 #include "chrome/browser/speech/speech_recognition_service_factory.h"
436 #include "media/mojo/mojom/speech_recognition_service.mojom.h"
437 #endif // BUILDFLAG(ENABLE_BROWSER_SPEECH_SERVICE)
439 #if BUILDFLAG(ENABLE_EXTENSIONS)
440 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
441 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
442 #include "extensions/common/api/mime_handler.mojom.h" // nogncheck
445 #if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
446 #include "chrome/browser/ui/webui/tab_strip/tab_strip.mojom.h"
447 #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui.h"
450 #if BUILDFLAG(PLATFORM_CFM)
451 #include "chrome/browser/ui/webui/ash/chromebox_for_meetings/network_settings_dialog.h"
454 #if BUILDFLAG(ENABLE_COMPOSE)
455 #include "chrome/browser/ui/webui/compose/compose_ui.h"
456 #include "chrome/common/compose/compose.mojom.h"
457 #include "components/compose/core/browser/compose_features.h" // nogncheck crbug.com/1125897
460 #if BUILDFLAG(IS_CHROMEOS_ASH)
461 void ash::SystemExtensionsInternalsUI::BindInterface(
462 mojo::PendingReceiver<ash::mojom::system_extensions_internals::PageHandler>
464 page_handler_ = std::make_unique<SystemExtensionsInternalsPageHandler>(
465 Profile::FromWebUI(web_ui()), std::move(receiver));
469 #if BUILDFLAG(ENABLE_SEARCH_ENGINE_CHOICE)
470 #include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice.mojom.h"
471 #include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.h"
474 #if BUILDFLAG(IS_CHROMEOS)
475 #include "chrome/browser/ui/webui/dlp_internals/dlp_internals.mojom.h"
476 #include "chrome/browser/ui/webui/dlp_internals/dlp_internals_ui.h"
482 using content::RegisterWebUIControllerInterfaceBinder;
484 #if BUILDFLAG(ENABLE_UNHANDLED_TAP)
485 void BindUnhandledTapWebContentsObserver(
486 content::RenderFrameHost* const host,
487 mojo::PendingReceiver<blink::mojom::UnhandledTapNotifier> receiver) {
488 auto* web_contents = content::WebContents::FromRenderFrameHost(host);
493 auto* unhandled_tap_notifier_observer =
494 contextual_search::UnhandledTapWebContentsObserver::FromWebContents(
496 if (!unhandled_tap_notifier_observer) {
500 contextual_search::CreateUnhandledTapNotifierImpl(
501 unhandled_tap_notifier_observer->unhandled_tap_callback(),
502 std::move(receiver));
504 #endif // BUILDFLAG(ENABLE_UNHANDLED_TAP)
506 // Forward image Annotator requests to the profile's AccessibilityLabelsService.
507 void BindImageAnnotator(
508 content::RenderFrameHost* frame_host,
509 mojo::PendingReceiver<image_annotation::mojom::Annotator> receiver) {
510 AccessibilityLabelsServiceFactory::GetForProfile(
511 Profile::FromBrowserContext(
512 frame_host->GetProcess()->GetBrowserContext()))
513 ->BindImageAnnotator(std::move(receiver));
516 void BindCommerceHintObserver(
517 content::RenderFrameHost* const frame_host,
518 mojo::PendingReceiver<cart::mojom::CommerceHintObserver> receiver) {
519 // This is specifically restricting this to main frames, whether they are the
520 // main frame of the tab or a <portal> element, while preventing this from
521 // working in subframes and fenced frames.
522 if (frame_host->GetParent() || frame_host->IsFencedFrameRoot()) {
523 mojo::ReportBadMessage(
524 "Unexpected the message from subframe or fenced frame.");
528 // Check if features require CommerceHint are enabled.
529 #if !BUILDFLAG(IS_ANDROID)
530 if (!IsCartModuleEnabled()) {
534 if (!base::FeatureList::IsEnabled(commerce::kCommerceHintAndroid)) {
539 // On Android, commerce hint observer is enabled for all users with the feature
540 // enabled since the observer is only used for collecting metrics for now, and
541 // we want to maximize the user population exposed; on Desktop, ChromeCart is
542 // not available for non-signin single-profile users and therefore neither does
543 // commerce hint observer.
544 #if !BUILDFLAG(IS_ANDROID)
545 Profile* profile = Profile::FromBrowserContext(
546 frame_host->GetProcess()->GetBrowserContext());
547 auto* identity_manager = IdentityManagerFactory::GetForProfile(profile);
548 ProfileManager* profile_manager = g_browser_process->profile_manager();
549 if (!identity_manager || !profile_manager) {
552 if (!identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSignin) &&
553 profile_manager->GetNumberOfProfiles() <= 1) {
557 auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
561 content::BrowserContext* browser_context = web_contents->GetBrowserContext();
562 if (!browser_context) {
565 if (browser_context->IsOffTheRecord()) {
569 cart::CommerceHintService::CreateForWebContents(web_contents);
570 cart::CommerceHintService* service =
571 cart::CommerceHintService::FromWebContents(web_contents);
575 service->BindCommerceHintObserver(frame_host, std::move(receiver));
578 void BindDistillabilityService(
579 content::RenderFrameHost* const frame_host,
580 mojo::PendingReceiver<dom_distiller::mojom::DistillabilityService>
582 auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
587 dom_distiller::DistillabilityDriver* driver =
588 dom_distiller::DistillabilityDriver::FromWebContents(web_contents);
592 driver->SetIsSecureCallback(
593 base::BindRepeating([](content::WebContents* contents) {
594 // SecurityStateTabHelper uses chrome-specific
595 // GetVisibleSecurityState to determine if a page is SECURE.
596 return SecurityStateTabHelper::FromWebContents(contents)
597 ->GetSecurityLevel() ==
598 security_state::SecurityLevel::SECURE;
600 driver->CreateDistillabilityService(std::move(receiver));
603 void BindDistillerJavaScriptService(
604 content::RenderFrameHost* const frame_host,
605 mojo::PendingReceiver<dom_distiller::mojom::DistillerJavaScriptService>
607 auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
612 dom_distiller::DomDistillerService* dom_distiller_service =
613 dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
614 web_contents->GetBrowserContext());
615 #if BUILDFLAG(IS_ANDROID)
616 static_cast<dom_distiller::android::DistillerUIHandleAndroid*>(
617 dom_distiller_service->GetDistillerUIHandle())
618 ->set_render_frame_host(frame_host);
620 CreateDistillerJavaScriptService(dom_distiller_service->GetWeakPtr(),
621 std::move(receiver));
624 void BindPrerenderCanceler(
625 content::RenderFrameHost* frame_host,
626 mojo::PendingReceiver<prerender::mojom::PrerenderCanceler> receiver) {
627 auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
632 auto* no_state_prefetch_contents =
633 prerender::ChromeNoStatePrefetchContentsDelegate::FromWebContents(
635 if (!no_state_prefetch_contents) {
638 no_state_prefetch_contents->AddPrerenderCancelerReceiver(std::move(receiver));
641 void BindNoStatePrefetchProcessor(
642 content::RenderFrameHost* frame_host,
643 mojo::PendingReceiver<blink::mojom::NoStatePrefetchProcessor> receiver) {
644 prerender::NoStatePrefetchProcessorImpl::Create(
645 frame_host, std::move(receiver),
647 prerender::ChromeNoStatePrefetchProcessorImplDelegate>());
650 #if BUILDFLAG(IS_ANDROID)
651 template <typename Interface>
652 void ForwardToJavaWebContents(content::RenderFrameHost* frame_host,
653 mojo::PendingReceiver<Interface> receiver) {
654 content::WebContents* contents =
655 content::WebContents::FromRenderFrameHost(frame_host);
657 contents->GetJavaInterfaces()->GetInterface(std::move(receiver));
661 template <typename Interface>
662 void ForwardToJavaFrame(content::RenderFrameHost* render_frame_host,
663 mojo::PendingReceiver<Interface> receiver) {
664 render_frame_host->GetJavaInterfaces()->GetInterface(std::move(receiver));
668 #if BUILDFLAG(ENABLE_EXTENSIONS)
669 void BindMimeHandlerService(
670 content::RenderFrameHost* frame_host,
671 mojo::PendingReceiver<extensions::mime_handler::MimeHandlerService>
674 extensions::MimeHandlerViewGuest::FromRenderFrameHost(frame_host);
678 extensions::MimeHandlerServiceImpl::Create(guest_view->GetStreamWeakPtr(),
679 std::move(receiver));
682 void BindBeforeUnloadControl(
683 content::RenderFrameHost* frame_host,
684 mojo::PendingReceiver<extensions::mime_handler::BeforeUnloadControl>
687 extensions::MimeHandlerViewGuest::FromRenderFrameHost(frame_host);
691 guest_view->FuseBeforeUnloadControl(std::move(receiver));
695 void BindNetworkHintsHandler(
696 content::RenderFrameHost* frame_host,
697 mojo::PendingReceiver<network_hints::mojom::NetworkHintsHandler> receiver) {
698 predictors::NetworkHintsHandlerImpl::Create(frame_host, std::move(receiver));
701 #if BUILDFLAG(ENABLE_SPEECH_SERVICE)
702 void BindSpeechRecognitionContextHandler(
703 content::RenderFrameHost* frame_host,
704 mojo::PendingReceiver<media::mojom::SpeechRecognitionContext> receiver) {
705 if (!captions::IsLiveCaptionFeatureSupported()) {
709 #if BUILDFLAG(IS_CHROMEOS_LACROS)
710 // On LaCrOS, forward to Ash.
711 auto* service = chromeos::LacrosService::Get();
712 if (service && service->IsAvailable<crosapi::mojom::SpeechRecognition>()) {
713 service->GetRemote<crosapi::mojom::SpeechRecognition>()
714 ->BindSpeechRecognitionContext(std::move(receiver));
717 // On other platforms (Ash, desktop), bind via the appropriate factory.
718 Profile* profile = Profile::FromBrowserContext(
719 frame_host->GetProcess()->GetBrowserContext());
720 #if BUILDFLAG(ENABLE_BROWSER_SPEECH_SERVICE)
721 auto* factory = SpeechRecognitionServiceFactory::GetForProfile(profile);
722 #elif BUILDFLAG(IS_CHROMEOS_ASH)
723 auto* factory = CrosSpeechRecognitionServiceFactory::GetForProfile(profile);
725 #error "No speech recognition service factory on this platform."
727 factory->BindSpeechRecognitionContext(std::move(receiver));
728 #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
731 void BindSpeechRecognitionClientBrowserInterfaceHandler(
732 content::RenderFrameHost* frame_host,
733 mojo::PendingReceiver<media::mojom::SpeechRecognitionClientBrowserInterface>
735 if (captions::IsLiveCaptionFeatureSupported()) {
736 #if BUILDFLAG(IS_CHROMEOS_LACROS)
737 // On LaCrOS, forward to Ash.
738 auto* service = chromeos::LacrosService::Get();
739 if (service && service->IsAvailable<crosapi::mojom::SpeechRecognition>()) {
740 service->GetRemote<crosapi::mojom::SpeechRecognition>()
741 ->BindSpeechRecognitionClientBrowserInterface(std::move(receiver));
744 // On other platforms (Ash, desktop), bind in this process.
745 Profile* profile = Profile::FromBrowserContext(
746 frame_host->GetProcess()->GetBrowserContext());
747 SpeechRecognitionClientBrowserInterfaceFactory::GetForProfile(profile)
748 ->BindReceiver(std::move(receiver));
749 #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
753 void BindSpeechRecognitionRecognizerClientHandler(
754 content::RenderFrameHost* frame_host,
755 mojo::PendingReceiver<media::mojom::SpeechRecognitionRecognizerClient>
757 #if BUILDFLAG(IS_CHROMEOS_LACROS)
758 // On LaCrOS, forward to Ash.
760 // Hold a client-browser interface just long enough to bootstrap a remote
761 // recognizer client.
762 mojo::Remote<media::mojom::SpeechRecognitionClientBrowserInterface>
764 auto* service = chromeos::LacrosService::Get();
765 if (!service || !service->IsAvailable<crosapi::mojom::SpeechRecognition>()) {
768 service->GetRemote<crosapi::mojom::SpeechRecognition>()
769 ->BindSpeechRecognitionClientBrowserInterface(
770 interface_remote.BindNewPipeAndPassReceiver());
772 // Grab the per-web-contents logic on our end to drive the remote client.
773 auto* surface = captions::LiveCaptionSurface::GetOrCreateForWebContents(
774 content::WebContents::FromRenderFrameHost(frame_host));
775 mojo::PendingRemote<media::mojom::SpeechRecognitionSurface> surface_remote;
776 mojo::PendingReceiver<media::mojom::SpeechRecognitionSurfaceClient>
777 surface_client_receiver;
778 surface->BindToSurfaceClient(
779 surface_remote.InitWithNewPipeAndPassReceiver(),
780 surface_client_receiver.InitWithNewPipeAndPassRemote());
782 // Populate static info to send to the client.
783 auto metadata = media::mojom::SpeechRecognitionSurfaceMetadata::New();
784 metadata->session_id = surface->session_id();
786 // Bootstrap the recognizer client.
787 interface_remote->BindRecognizerToRemoteClient(
788 std::move(client_receiver), std::move(surface_client_receiver),
789 std::move(surface_remote), std::move(metadata));
791 Profile* profile = Profile::FromBrowserContext(
792 frame_host->GetProcess()->GetBrowserContext());
793 PrefService* profile_prefs = profile->GetPrefs();
794 if (profile_prefs->GetBoolean(prefs::kLiveCaptionEnabled) &&
795 captions::IsLiveCaptionFeatureSupported()) {
796 captions::LiveCaptionSpeechRecognitionHost::Create(
797 frame_host, std::move(client_receiver));
802 #if BUILDFLAG(IS_WIN)
803 void BindMediaFoundationRendererNotifierHandler(
804 content::RenderFrameHost* frame_host,
805 mojo::PendingReceiver<media::mojom::MediaFoundationRendererNotifier>
807 if (captions::IsLiveCaptionFeatureSupported()) {
808 captions::LiveCaptionUnavailabilityNotifier::Create(frame_host,
809 std::move(receiver));
812 #endif // BUILDFLAG(IS_WIN)
813 #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE)
815 #if BUILDFLAG(IS_WIN)
816 void BindMediaFoundationPreferences(
817 content::RenderFrameHost* frame_host,
818 mojo::PendingReceiver<media::mojom::MediaFoundationPreferences> receiver) {
819 MediaFoundationPreferencesImpl::Create(
820 frame_host->GetSiteInstance()->GetSiteURL(),
821 base::BindRepeating(&MediaFoundationServiceMonitor::
822 IsHardwareSecureDecryptionAllowedForSite),
823 std::move(receiver));
825 #endif // BUILDFLAG(IS_WIN)
827 #if BUILDFLAG(IS_CHROMEOS_ASH)
828 void BindNewWindowProxy(
829 content::RenderFrameHost* render_frame_host,
830 mojo::PendingReceiver<new_window_proxy::mojom::NewWindowProxy> receiver) {
831 DCHECK(render_frame_host);
834 content::WebContents::FromRenderFrameHost(render_frame_host);
836 if (web_contents->GetVisibleURL().spec() != chrome::kChromeUIEmojiPickerURL) {
840 new ash::NewWindowProxy(std::move(receiver));
844 #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
845 void BindScreenAIAnnotator(
846 content::RenderFrameHost* frame_host,
847 mojo::PendingReceiver<screen_ai::mojom::ScreenAIAnnotator> receiver) {
848 content::BrowserContext* browser_context =
849 frame_host->GetProcess()->GetBrowserContext();
851 screen_ai::ScreenAIServiceRouterFactory::GetForBrowserContext(browser_context)
852 ->BindScreenAIAnnotator(std::move(receiver));
855 void BindScreen2xMainContentExtractor(
856 content::RenderFrameHost* frame_host,
857 mojo::PendingReceiver<screen_ai::mojom::Screen2xMainContentExtractor>
859 screen_ai::ScreenAIServiceRouterFactory::GetForBrowserContext(
860 frame_host->GetProcess()->GetBrowserContext())
861 ->BindMainContentExtractor(std::move(receiver));
865 #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
867 void BindVisualSuggestionsModelProvider(
868 content::RenderFrameHost* frame_host,
869 mojo::PendingReceiver<
870 companion::visual_search::mojom::VisualSuggestionsModelProvider>
872 companion::visual_search::VisualSearchSuggestionsServiceFactory::
873 GetForProfile(Profile::FromBrowserContext(
874 frame_host->GetProcess()->GetBrowserContext()))
875 ->BindModelReceiver(std::move(receiver));
879 void PopulateChromeFrameBinders(
880 mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
881 content::RenderFrameHost* render_frame_host) {
882 map->Add<image_annotation::mojom::Annotator>(
883 base::BindRepeating(&BindImageAnnotator));
885 map->Add<cart::mojom::CommerceHintObserver>(
886 base::BindRepeating(&BindCommerceHintObserver));
888 map->Add<blink::mojom::AnchorElementMetricsHost>(
889 base::BindRepeating(&NavigationPredictor::Create));
891 map->Add<blink::mojom::LCPCriticalPathPredictorHost>(
892 base::BindRepeating(&predictors::LCPCriticalPathPredictorHost::Create));
894 map->Add<dom_distiller::mojom::DistillabilityService>(
895 base::BindRepeating(&BindDistillabilityService));
897 map->Add<dom_distiller::mojom::DistillerJavaScriptService>(
898 base::BindRepeating(&BindDistillerJavaScriptService));
900 map->Add<prerender::mojom::PrerenderCanceler>(
901 base::BindRepeating(&BindPrerenderCanceler));
903 map->Add<blink::mojom::NoStatePrefetchProcessor>(
904 base::BindRepeating(&BindNoStatePrefetchProcessor));
906 if (performance_manager::PerformanceManager::IsAvailable()) {
907 map->Add<performance_manager::mojom::DocumentCoordinationUnit>(
909 &performance_manager::BindDocumentCoordinationUnit));
912 map->Add<translate::mojom::ContentTranslateDriver>(
913 base::BindRepeating(&translate::BindContentTranslateDriver));
915 map->Add<blink::mojom::CredentialManager>(
916 base::BindRepeating(&ChromePasswordManagerClient::BindCredentialManager));
918 map->Add<payments::mojom::PaymentCredential>(
919 base::BindRepeating(&payments::CreatePaymentCredential));
921 map->Add<chrome::mojom::OpenSearchDescriptionDocumentHandler>(
923 &SearchEngineTabHelper::BindOpenSearchDescriptionDocumentHandler));
925 #if BUILDFLAG(IS_ANDROID)
926 map->Add<blink::mojom::InstalledAppProvider>(base::BindRepeating(
927 &ForwardToJavaFrame<blink::mojom::InstalledAppProvider>));
928 map->Add<payments::mojom::DigitalGoodsFactory>(base::BindRepeating(
929 &ForwardToJavaFrame<payments::mojom::DigitalGoodsFactory>));
930 #if defined(BROWSER_MEDIA_CONTROLS_MENU)
931 map->Add<blink::mojom::MediaControlsMenuHost>(base::BindRepeating(
932 &ForwardToJavaFrame<blink::mojom::MediaControlsMenuHost>));
934 map->Add<chrome::mojom::OfflinePageAutoFetcher>(
935 base::BindRepeating(&offline_pages::OfflinePageAutoFetcher::Create));
936 if (base::FeatureList::IsEnabled(features::kWebPayments)) {
937 map->Add<payments::mojom::PaymentRequest>(base::BindRepeating(
938 &ForwardToJavaFrame<payments::mojom::PaymentRequest>));
940 map->Add<blink::mojom::ShareService>(base::BindRepeating(
941 &ForwardToJavaWebContents<blink::mojom::ShareService>));
942 if (base::FeatureList::IsEnabled(blink::features::kWebEnvironmentIntegrity)) {
943 map->Add<blink::mojom::EnvironmentIntegrityService>(base::BindRepeating(
944 &environment_integrity::AndroidEnvironmentIntegrityService::Create));
947 #if BUILDFLAG(ENABLE_UNHANDLED_TAP)
948 map->Add<blink::mojom::UnhandledTapNotifier>(
949 base::BindRepeating(&BindUnhandledTapWebContentsObserver));
950 #endif // BUILDFLAG(ENABLE_UNHANDLED_TAP)
953 map->Add<blink::mojom::BadgeService>(
954 base::BindRepeating(&badging::BadgeManager::BindFrameReceiverIfAllowed));
955 if (base::FeatureList::IsEnabled(features::kWebPayments)) {
956 map->Add<payments::mojom::PaymentRequest>(
957 base::BindRepeating(&payments::CreatePaymentRequest));
961 #if BUILDFLAG(IS_CHROMEOS_ASH)
962 map->Add<payments::mojom::DigitalGoodsFactory>(base::BindRepeating(
963 &apps::DigitalGoodsFactoryImpl::BindDigitalGoodsFactory));
966 #if BUILDFLAG(IS_CHROMEOS_LACROS)
967 if (web_app::IsWebAppsCrosapiEnabled()) {
968 map->Add<payments::mojom::DigitalGoodsFactory>(
969 base::BindRepeating(&apps::DigitalGoodsFactoryLacros::Bind));
971 map->Add<payments::mojom::DigitalGoodsFactory>(
972 base::BindRepeating(&apps::DigitalGoodsFactoryStub::Bind));
975 if (chromeos::features::IsBlinkExtensionDiagnosticsEnabled()) {
976 map->Add<blink::mojom::CrosDiagnostics>(
977 base::BindRepeating(&CrosDiagnosticsImpl::Create));
981 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
982 if (base::FeatureList::IsEnabled(features::kWebShare)) {
983 map->Add<blink::mojom::ShareService>(
984 base::BindRepeating(&ShareServiceImpl::Create));
988 #if BUILDFLAG(ENABLE_EXTENSIONS)
989 map->Add<extensions::mime_handler::MimeHandlerService>(
990 base::BindRepeating(&BindMimeHandlerService));
991 map->Add<extensions::mime_handler::BeforeUnloadControl>(
992 base::BindRepeating(&BindBeforeUnloadControl));
995 map->Add<network_hints::mojom::NetworkHintsHandler>(
996 base::BindRepeating(&BindNetworkHintsHandler));
998 #if BUILDFLAG(ENABLE_SPEECH_SERVICE)
999 map->Add<media::mojom::SpeechRecognitionContext>(
1000 base::BindRepeating(&BindSpeechRecognitionContextHandler));
1001 map->Add<media::mojom::SpeechRecognitionClientBrowserInterface>(
1002 base::BindRepeating(&BindSpeechRecognitionClientBrowserInterfaceHandler));
1003 map->Add<media::mojom::SpeechRecognitionRecognizerClient>(
1004 base::BindRepeating(&BindSpeechRecognitionRecognizerClientHandler));
1005 #if BUILDFLAG(IS_WIN)
1006 map->Add<media::mojom::MediaFoundationRendererNotifier>(
1007 base::BindRepeating(&BindMediaFoundationRendererNotifierHandler));
1009 #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE)
1011 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
1012 BUILDFLAG(IS_CHROMEOS)
1013 if (!render_frame_host->GetParent()) {
1014 map->Add<chrome::mojom::DraggableRegions>(
1015 base::BindRepeating(&DraggableRegionsHostImpl::CreateIfAllowed));
1019 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
1020 BUILDFLAG(IS_CHROMEOS)
1021 if (base::FeatureList::IsEnabled(blink::features::kDesktopPWAsSubApps) &&
1022 !render_frame_host->GetParentOrOuterDocument()) {
1023 // The service binder will reject non-primary main frames, but we still need
1024 // to register it for them because a non-primary main frame could become a
1025 // primary main frame at a later time (eg. a prerendered page).
1026 map->Add<blink::mojom::SubAppsService>(
1027 base::BindRepeating(&web_app::SubAppsServiceImpl::CreateIfAllowed));
1030 if (companion::visual_search::features::
1031 IsVisualSearchSuggestionsAgentEnabled()) {
1032 map->Add<companion::visual_search::mojom::VisualSuggestionsModelProvider>(
1033 base::BindRepeating(&BindVisualSuggestionsModelProvider));
1037 #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
1038 if (features::IsPdfOcrEnabled()) {
1039 map->Add<screen_ai::mojom::ScreenAIAnnotator>(
1040 base::BindRepeating(&BindScreenAIAnnotator));
1043 if (features::IsReadAnythingWithScreen2xEnabled()) {
1044 map->Add<screen_ai::mojom::Screen2xMainContentExtractor>(
1045 base::BindRepeating(&BindScreen2xMainContentExtractor));
1049 #if BUILDFLAG(IS_WIN)
1050 map->Add<media::mojom::MediaFoundationPreferences>(
1051 base::BindRepeating(&BindMediaFoundationPreferences));
1055 void PopulateChromeWebUIFrameBinders(
1056 mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
1057 content::RenderFrameHost* render_frame_host) {
1058 #if !BUILDFLAG(IS_CHROMEOS_LACROS)
1059 RegisterWebUIControllerInterfaceBinder<::mojom::BluetoothInternalsHandler,
1060 BluetoothInternalsUI>(map);
1063 RegisterWebUIControllerInterfaceBinder<
1064 media::mojom::MediaEngagementScoreDetailsProvider, MediaEngagementUI>(
1067 RegisterWebUIControllerInterfaceBinder<browsing_topics::mojom::PageHandler,
1068 BrowsingTopicsInternalsUI>(map);
1070 RegisterWebUIControllerInterfaceBinder<
1071 media_history::mojom::MediaHistoryStore, MediaHistoryUI>(map);
1073 RegisterWebUIControllerInterfaceBinder<::mojom::OmniboxPageHandler,
1076 RegisterWebUIControllerInterfaceBinder<
1077 site_engagement::mojom::SiteEngagementDetailsProvider, SiteEngagementUI>(
1080 RegisterWebUIControllerInterfaceBinder<::mojom::UsbInternalsPageHandler,
1081 UsbInternalsUI>(map);
1083 RegisterWebUIControllerInterfaceBinder<
1084 history_clusters_internals::mojom::PageHandlerFactory,
1085 HistoryClustersInternalsUI>(map);
1087 RegisterWebUIControllerInterfaceBinder<
1088 optimization_guide_internals::mojom::PageHandlerFactory,
1089 OptimizationGuideInternalsUI>(map);
1091 RegisterWebUIControllerInterfaceBinder<
1092 segmentation_internals::mojom::PageHandlerFactory,
1093 SegmentationInternalsUI>(map);
1095 RegisterWebUIControllerInterfaceBinder<
1096 commerce::mojom::CommerceInternalsHandlerFactory,
1097 commerce::CommerceInternalsUI>(map);
1099 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
1100 BUILDFLAG(IS_CHROMEOS_ASH)
1101 RegisterWebUIControllerInterfaceBinder<
1102 connectors_internals::mojom::PageHandler,
1103 enterprise_connectors::ConnectorsInternalsUI>(map);
1106 #if BUILDFLAG(IS_CHROMEOS)
1107 RegisterWebUIControllerInterfaceBinder<dlp_internals::mojom::PageHandler,
1108 policy::DlpInternalsUI>(map);
1111 #if BUILDFLAG(ENABLE_SEARCH_ENGINE_CHOICE)
1112 if (search_engines::IsChoiceScreenFlagEnabled(
1113 search_engines::ChoicePromo::kAny)) {
1114 RegisterWebUIControllerInterfaceBinder<
1115 search_engine_choice::mojom::PageHandlerFactory, SearchEngineChoiceUI>(
1120 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
1121 BUILDFLAG(IS_FUCHSIA)
1122 RegisterWebUIControllerInterfaceBinder<
1123 app_management::mojom::PageHandlerFactory, WebAppSettingsUI>(map);
1126 #if !BUILDFLAG(IS_ANDROID)
1127 RegisterWebUIControllerInterfaceBinder<downloads::mojom::PageHandlerFactory,
1130 RegisterWebUIControllerInterfaceBinder<
1131 new_tab_page_third_party::mojom::PageHandlerFactory,
1132 NewTabPageThirdPartyUI>(map);
1134 RegisterWebUIControllerInterfaceBinder<
1135 color_change_listener::mojom::PageHandler,
1136 #if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
1139 #if BUILDFLAG(IS_CHROMEOS_ASH)
1140 ash::OobeUI, ash::personalization_app::PersonalizationAppUI,
1141 ash::settings::OSSettingsUI, ash::DiagnosticsDialogUI,
1142 ash::FirmwareUpdateAppUI, ash::ScanningUI, ash::OSFeedbackUI,
1143 ash::ShortcutCustomizationAppUI,
1144 ash::printing::printing_manager::PrintManagementUI,
1145 ash::InternetConfigDialogUI, ash::InternetDetailDialogUI, ash::SetTimeUI,
1146 ash::BluetoothPairingDialogUI, nearby_share::NearbyShareDialogUI,
1147 ash::cloud_upload::CloudUploadUI, ash::office_fallback::OfficeFallbackUI,
1148 ash::multidevice_setup::MultiDeviceSetupDialogUI, ash::ParentAccessUI,
1151 #if BUILDFLAG(ENABLE_COMPOSE)
1154 NewTabPageUI, OmniboxPopupUI, BookmarksSidePanelUI, CustomizeChromeUI,
1155 InternalsUI, ReadingListUI, TabSearchUI, WebuiGalleryUI,
1156 HistoryClustersSidePanelUI, PerformanceSidePanelUI,
1157 ShoppingInsightsSidePanelUI>(map);
1159 RegisterWebUIControllerInterfaceBinder<
1160 new_tab_page::mojom::PageHandlerFactory, NewTabPageUI>(map);
1162 RegisterWebUIControllerInterfaceBinder<
1163 most_visited::mojom::MostVisitedPageHandlerFactory, NewTabPageUI,
1164 NewTabPageThirdPartyUI>(map);
1166 auto* history_clusters_service =
1167 HistoryClustersServiceFactory::GetForBrowserContext(
1168 render_frame_host->GetProcess()->GetBrowserContext());
1169 if (history_clusters_service &&
1170 history_clusters_service->is_journeys_feature_flag_enabled()) {
1171 if (base::FeatureList::IsEnabled(history_clusters::kSidePanelJourneys)) {
1172 RegisterWebUIControllerInterfaceBinder<
1173 history_clusters::mojom::PageHandler, HistoryUI,
1174 HistoryClustersSidePanelUI>(map);
1176 RegisterWebUIControllerInterfaceBinder<
1177 history_clusters::mojom::PageHandler, HistoryUI>(map);
1181 RegisterWebUIControllerInterfaceBinder<
1182 page_image_service::mojom::PageImageServiceHandler, HistoryUI,
1183 HistoryClustersSidePanelUI, NewTabPageUI, BookmarksSidePanelUI>(map);
1185 RegisterWebUIControllerInterfaceBinder<
1186 browser_command::mojom::CommandHandlerFactory, NewTabPageUI, WhatsNewUI>(
1189 RegisterWebUIControllerInterfaceBinder<omnibox::mojom::PageHandler,
1190 NewTabPageUI, OmniboxPopupUI>(map);
1192 RegisterWebUIControllerInterfaceBinder<suggest_internals::mojom::PageHandler,
1193 SuggestInternalsUI>(map);
1195 RegisterWebUIControllerInterfaceBinder<
1196 customize_color_scheme_mode::mojom::
1197 CustomizeColorSchemeModeHandlerFactory,
1198 CustomizeChromeUI, settings::SettingsUI>(map);
1200 RegisterWebUIControllerInterfaceBinder<
1201 theme_color_picker::mojom::ThemeColorPickerHandlerFactory,
1203 #if !BUILDFLAG(IS_CHROMEOS_ASH)
1205 ProfileCustomizationUI, settings::SettingsUI
1206 #endif // !BUILDFLAG(IS_CHROMEOS_ASH)
1209 RegisterWebUIControllerInterfaceBinder<
1210 customize_themes::mojom::CustomizeThemesHandlerFactory, NewTabPageUI
1211 #if !BUILDFLAG(IS_CHROMEOS_ASH)
1213 ProfileCustomizationUI, settings::SettingsUI
1214 #endif // !BUILDFLAG(IS_CHROMEOS_ASH)
1217 RegisterWebUIControllerInterfaceBinder<
1218 help_bubble::mojom::HelpBubbleHandlerFactory, InternalsUI,
1219 settings::SettingsUI, ReadingListUI, NewTabPageUI, CustomizeChromeUI,
1220 PasswordManagerUI>(map);
1222 #if !defined(OFFICIAL_BUILD)
1223 RegisterWebUIControllerInterfaceBinder<foo::mojom::FooHandler, NewTabPageUI>(
1225 #endif // !defined(OFFICIAL_BUILD)
1227 if (IsCartModuleEnabled() && customize_chrome::IsSidePanelEnabled()) {
1228 RegisterWebUIControllerInterfaceBinder<chrome_cart::mojom::CartHandler,
1229 NewTabPageUI, CustomizeChromeUI>(
1231 } else if (IsCartModuleEnabled()) {
1232 RegisterWebUIControllerInterfaceBinder<chrome_cart::mojom::CartHandler,
1236 if (IsDriveModuleEnabled()) {
1237 RegisterWebUIControllerInterfaceBinder<drive::mojom::DriveHandler,
1241 if (base::FeatureList::IsEnabled(ntp_features::kNtpPhotosModule)) {
1242 RegisterWebUIControllerInterfaceBinder<photos::mojom::PhotosHandler,
1246 if (IsRecipeTasksModuleEnabled()) {
1247 RegisterWebUIControllerInterfaceBinder<recipes::mojom::RecipesHandler,
1251 if (base::FeatureList::IsEnabled(ntp_features::kNtpFeedModule)) {
1252 RegisterWebUIControllerInterfaceBinder<ntp::feed::mojom::FeedHandler,
1256 if (base::FeatureList::IsEnabled(ntp_features::kNtpHistoryClustersModule) ||
1257 base::FeatureList::IsEnabled(
1258 ntp_features::kNtpHistoryClustersModuleLoad)) {
1259 if (base::FeatureList::IsEnabled(ntp_features::kNtpModulesRedesigned)) {
1260 RegisterWebUIControllerInterfaceBinder<
1261 ntp::history_clusters_v2::mojom::PageHandler, NewTabPageUI>(map);
1263 RegisterWebUIControllerInterfaceBinder<
1264 ntp::history_clusters::mojom::PageHandler, NewTabPageUI>(map);
1268 RegisterWebUIControllerInterfaceBinder<
1269 reading_list::mojom::PageHandlerFactory, ReadingListUI>(map);
1270 RegisterWebUIControllerInterfaceBinder<
1271 side_panel::mojom::BookmarksPageHandlerFactory, BookmarksSidePanelUI>(
1274 RegisterWebUIControllerInterfaceBinder<
1275 shopping_list::mojom::ShoppingListHandlerFactory, BookmarksSidePanelUI,
1276 ShoppingInsightsSidePanelUI>(map);
1278 if (base::FeatureList::IsEnabled(
1279 performance_manager::features::kPerformanceControlsSidePanel)) {
1280 RegisterWebUIControllerInterfaceBinder<
1281 side_panel::mojom::PerformancePageHandlerFactory,
1282 PerformanceSidePanelUI>(map);
1285 if (customize_chrome::IsSidePanelEnabled()) {
1286 RegisterWebUIControllerInterfaceBinder<
1287 side_panel::mojom::CustomizeChromePageHandlerFactory,
1288 CustomizeChromeUI>(map);
1290 if (base::FeatureList::IsEnabled(
1291 ntp_features::kCustomizeChromeWallpaperSearch) &&
1292 base::FeatureList::IsEnabled(
1293 optimization_guide::features::kOptimizationGuideModelExecution)) {
1294 RegisterWebUIControllerInterfaceBinder<
1295 side_panel::customize_chrome::mojom::WallpaperSearchHandler,
1296 CustomizeChromeUI>(map);
1300 if (user_notes::IsUserNotesEnabled()) {
1301 RegisterWebUIControllerInterfaceBinder<
1302 side_panel::mojom::UserNotesPageHandlerFactory, UserNotesSidePanelUI>(
1306 if (features::IsReadAnythingEnabled()) {
1307 RegisterWebUIControllerInterfaceBinder<
1308 read_anything::mojom::UntrustedPageHandlerFactory,
1309 ReadAnythingUntrustedUI>(map);
1312 RegisterWebUIControllerInterfaceBinder<tab_search::mojom::PageHandlerFactory,
1314 if (base::FeatureList::IsEnabled(features::kTabSearchUseMetricsReporter)) {
1315 RegisterWebUIControllerInterfaceBinder<
1316 metrics_reporter::mojom::PageMetricsHost, TabSearchUI, NewTabPageUI,
1317 OmniboxPopupUI>(map);
1319 RegisterWebUIControllerInterfaceBinder<
1320 metrics_reporter::mojom::PageMetricsHost, NewTabPageUI, OmniboxPopupUI>(
1324 RegisterWebUIControllerInterfaceBinder<
1325 ::mojom::user_education_internals::UserEducationInternalsPageHandler,
1328 RegisterWebUIControllerInterfaceBinder<
1329 ::mojom::app_service_internals::AppServiceInternalsPageHandler,
1330 AppServiceInternalsUI>(map);
1332 RegisterWebUIControllerInterfaceBinder<
1333 access_code_cast::mojom::PageHandlerFactory,
1334 media_router::AccessCodeCastUI>(map);
1335 #endif // BUILDFLAG(IS_ANDROID)
1337 #if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
1338 RegisterWebUIControllerInterfaceBinder<tab_strip::mojom::PageHandlerFactory,
1342 #if BUILDFLAG(IS_CHROMEOS_ASH)
1343 RegisterWebUIControllerInterfaceBinder<
1344 ash::file_manager::mojom::PageHandlerFactory,
1345 ash::file_manager::FileManagerUI>(map);
1347 RegisterWebUIControllerInterfaceBinder<
1348 add_supervision::mojom::AddSupervisionHandler, ash::AddSupervisionUI>(
1351 RegisterWebUIControllerInterfaceBinder<
1352 app_management::mojom::PageHandlerFactory, ash::settings::OSSettingsUI>(
1355 RegisterWebUIControllerInterfaceBinder<
1356 ash::settings::mojom::UserActionRecorder, ash::settings::OSSettingsUI>(
1359 RegisterWebUIControllerInterfaceBinder<ash::settings::mojom::SearchHandler,
1360 ash::settings::OSSettingsUI>(map);
1362 RegisterWebUIControllerInterfaceBinder<
1363 ash::personalization_app::mojom::SearchHandler,
1364 ash::settings::OSSettingsUI>(map);
1366 RegisterWebUIControllerInterfaceBinder<
1367 ash::settings::app_notification::mojom::AppNotificationsHandler,
1368 ash::settings::OSSettingsUI>(map);
1370 RegisterWebUIControllerInterfaceBinder<
1371 ash::settings::app_permission::mojom::AppPermissionsHandler,
1372 ash::settings::OSSettingsUI>(map);
1374 RegisterWebUIControllerInterfaceBinder<
1375 ash::settings::mojom::InputDeviceSettingsProvider,
1376 ash::settings::OSSettingsUI>(map);
1378 RegisterWebUIControllerInterfaceBinder<
1379 ash::settings::mojom::DisplaySettingsProvider,
1380 ash::settings::OSSettingsUI>(map);
1382 RegisterWebUIControllerInterfaceBinder<
1383 ash::common::mojom::ShortcutInputProvider, ash::settings::OSSettingsUI>(
1386 RegisterWebUIControllerInterfaceBinder<
1387 ash::cellular_setup::mojom::CellularSetup, ash::settings::OSSettingsUI>(
1390 RegisterWebUIControllerInterfaceBinder<ash::auth::mojom::AuthFactorConfig,
1391 ash::settings::OSSettingsUI,
1394 RegisterWebUIControllerInterfaceBinder<ash::auth::mojom::RecoveryFactorEditor,
1395 ash::settings::OSSettingsUI>(map);
1397 RegisterWebUIControllerInterfaceBinder<ash::auth::mojom::PinFactorEditor,
1398 ash::settings::OSSettingsUI,
1401 RegisterWebUIControllerInterfaceBinder<ash::auth::mojom::PasswordFactorEditor,
1402 ash::settings::OSSettingsUI,
1405 RegisterWebUIControllerInterfaceBinder<
1406 ash::cellular_setup::mojom::ESimManager, ash::settings::OSSettingsUI,
1407 ash::NetworkUI, ash::OobeUI>(map);
1409 RegisterWebUIControllerInterfaceBinder<
1410 ash::guest_os_installer::mojom::PageHandlerFactory,
1411 ash::GuestOSInstallerUI>(map);
1413 RegisterWebUIControllerInterfaceBinder<
1414 ash::borealis_installer::mojom::PageHandlerFactory,
1415 ash::BorealisInstallerUI>(map);
1417 RegisterWebUIControllerInterfaceBinder<
1418 ash::crostini_installer::mojom::PageHandlerFactory,
1419 ash::CrostiniInstallerUI>(map);
1421 RegisterWebUIControllerInterfaceBinder<
1422 ash::crostini_upgrader::mojom::PageHandlerFactory,
1423 ash::CrostiniUpgraderUI>(map);
1425 RegisterWebUIControllerInterfaceBinder<
1426 ash::multidevice_setup::mojom::MultiDeviceSetup, ash::OobeUI,
1427 ash::multidevice::ProximityAuthUI,
1428 ash::multidevice_setup::MultiDeviceSetupDialogUI>(map);
1430 RegisterWebUIControllerInterfaceBinder<
1431 parent_access_ui::mojom::ParentAccessUiHandler, ash::ParentAccessUI>(map);
1433 RegisterWebUIControllerInterfaceBinder<
1434 ash::multidevice_setup::mojom::PrivilegedHostDeviceSetter, ash::OobeUI>(
1437 RegisterWebUIControllerInterfaceBinder<
1438 chromeos::network_config::mojom::CrosNetworkConfig,
1439 #if BUILDFLAG(PLATFORM_CFM)
1440 ash::cfm::NetworkSettingsDialogUi,
1441 #endif // BUILDFLAG(PLATFORM_CFM)
1442 ash::InternetConfigDialogUI, ash::InternetDetailDialogUI, ash::NetworkUI,
1443 ash::OobeUI, ash::settings::OSSettingsUI, ash::LockScreenNetworkUI,
1444 ash::ShimlessRMADialogUI>(map);
1446 if (ash::features::IsPasspointSettingsEnabled()) {
1447 RegisterWebUIControllerInterfaceBinder<
1448 chromeos::connectivity::mojom::PasspointService,
1449 ash::InternetDetailDialogUI, ash::NetworkUI,
1450 ash::settings::OSSettingsUI>(map);
1453 RegisterWebUIControllerInterfaceBinder<
1454 chromeos::printing::printing_manager::mojom::PrintingMetadataProvider,
1455 ash::printing::printing_manager::PrintManagementUI>(map);
1457 RegisterWebUIControllerInterfaceBinder<
1458 chromeos::printing::printing_manager::mojom::PrintManagementHandler,
1459 ash::printing::printing_manager::PrintManagementUI>(map);
1461 RegisterWebUIControllerInterfaceBinder<
1462 ash::help_app::mojom::PageHandlerFactory, ash::HelpAppUI>(map);
1464 RegisterWebUIControllerInterfaceBinder<
1465 ash::local_search_service::mojom::Index, ash::HelpAppUI>(map);
1467 RegisterWebUIControllerInterfaceBinder<ash::help_app::mojom::SearchHandler,
1468 ash::HelpAppUI>(map);
1470 RegisterWebUIControllerInterfaceBinder<
1471 ash::eche_app::mojom::SignalingMessageExchanger,
1472 ash::eche_app::EcheAppUI>(map);
1474 RegisterWebUIControllerInterfaceBinder<
1475 ash::eche_app::mojom::SystemInfoProvider, ash::eche_app::EcheAppUI>(map);
1477 RegisterWebUIControllerInterfaceBinder<
1478 ash::eche_app::mojom::AccessibilityProvider, ash::eche_app::EcheAppUI>(
1481 RegisterWebUIControllerInterfaceBinder<ash::eche_app::mojom::UidGenerator,
1482 ash::eche_app::EcheAppUI>(map);
1484 RegisterWebUIControllerInterfaceBinder<
1485 ash::eche_app::mojom::NotificationGenerator, ash::eche_app::EcheAppUI>(
1488 RegisterWebUIControllerInterfaceBinder<
1489 ash::eche_app::mojom::DisplayStreamHandler, ash::eche_app::EcheAppUI>(
1492 RegisterWebUIControllerInterfaceBinder<
1493 ash::eche_app::mojom::StreamOrientationObserver,
1494 ash::eche_app::EcheAppUI>(map);
1496 RegisterWebUIControllerInterfaceBinder<
1497 ash::eche_app::mojom::ConnectionStatusObserver, ash::eche_app::EcheAppUI>(
1500 RegisterWebUIControllerInterfaceBinder<
1501 ash::eche_app::mojom::KeyboardLayoutHandler, ash::eche_app::EcheAppUI>(
1504 RegisterWebUIControllerInterfaceBinder<
1505 ash::media_app_ui::mojom::PageHandlerFactory, ash::MediaAppUI>(map);
1507 RegisterWebUIControllerInterfaceBinder<
1508 chromeos::network_health::mojom::NetworkHealthService, ash::NetworkUI,
1509 ash::ConnectivityDiagnosticsUI>(map);
1511 RegisterWebUIControllerInterfaceBinder<
1512 chromeos::network_diagnostics::mojom::NetworkDiagnosticsRoutines,
1513 ash::NetworkUI, ash::ConnectivityDiagnosticsUI>(map);
1515 RegisterWebUIControllerInterfaceBinder<
1516 ash::diagnostics::mojom::InputDataProvider, ash::DiagnosticsDialogUI>(
1519 RegisterWebUIControllerInterfaceBinder<
1520 ash::diagnostics::mojom::NetworkHealthProvider, ash::DiagnosticsDialogUI>(
1523 RegisterWebUIControllerInterfaceBinder<
1524 ash::diagnostics::mojom::SystemDataProvider, ash::DiagnosticsDialogUI>(
1527 RegisterWebUIControllerInterfaceBinder<
1528 ash::diagnostics::mojom::SystemRoutineController,
1529 ash::DiagnosticsDialogUI>(map);
1531 RegisterWebUIControllerInterfaceBinder<ash::vm::mojom::VmDiagnosticsProvider,
1534 RegisterWebUIControllerInterfaceBinder<ash::scanning::mojom::ScanService,
1535 ash::ScanningUI>(map);
1537 RegisterWebUIControllerInterfaceBinder<
1538 ash::common::mojom::AccessibilityFeatures, ash::ScanningUI>(map);
1540 RegisterWebUIControllerInterfaceBinder<
1541 ash::os_feedback_ui::mojom::HelpContentProvider, ash::OSFeedbackUI>(map);
1542 RegisterWebUIControllerInterfaceBinder<
1543 ash::os_feedback_ui::mojom::FeedbackServiceProvider, ash::OSFeedbackUI>(
1546 RegisterWebUIControllerInterfaceBinder<
1547 ash::shimless_rma::mojom::ShimlessRmaService, ash::ShimlessRMADialogUI>(
1550 if (base::FeatureList::IsEnabled(features::kShortcutCustomizationApp)) {
1551 RegisterWebUIControllerInterfaceBinder<
1552 ash::shortcut_customization::mojom::AcceleratorConfigurationProvider,
1553 ash::ShortcutCustomizationAppUI>(map);
1555 RegisterWebUIControllerInterfaceBinder<
1556 ash::shortcut_customization::mojom::SearchHandler,
1557 ash::ShortcutCustomizationAppUI>(map);
1560 RegisterWebUIControllerInterfaceBinder<
1561 emoji_picker::mojom::PageHandlerFactory, ash::EmojiUI>(map);
1563 RegisterWebUIControllerInterfaceBinder<sensor::mojom::PageHandlerFactory,
1564 ash::SensorInfoUI>(map);
1565 RegisterWebUIControllerInterfaceBinder<
1566 enterprise_reporting::mojom::PageHandlerFactory,
1567 ash::reporting::EnterpriseReportingUI>(map);
1569 RegisterWebUIControllerInterfaceBinder<
1570 ash::personalization_app::mojom::WallpaperProvider,
1571 ash::personalization_app::PersonalizationAppUI>(map);
1573 RegisterWebUIControllerInterfaceBinder<
1574 ash::personalization_app::mojom::AmbientProvider,
1575 ash::personalization_app::PersonalizationAppUI>(map);
1577 RegisterWebUIControllerInterfaceBinder<
1578 ash::personalization_app::mojom::ThemeProvider,
1579 ash::personalization_app::PersonalizationAppUI>(map);
1581 RegisterWebUIControllerInterfaceBinder<
1582 ash::personalization_app::mojom::UserProvider,
1583 ash::personalization_app::PersonalizationAppUI>(map);
1585 RegisterWebUIControllerInterfaceBinder<
1586 ash::personalization_app::mojom::KeyboardBacklightProvider,
1587 ash::personalization_app::PersonalizationAppUI>(map);
1589 RegisterWebUIControllerInterfaceBinder<
1590 launcher_internals::mojom::PageHandlerFactory, ash::LauncherInternalsUI>(
1593 RegisterWebUIControllerInterfaceBinder<
1594 ash::bluetooth_config::mojom::CrosBluetoothConfig,
1595 ash::BluetoothPairingDialogUI, ash::settings::OSSettingsUI>(map);
1597 RegisterWebUIControllerInterfaceBinder<
1598 ash::audio_config::mojom::CrosAudioConfig, ash::settings::OSSettingsUI>(
1601 if (ash::features::IsHotspotEnabled()) {
1602 RegisterWebUIControllerInterfaceBinder<
1603 ash::hotspot_config::mojom::CrosHotspotConfig,
1604 ash::settings::OSSettingsUI>(map);
1607 RegisterWebUIControllerInterfaceBinder<audio::mojom::PageHandlerFactory,
1610 RegisterWebUIControllerInterfaceBinder<
1611 ash::firmware_update::mojom::UpdateProvider, ash::FirmwareUpdateAppUI>(
1614 if (ash::features::IsDriveFsMirroringEnabled()) {
1615 RegisterWebUIControllerInterfaceBinder<
1616 ash::manage_mirrorsync::mojom::PageHandlerFactory,
1617 ash::ManageMirrorSyncUI>(map);
1621 Profile::FromBrowserContext(render_frame_host->GetBrowserContext());
1622 if (chromeos::IsEligibleAndEnabledUploadOfficeToCloud(profile)) {
1623 RegisterWebUIControllerInterfaceBinder<
1624 ash::cloud_upload::mojom::PageHandlerFactory,
1625 ash::cloud_upload::CloudUploadUI>(map);
1628 if (chromeos::IsEligibleAndEnabledUploadOfficeToCloud(profile)) {
1629 RegisterWebUIControllerInterfaceBinder<
1630 ash::office_fallback::mojom::PageHandlerFactory,
1631 ash::office_fallback::OfficeFallbackUI>(map);
1632 RegisterWebUIControllerInterfaceBinder<
1633 ash::settings::one_drive::mojom::PageHandlerFactory,
1634 ash::settings::OSSettingsUI>(map);
1637 if (drive::util::IsDriveFsBulkPinningAvailable(profile) ||
1638 base::FeatureList::IsEnabled(
1639 ash::features::kFilesGoogleDriveSettingsPage)) {
1640 RegisterWebUIControllerInterfaceBinder<
1641 ash::settings::google_drive::mojom::PageHandlerFactory,
1642 ash::settings::OSSettingsUI>(map);
1645 if (base::FeatureList::IsEnabled(
1646 chromeos::features::kCrosWebAppInstallDialog)) {
1647 RegisterWebUIControllerInterfaceBinder<
1648 ash::web_app_install::mojom::PageHandlerFactory,
1649 ash::web_app_install::WebAppInstallDialogUI>(map);
1651 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
1653 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
1654 BUILDFLAG(IS_CHROMEOS)
1655 RegisterWebUIControllerInterfaceBinder<discards::mojom::DetailsProvider,
1658 RegisterWebUIControllerInterfaceBinder<discards::mojom::GraphDump,
1661 RegisterWebUIControllerInterfaceBinder<discards::mojom::SiteDataProvider,
1665 #if BUILDFLAG(ENABLE_FEED_V2) && BUILDFLAG(IS_ANDROID)
1666 RegisterWebUIControllerInterfaceBinder<feed_internals::mojom::PageHandler,
1667 FeedInternalsUI>(map);
1670 #if BUILDFLAG(FULL_SAFE_BROWSING)
1671 RegisterWebUIControllerInterfaceBinder<::mojom::ResetPasswordHandler,
1672 ResetPasswordUI>(map);
1675 #if BUILDFLAG(IS_CHROMEOS_ASH)
1676 // Because Nearby Share is only currently supported for the primary profile,
1677 // we should only register binders in that scenario. However, we don't want to
1678 // plumb the profile through to this function, so we 1) ensure that
1679 // NearbyShareDialogUI will not be created for non-primary profiles, and 2)
1680 // rely on the BindInterface implementation of OSSettingsUI to ensure that no
1681 // Nearby Share receivers are bound.
1682 if (base::FeatureList::IsEnabled(features::kNearbySharing)) {
1683 RegisterWebUIControllerInterfaceBinder<
1684 nearby_share::mojom::NearbyShareSettings, ash::settings::OSSettingsUI,
1685 nearby_share::NearbyShareDialogUI>(map);
1686 RegisterWebUIControllerInterfaceBinder<nearby_share::mojom::ContactManager,
1687 ash::settings::OSSettingsUI,
1688 nearby_share::NearbyShareDialogUI>(
1690 RegisterWebUIControllerInterfaceBinder<
1691 nearby_share::mojom::DiscoveryManager,
1692 nearby_share::NearbyShareDialogUI>(map);
1693 RegisterWebUIControllerInterfaceBinder<nearby_share::mojom::ReceiveManager,
1694 ash::settings::OSSettingsUI>(map);
1696 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
1698 #if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
1699 RegisterWebUIControllerInterfaceBinder<::app_home::mojom::PageHandlerFactory,
1700 webapps::AppHomeUI>(map);
1701 #endif // !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
1703 #if !BUILDFLAG(IS_ANDROID)
1704 RegisterWebUIControllerInterfaceBinder<::mojom::WebAppInternalsHandler,
1705 WebAppInternalsUI>(map);
1708 #if BUILDFLAG(IS_CHROMEOS_ASH)
1709 // This MOJO API is currently only used by chrome://emoji-picker. Please check
1710 // the allow-list logic in BindNewWindowProxy if you plan to use it in another
1712 map->Add<new_window_proxy::mojom::NewWindowProxy>(
1713 base::BindRepeating(&BindNewWindowProxy));
1714 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
1716 RegisterWebUIControllerInterfaceBinder<::mojom::LocationInternalsHandler,
1717 LocationInternalsUI>(map);
1719 #if !BUILDFLAG(IS_ANDROID)
1720 if (base::FeatureList::IsEnabled(
1721 on_device_model::features::kOnDeviceModelService)) {
1722 RegisterWebUIControllerInterfaceBinder<::mojom::OnDeviceInternalsPage,
1723 OnDeviceInternalsUI>(map);
1727 #if BUILDFLAG(ENABLE_COMPOSE)
1728 if (base::FeatureList::IsEnabled(compose::features::kEnableCompose)) {
1729 RegisterWebUIControllerInterfaceBinder<
1730 compose::mojom::ComposeDialogPageHandlerFactory, ComposeUI>(map);
1732 #endif // BUILDFLAG(ENABLE_COMPOSE)
1735 void PopulateChromeWebUIFrameInterfaceBrokers(
1736 content::WebUIBrowserInterfaceBrokerRegistry& registry) {
1737 // This function is broken up into sections based on WebUI types.
1739 // --- Section 1: chrome:// WebUIs:
1741 #if BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD)
1742 registry.ForWebUI<ash::SampleSystemWebAppUI>()
1743 .Add<ash::mojom::sample_swa::PageHandlerFactory>()
1744 .Add<color_change_listener::mojom::PageHandler>();
1746 registry.ForWebUI<ash::StatusAreaInternalsUI>()
1747 .Add<ash::mojom::status_area_internals::PageHandler>();
1748 #endif // BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD)
1750 #if BUILDFLAG(IS_CHROMEOS_ASH)
1751 if (base::FeatureList::IsEnabled(ash::features::kSystemExtensions)) {
1752 registry.ForWebUI<ash::SystemExtensionsInternalsUI>()
1753 .Add<ash::mojom::system_extensions_internals::PageHandler>();
1755 if (base::FeatureList::IsEnabled(ash::features::kFaceMLApp)) {
1756 registry.ForWebUI<ash::FaceMLAppUI>()
1757 .Add<ash::mojom::face_ml_app::PageHandlerFactory>();
1759 registry.ForWebUI<ash::CameraAppUI>()
1760 .Add<color_change_listener::mojom::PageHandler>()
1761 .Add<cros::mojom::CameraAppDeviceProvider>()
1762 .Add<ash::camera_app::mojom::CameraAppHelper>();
1763 registry.ForWebUI<ash::ColorInternalsUI>()
1764 .Add<color_change_listener::mojom::PageHandler>()
1765 .Add<ash::color_internals::mojom::WallpaperColorsHandler>();
1766 registry.ForWebUI<ash::FilesInternalsUI>()
1767 .Add<ash::mojom::files_internals::PageHandler>();
1768 registry.ForWebUI<ash::file_manager::FileManagerUI>()
1769 .Add<color_change_listener::mojom::PageHandler>();
1770 registry.ForWebUI<ash::smb_dialog::SmbShareDialogUI>()
1771 .Add<color_change_listener::mojom::PageHandler>();
1772 registry.ForWebUI<ash::smb_dialog::SmbCredentialsDialogUI>()
1773 .Add<color_change_listener::mojom::PageHandler>();
1774 registry.ForWebUI<FeedbackUI>()
1775 .Add<color_change_listener::mojom::PageHandler>();
1776 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
1778 // --- Section 2: chrome-untrusted:// WebUIs:
1780 #if BUILDFLAG(IS_CHROMEOS_ASH)
1781 if (chromeos::features::IsOrcaEnabled()) {
1782 registry.ForWebUI<ash::MakoUntrustedUI>()
1783 .Add<ash::orca::mojom::EditorClient>();
1786 registry.ForWebUI<ash::DemoModeAppUntrustedUI>()
1787 .Add<ash::mojom::demo_mode::UntrustedPageHandlerFactory>();
1789 registry.ForWebUI<ash::UntrustedProjectorAnnotatorUI>()
1790 .Add<ash::annotator::mojom::UntrustedAnnotatorPageHandlerFactory>();
1792 registry.ForWebUI<ash::UntrustedProjectorUI>()
1793 .Add<ash::projector::mojom::UntrustedProjectorPageHandlerFactory>();
1795 registry.ForWebUI<ash::feedback::OsFeedbackUntrustedUI>()
1796 .Add<color_change_listener::mojom::PageHandler>();
1798 registry.ForWebUI<ash::MediaAppGuestUI>()
1799 .Add<color_change_listener::mojom::PageHandler>()
1800 .Add<ash::media_app_ui::mojom::UntrustedPageHandlerFactory>();
1802 registry.ForWebUI<ash::HelpAppUntrustedUI>()
1803 .Add<color_change_listener::mojom::PageHandler>();
1804 #endif // BUILDFLAG(IS_CHROMEOS_ASH)
1806 #if BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD)
1807 registry.ForWebUI<ash::SampleSystemWebAppUntrustedUI>()
1808 .Add<ash::mojom::sample_swa::UntrustedPageInterfacesFactory>();
1809 #endif // BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD)
1811 #if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(ENABLE_FEED_V2)
1812 registry.ForWebUI<feed::FeedUI>()
1813 .Add<feed::mojom::FeedSidePanelHandlerFactory>();
1814 #endif // !BUILDFLAG(IS_ANDROID)
1815 #if !BUILDFLAG(IS_ANDROID)
1816 if (companion::IsCompanionFeatureEnabled()) {
1817 registry.ForWebUI<CompanionSidePanelUntrustedUI>()
1818 .Add<side_panel::mojom::CompanionPageHandlerFactory>();
1820 if (features::IsReadAnythingEnabled() &&
1821 features::IsReadAnythingWebUIToolbarEnabled()) {
1822 registry.ForWebUI<ReadAnythingUntrustedUI>()
1823 .Add<color_change_listener::mojom::PageHandler>();
1825 if (base::FeatureList::IsEnabled(features::kHaTSWebUI)) {
1826 registry.ForWebUI<HatsUI>().Add<hats::mojom::PageHandlerFactory>();
1828 #endif // !BUILDFLAG(IS_ANDROID)
1831 } // namespace internal
1832 } // namespace chrome