1# Copyright 2018 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//mojo/public/tools/bindings/mojom.gni")
6import("//third_party/blink/public/public_features.gni")
7
8if (is_android) {
9  import("//build/config/android/config.gni")
10}
11
12# This target includes all mojom interfaces which can be used from
13# renderer/platform. In particular these mojom interfaces can't use types that
14# are typemapped to a type in renderer/core.
15mojom("mojom_platform") {
16  generate_java = true
17  sources = [
18    "ad_tagging/ad_frame.mojom",
19    "agents/agent_metrics.mojom",
20    "app_banner/app_banner.mojom",
21    "appcache/appcache.mojom",
22    "appcache/appcache_info.mojom",
23    "array_buffer/array_buffer_contents.mojom",
24    "associated_interfaces/associated_interfaces.mojom",
25    "autoplay/autoplay.mojom",
26    "background_fetch/background_fetch.mojom",
27    "background_sync/background_sync.mojom",
28    "badging/badging.mojom",
29    "browser_interface_broker.mojom",
30    "cache_storage/cache_storage.mojom",
31    "choosers/color_chooser.mojom",
32    "choosers/date_time_chooser.mojom",
33    "choosers/file_chooser.mojom",
34    "clipboard/clipboard.mojom",
35    "clipboard/raw_clipboard.mojom",
36    "commit_result/commit_result.mojom",
37    "contacts/contacts_manager.mojom",
38    "content_index/content_index.mojom",
39    "conversions/conversions.mojom",
40    "cookie_store/cookie_store.mojom",
41    "crash/crash_memory_metrics_reporter.mojom",
42    "credentialmanager/credential_manager.mojom",
43    "devtools/console_message.mojom",
44    "devtools/devtools_agent.mojom",
45    "devtools/devtools_frontend.mojom",
46    "devtools/inspector_issue.mojom",
47    "favicon/favicon_url.mojom",
48    "feature_observer/feature_observer.mojom",
49    "feature_policy/document_policy_feature.mojom",
50    "feature_policy/feature_policy.mojom",
51    "feature_policy/feature_policy_feature.mojom",
52    "feature_policy/policy_disposition.mojom",
53    "feature_policy/policy_value.mojom",
54    "fetch/fetch_api_request.mojom",
55    "fetch/fetch_api_response.mojom",
56    "file/file_utilities.mojom",
57    "filesystem/file_system.mojom",
58    "frame/blocked_navigation_types.mojom",
59    "frame/frame.mojom",
60    "frame/frame_owner_properties.mojom",
61    "frame/frame_policy.mojom",
62    "frame/fullscreen.mojom",
63    "frame/intrinsic_sizing_info.mojom",
64    "frame/lifecycle.mojom",
65    "frame/media_player_action.mojom",
66    "frame/navigation_initiator.mojom",
67    "frame/sudden_termination_disabler_type.mojom",
68    "frame/user_activation_update_types.mojom",
69    "geolocation/geolocation_service.mojom",
70    "hid/hid.mojom",
71    "hyphenation/hyphenation.mojom",
72    "idle/idle_manager.mojom",
73    "image_downloader/image_downloader.mojom",
74    "input/focus_type.mojom",
75    "input/pointer_lock_result.mojom",
76    "input/scroll_direction.mojom",
77    "insecure_input/insecure_input_service.mojom",
78    "keyboard_lock/keyboard_lock.mojom",
79    "leak_detector/leak_detector.mojom",
80    "loader/code_cache.mojom",
81    "loader/fetch_client_settings_object.mojom",
82    "loader/navigation_predictor.mojom",
83    "loader/pause_subresource_loading_handle.mojom",
84    "loader/previews_resource_loading_hints.mojom",
85    "loader/request_context_frame_type.mojom",
86    "loader/resource_load_info.mojom",
87    "loader/url_loader_factory_bundle.mojom",
88    "locks/lock_manager.mojom",
89    "manifest/display_mode.mojom",
90    "manifest/manifest.mojom",
91    "manifest/manifest_manager.mojom",
92    "manifest/manifest_observer.mojom",
93    "mediastream/aec_dump.mojom",
94    "mediastream/media_devices.mojom",
95    "mediastream/media_stream.mojom",
96    "mime/mime_registry.mojom",
97    "native_file_system/native_file_system_directory_handle.mojom",
98    "native_file_system/native_file_system_error.mojom",
99    "native_file_system/native_file_system_file_handle.mojom",
100    "native_file_system/native_file_system_file_writer.mojom",
101    "native_file_system/native_file_system_manager.mojom",
102    "native_file_system/native_file_system_transfer_token.mojom",
103    "native_io/native_io.mojom",
104    "notifications/notification.mojom",
105    "notifications/notification_service.mojom",
106    "oom_intervention/oom_intervention.mojom",
107    "page/display_cutout.mojom",
108    "page/page.mojom",
109    "page/spatial_navigation.mojom",
110    "page/widget.mojom",
111    "payments/payment_app.mojom",
112    "peerconnection/peer_connection_tracker.mojom",
113    "permissions/permission.mojom",
114    "permissions/permission_automation.mojom",
115    "permissions/permission_status.mojom",
116    "picture_in_picture/picture_in_picture.mojom",
117    "plugins/plugin_registry.mojom",
118    "prerender/prerender.mojom",
119    "presentation/presentation.mojom",
120    "push_messaging/push_messaging.mojom",
121    "push_messaging/push_messaging_status.mojom",
122    "quota/quota_manager_host.mojom",
123    "quota/quota_types.mojom",
124    "referrer.mojom",
125    "renderer_preference_watcher.mojom",
126    "renderer_preferences.mojom",
127    "reporting/reporting.mojom",
128    "screen_enumeration/screen_enumeration.mojom",
129    "script/script_type.mojom",
130    "scroll/scroll_enums.mojom",
131    "scroll/scroll_into_view_params.mojom",
132    "scroll/scrollbar_mode.mojom",
133    "security_context/insecure_request_policy.mojom",
134    "selection_menu/selection_menu_behavior.mojom",
135    "service_worker/controller_service_worker_mode.mojom",
136    "service_worker/dispatch_fetch_event_params.mojom",
137    "service_worker/navigation_preload_state.mojom",
138    "service_worker/service_worker_client.mojom",
139    "service_worker/service_worker_container_type.mojom",
140    "service_worker/service_worker_database.mojom",
141    "service_worker/service_worker_error_type.mojom",
142    "service_worker/service_worker_event_status.mojom",
143    "service_worker/service_worker_fetch_response_callback.mojom",
144    "service_worker/service_worker_installed_scripts_manager.mojom",
145    "service_worker/service_worker_registration_options.mojom",
146    "service_worker/service_worker_state.mojom",
147    "service_worker/service_worker_stream_handle.mojom",
148    "site_engagement/site_engagement.mojom",
149    "sms/sms_receiver.mojom",
150    "speech/speech_recognition_error.mojom",
151    "speech/speech_recognition_error_code.mojom",
152    "speech/speech_recognition_grammar.mojom",
153    "speech/speech_recognition_result.mojom",
154    "speech/speech_recognizer.mojom",
155    "speech/speech_synthesis.mojom",
156    "timing/performance_mark_or_measure.mojom",
157    "timing/resource_timing.mojom",
158    "timing/worker_timing_container.mojom",
159    "ukm/ukm.mojom",
160    "user_agent/user_agent_metadata.mojom",
161    "v8_cache_options.mojom",
162    "wake_lock/wake_lock.mojom",
163    "web_launch/file_handling_expiry.mojom",
164    "web_launch/web_launch.mojom",
165    "webaudio/audio_context_manager.mojom",
166    "webdatabase/web_database.mojom",
167    "websockets/websocket_connector.mojom",
168    "webtransport/quic_transport_connector.mojom",
169    "window_features/window_features.mojom",
170    "worker/dedicated_worker_host.mojom",
171    "worker/shared_worker.mojom",
172    "worker/shared_worker_client.mojom",
173    "worker/shared_worker_connector.mojom",
174    "worker/shared_worker_creation_context_type.mojom",
175    "worker/shared_worker_host.mojom",
176    "worker/shared_worker_info.mojom",
177    "worker/subresource_loader_updater.mojom",
178    "worker/worker_content_settings_proxy.mojom",
179    "worker/worker_main_script_load_params.mojom",
180    "worker/worker_options.mojom",
181  ]
182
183  if (!is_android) {
184    sources += [ "serial/serial.mojom" ]
185  }
186
187  if (is_win) {
188    sources += [ "dwrite_font_proxy/dwrite_font_proxy.mojom" ]
189  }
190
191  public_deps = [
192    ":android_mojo_bindings",
193    ":authenticator_test_mojo_bindings",
194    ":mojom_mhtml_load_result",
195    ":web_client_hints_types_mojo_bindings",
196    ":web_feature_mojo_bindings",
197    "//cc/mojom",
198    "//components/payments/mojom",
199    "//components/schema_org/common:mojom",
200    "//components/services/filesystem/public/mojom",
201    "//mojo/public/mojom/base",
202    "//services/data_decoder/public/mojom:mojom_resource_snapshot_for_web_bundle",
203    "//services/device/public/mojom",
204    "//services/network/public/mojom",
205    "//services/network/public/mojom:data_pipe_interfaces",
206    "//services/network/public/mojom:mojom_ip_address",
207    "//services/network/public/mojom:websocket_mojom",
208    "//services/service_manager/public/mojom",
209    "//services/viz/public/mojom",
210    "//skia/public/mojom",
211    "//third_party/blink/public/mojom/dom_storage",
212    "//third_party/blink/public/mojom/frame",
213    "//third_party/blink/public/mojom/usb",
214    "//ui/base/ime/mojom",
215    "//ui/display/mojom",
216    "//ui/events/mojom",
217    "//ui/gfx/geometry/mojom",
218    "//ui/gfx/mojom",
219    "//url/mojom:url_mojom_gurl",
220    "//url/mojom:url_mojom_origin",
221  ]
222
223  # iOS doesn't use and must not depend on //media
224  if (!is_ios) {
225    public_deps += [
226      "//media/capture/mojom:video_capture",
227      "//media/mojo/mojom",
228    ]
229  }
230
231  if (is_linux || is_chromeos) {
232    enabled_features = [ "renderer_pref_system_font_family_name" ]
233  }
234
235  export_class_attribute = "BLINK_COMMON_EXPORT"
236  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
237  export_header = "third_party/blink/public/common/common_export.h"
238
239  export_class_attribute_blink = "PLATFORM_EXPORT"
240  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
241  export_header_blink = "third_party/blink/renderer/platform/platform_export.h"
242
243  # Don't scramble message IDs so they are redistributable to external tests.
244  scramble_message_ids = false
245}
246
247# Kept separate from "mojom_platform" because the Java bindings are
248# needed by Android's implementation (in chrome/android or in android_webview)
249# for following mojom files.
250mojom("android_mojo_bindings") {
251  generate_java = true
252  sources = [
253    "blob/blob.mojom",
254    "blob/blob_registry.mojom",
255    "blob/blob_url_store.mojom",
256    "blob/data_element.mojom",
257    "blob/serialized_blob.mojom",
258    "document_metadata/document_metadata.mojom",
259    "font_unique_name_lookup/font_unique_name_lookup.mojom",
260    "input/input_host.mojom",
261    "input/input_messages.mojom",
262    "installation/installation.mojom",
263    "installedapp/installed_app_provider.mojom",
264    "installedapp/related_application.mojom",
265    "mediasession/media_session.mojom",
266    "payments/payment_handler_host.mojom",
267    "payments/payment_request.mojom",
268    "webauthn/authenticator.mojom",
269    "webshare/webshare.mojom",
270  ]
271
272  if (is_android) {
273    sources += [ "remote_objects/remote_objects.mojom" ]
274  }
275  public_deps = [
276    "//components/payments/mojom",
277    "//components/schema_org/common:mojom",
278    "//mojo/public/mojom/base",
279    "//services/media_session/public/mojom",
280    "//services/network/public/mojom",
281    "//url/mojom:url_mojom_gurl",
282    "//url/mojom:url_mojom_origin",
283  ]
284
285  # This Android unhandled-tap feature uses another mojo source, add it in.
286  if (enable_unhandled_tap) {
287    sources += [ "unhandled_tap_notifier/unhandled_tap_notifier.mojom" ]
288    public_deps += [ "//ui/gfx/geometry/mojom" ]
289  }
290
291  export_class_attribute = "BLINK_COMMON_EXPORT"
292  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
293  export_header = "third_party/blink/public/common/common_export.h"
294
295  export_class_attribute_blink = "PLATFORM_EXPORT"
296  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
297  export_header_blink = "third_party/blink/renderer/platform/platform_export.h"
298
299  # Don't scramble message IDs so they are redistributable to external tests.
300  scramble_message_ids = false
301}
302
303# This target can include mojom interfaces which do use types that are
304# typemapped to a type in renderer/core. This also means these interfaces are
305# not available from renderer/platform.
306#
307# In future we may have a separate mojom target for the things that may have
308# modules dependencies if it looks necessary, at that time we can put all of
309# those high-level service worker mojom files there.
310mojom("mojom_core") {
311  generate_java = true
312  sources = [
313    "messaging/cloneable_message.mojom",
314    "messaging/message_port_descriptor.mojom",
315    "messaging/transferable_message.mojom",
316    "messaging/user_activation_snapshot.mojom",
317    "portal/portal.mojom",
318
319    # Note that service_worker_object.mojom and service_worker.mojom depend on
320    # transferable_message.mojom, and controller_service_worker.mojom and
321    # service_worker_registration.mojom depend on service_worker_object.mojom,
322    # so we put these service worker mojom files here rather than mojom_platform
323    # target.
324    "service_worker/controller_service_worker.mojom",
325    "service_worker/embedded_worker.mojom",
326    "service_worker/service_worker.mojom",
327    "service_worker/service_worker_container.mojom",
328    "service_worker/service_worker_object.mojom",
329    "service_worker/service_worker_provider.mojom",
330    "service_worker/service_worker_registration.mojom",
331
332    # Depends on controller_service_worker.mojom.
333    "worker/dedicated_worker_host_factory.mojom",
334    "worker/shared_worker_factory.mojom",
335  ]
336
337  public_deps = [
338    ":android_mojo_bindings",
339    ":mojom_platform",
340    ":web_feature_mojo_bindings",
341    "//components/payments/mojom",
342    "//mojo/public/mojom/base",
343    "//services/network/public/mojom",
344    "//services/service_manager/public/mojom",
345    "//skia/public/mojom",
346    "//url/mojom:url_mojom_gurl",
347    "//url/mojom:url_mojom_origin",
348  ]
349
350  overridden_deps_blink = [
351    ":android_mojo_bindings",
352    ":mojom_platform",
353    "//services/network/public/mojom",
354  ]
355  component_deps_blink = [ "//third_party/blink/renderer/platform" ]
356
357  export_class_attribute = "BLINK_COMMON_EXPORT"
358  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
359  export_header = "third_party/blink/public/common/common_export.h"
360
361  export_class_attribute_blink = "CORE_EXPORT"
362  export_define_blink = "BLINK_CORE_IMPLEMENTATION=1"
363  export_header_blink = "third_party/blink/renderer/core/core_export.h"
364}
365
366# This target can include mojom interfaces which use types that are typemapped
367# to a type in renderer/modules. This also means these interfaces are not
368# available from renderer/platform or renderer/core.
369mojom("mojom_modules") {
370  sources = [ "indexeddb/indexeddb.mojom" ]
371
372  public_deps = [
373    ":android_mojo_bindings",
374    ":mojom_core",
375    "//mojo/public/mojom/base",
376  ]
377
378  overridden_deps_blink = [
379    ":android_mojo_bindings",
380    ":mojom_core",
381  ]
382  component_deps_blink = [ "//third_party/blink/renderer/core" ]
383
384  export_class_attribute = "BLINK_COMMON_EXPORT"
385  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
386  export_header = "third_party/blink/public/common/common_export.h"
387
388  export_class_attribute_blink = "MODULES_EXPORT"
389  export_define_blink = "BLINK_MODULES_IMPLEMENTATION=1"
390  export_header_blink = "third_party/blink/renderer/modules/modules_export.h"
391}
392
393mojom("web_bluetooth_mojo_bindings") {
394  visibility = [
395    "//third_party/blink/common",
396    "//third_party/blink/public/common:common",
397    "//third_party/blink/public/common:headers",
398  ]
399
400  visibility_blink = [
401    "//third_party/blink/common",
402    "//third_party/blink/public/common:common",
403    "//third_party/blink/public/common:headers",
404    "//third_party/blink/renderer/platform:blink_platform_public_deps",
405  ]
406
407  sources = [ "bluetooth/web_bluetooth.mojom" ]
408
409  public_deps = [ "//device/bluetooth/public/mojom" ]
410
411  # The chromium variant must be linked with content and use the same export
412  # settings in component build because of the WebBluetoothDeviceId typemap
413  # inside content.
414  export_class_attribute = "BLINK_COMMON_EXPORT"
415  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
416  export_header = "third_party/blink/public/common/common_export.h"
417
418  # Similarly, the blink variant must be linked with the platform component
419  # since it uses types from it in its typemaps.
420  export_class_attribute_blink = "BLINK_PLATFORM_EXPORT"
421  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
422  export_header_blink = "third_party/blink/public/platform/web_common.h"
423}
424
425# The mojom_broadcastchannel_bindings is separated from the rest of mojom files
426# to allow blink/renderer/core to depend on this.
427mojom("mojom_broadcastchannel_bindings") {
428  visibility = [ "//content/*" ]
429  visibility_blink = [ "//third_party/blink/renderer/core/*" ]
430  sources = [ "broadcastchannel/broadcast_channel.mojom" ]
431  public_deps = [
432    ":mojom_core",
433    "//url/mojom:url_mojom_origin",
434  ]
435
436  overridden_deps = [ ":mojom_core" ]
437  component_deps = [ "//third_party/blink/public/common" ]
438
439  component_output_prefix = "blink_mojom_broadcastchannel_bindings"
440
441  # See comment above.
442  export_class_attribute = "CONTENT_EXPORT"
443  export_define = "CONTENT_IMPLEMENTATION=1"
444  export_header = "content/common/content_export.h"
445
446  # Similarly, the blink variant must be linked with the core component
447  # since it uses types from it in its typemaps.
448  export_class_attribute_blink = "CORE_EXPORT"
449  export_define_blink = "BLINK_CORE_IMPLEMENTATION=1"
450  export_header_blink = "third_party/blink/renderer/core/core_export.h"
451}
452
453mojom("mojom_mhtml_load_result") {
454  generate_java = true
455  sources = [ "loader/mhtml_load_result.mojom" ]
456
457  export_class_attribute = "BLINK_COMMON_EXPORT"
458  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
459  export_header = "third_party/blink/public/common/common_export.h"
460}
461
462# The web_feature_mojo_bindings is separated from the rest of the mojom files
463# because the chromium typemap for blink mojo_bindings has private content
464# dependencies.
465mojom_component("web_feature_mojo_bindings") {
466  generate_java = true
467  sources = [
468    "use_counter/css_property_id.mojom",
469    "web_feature/web_feature.mojom",
470  ]
471
472  macro_prefix = "WEB_FEATURE_MOJO_BINDINGS_MOJOM"
473  output_prefix = "web_feature_mojo_bindings_mojom"
474}
475
476# The web_client_hints_types_mojo_bindings is separated from the rest of the
477# mojom files because the chromium typemap for blink mojo_bindings has private
478# content dependencies.
479mojom("web_client_hints_types_mojo_bindings") {
480  generate_java = true
481  sources = [ "web_client_hints/web_client_hints_types.mojom" ]
482}
483
484# The embedded_frame_sink_mojo_bindings is separated from the rest of mojom
485# files because its deps contain too many files in Chromium that would pollute
486# the include paths in generated mojom-blink files for other services.
487mojom("embedded_frame_sink_mojo_bindings") {
488  visibility = [ "//content/*" ]
489  visibility_blink = [ "//third_party/blink/renderer/platform" ]
490  sources = [ "frame_sinks/embedded_frame_sink.mojom" ]
491  deps = [ "//services/viz/public/mojom" ]
492
493  component_output_prefix = "blink_embedded_frame_sink_mojo_bindings"
494
495  # The chromium variant must be linked with content and use the same export
496  # settings in component build.
497  export_class_attribute = "CONTENT_EXPORT"
498  export_define = "CONTENT_IMPLEMENTATION=1"
499  export_header = "content/common/content_export.h"
500  export_class_attribute_blink = "BLINK_PLATFORM_EXPORT"
501  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
502  export_header_blink = "third_party/blink/public/platform/web_common.h"
503}
504
505# This is a separate target because it needs unscrambled message IDs.
506mojom("authenticator_test_mojo_bindings") {
507  generate_java = true
508  sources = [ "webauthn/virtual_authenticator.mojom" ]
509
510  public_deps = [
511    ":android_mojo_bindings",
512    "//url/mojom:url_mojom_gurl",
513  ]
514
515  export_class_attribute = "BLINK_COMMON_EXPORT"
516  export_define = "BLINK_COMMON_IMPLEMENTATION=1"
517  export_header = "third_party/blink/public/common/common_export.h"
518
519  export_class_attribute_blink = "PLATFORM_EXPORT"
520  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
521  export_header_blink = "third_party/blink/renderer/platform/platform_export.h"
522
523  # Don't scramble message IDs so they are redistributable to external tests.
524  scramble_message_ids = false
525}
526
527mojom("memory_usage_monitor_linux_mojo_bindings") {
528  visibility = [
529    "//content/browser:browser",
530    "//third_party/blink/renderer/controller:controller",
531  ]
532  visibility_blink = [ "//third_party/blink/renderer/controller:controller" ]
533
534  sources = [ "memory_usage_monitor_linux.mojom" ]
535
536  public_deps = [ "//mojo/public/mojom/base" ]
537
538  export_class_attribute_blink = "PLATFORM_EXPORT"
539  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
540  export_header_blink = "third_party/blink/renderer/platform/platform_export.h"
541}
542