1# Copyright 2014 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("//build/buildflag_header.gni")
6import("//build/config/chromecast_build.gni")
7import("//build/config/features.gni")
8import("//build/config/jumbo.gni")
9import("//build/config/ui.gni")
10import("//media/media_options.gni")
11import("//mojo/public/tools/bindings/mojom.gni")
12import("//ppapi/buildflags/buildflags.gni")
13import("//third_party/webrtc/webrtc.gni")
14
15# See //content/BUILD.gn for how this works.
16group("common") {
17  if (is_component_build) {
18    public_deps = [ "//content" ]
19  } else {
20    public_deps = [ ":common_sources" ]
21  }
22}
23
24# This target allows other targets to depend on result_codes.h which is a
25# header-only dependency, without bringing in all of content.
26source_set("result_codes") {
27  sources = [ "result_codes.h" ]
28
29  deps = [ "//services/service_manager/embedder:embedder_result_codes" ]
30}
31
32# This target allows other targets to depend on content_descriptors.h which is
33# a header-only dependency, without bringing in all of content.
34source_set("content_descriptors") {
35  sources = [ "content_descriptors.h" ]
36
37  # The header uses V8_USE_EXTERNAL_STARTUP_DATA.
38  public_configs = [ "//v8:external_startup_data" ]
39
40  deps = [ "//ipc" ]
41}
42
43source_set("content_descriptor_keys") {
44  sources = [
45    "content_descriptor_keys.cc",
46    "content_descriptor_keys.h",
47  ]
48}
49
50# Forces static linking for targets using the static_switches constants, even
51# in the component build. This config makes it impossible to use the static
52# switches target and use the rest of content at the same time, because the
53# component export flags won't be consistent.
54config("static_switches_defines") {
55  defines = [ "COMPILE_CONTENT_STATICALLY" ]
56}
57
58# This target allows you to use the content_switches constants and statically
59# link to it, without depending on the rest of content. This is only for use
60# without content, or you will get multiply defined symbols.
61source_set("static_switches") {
62  public = [ "content_switches.h" ]
63  sources = [
64    "//content/common/content_export.h",
65    "content_switches.cc",
66  ]
67
68  public_configs = [ ":static_switches_defines" ]
69
70  # Deps required by the above headers.
71  deps = [ "//media:media_buildflags" ]
72}
73
74# This target allows you to use the content_features constants and statically
75# link to it, without depending on the rest of content. This is only for use
76# without content, or you will get multiply defined symbols.
77source_set("static_features") {
78  public = [ "content_features.h" ]
79  sources = [
80    "//content/common/content_export.h",
81    "content_features.cc",
82  ]
83  public_deps = [ "//base" ]
84
85  public_configs = [ ":static_switches_defines" ]
86
87  if (is_chromeos) {
88    public_deps += [ "//media/capture/video/chromeos/public" ]
89  }
90}
91
92jumbo_source_set("common_sources") {
93  # External code should depend on via ":common" above.
94  visibility = [ "//content/*" ]
95
96  sources = [
97    "bindings_policy.h",
98    "browser_controls_state.h",
99    "cdm_info.h",
100    "child_process_host.h",
101    "child_process_host_delegate.h",
102    "common_param_traits.cc",
103    "common_param_traits.h",
104    "common_param_traits_macros.h",
105    "common_sandbox_support_linux.h",
106    "console_message_level.h",
107    "content_client.cc",
108    "content_client.h",
109    "content_constants.cc",
110    "content_constants.h",
111    "content_descriptors.h",
112    "content_features.cc",
113    "content_features.h",
114    "content_ipc_logging.h",
115    "content_paths.h",
116    "content_switch_dependent_feature_overrides.cc",
117    "content_switch_dependent_feature_overrides.h",
118    "content_switches.cc",
119    "content_switches.h",
120    "drop_data.cc",
121    "drop_data.h",
122    "font_cache_dispatcher_win.h",
123    "frame_navigate_params.cc",
124    "frame_navigate_params.h",
125    "injection_test_mac.h",
126    "injection_test_win.h",
127    "input_event_ack_source.h",
128    "input_event_ack_state.h",
129    "isolated_world_ids.h",
130    "javascript_dialog_type.h",
131    "main_function_params.h",
132    "menu_item.cc",
133    "menu_item.h",
134    "mhtml_generation_params.cc",
135    "mhtml_generation_params.h",
136    "navigation_policy.cc",
137    "navigation_policy.h",
138    "network_service_util.cc",
139    "network_service_util.h",
140    "origin_util.h",
141    "page_state.cc",
142    "page_state.h",
143    "page_type.h",
144    "page_visibility_state.h",
145    "page_zoom.h",
146    "pepper_plugin_info.cc",
147    "pepper_plugin_info.h",
148    "persistent_notification_status.h",
149    "previews_state.cc",
150    "previews_state.h",
151    "process_type.h",
152    "profiling.cc",
153    "profiling.h",
154    "referrer.cc",
155    "referrer.h",
156    "referrer_type_converters.cc",
157    "referrer_type_converters.h",
158    "resource_intercept_policy.h",
159    "resource_request_body_android.cc",
160    "resource_request_body_android.h",
161    "resource_usage_reporter_type_converters.cc",
162    "resource_usage_reporter_type_converters.h",
163    "result_codes.h",
164    "sandbox_init.h",
165    "sandboxed_process_launcher_delegate.cc",
166    "sandboxed_process_launcher_delegate.h",
167    "screen_info.cc",
168    "screen_info.h",
169    "screen_orientation_values.h",
170    "service_manager_connection.h",
171    "socket_permission_request.h",
172    "stop_find_action.h",
173    "storage_quota_params.h",
174    "three_d_api_types.h",
175    "untrustworthy_context_menu_params.cc",
176    "untrustworthy_context_menu_params.h",
177    "url_constants.cc",
178    "url_constants.h",
179    "url_utils.cc",
180    "url_utils.h",
181    "use_zoom_for_dsf_policy.cc",
182    "use_zoom_for_dsf_policy.h",
183    "user_agent.h",
184    "web_preferences.cc",
185    "web_preferences.h",
186    "webplugininfo.cc",
187    "webplugininfo.h",
188    "webplugininfo_param_traits.h",
189    "widget_type.h",
190  ]
191
192  configs += [
193    "//build/config:precompiled_headers",
194    "//content:content_implementation",
195  ]
196
197  public_configs = [ "//v8:external_startup_data" ]
198
199  public_deps = [
200    ":interfaces",
201    ":renderer_type",
202    ":service_names",
203    "//content/common",
204    "//ipc",
205    "//media/capture:capture_base",
206    "//mojo/public/cpp/bindings",
207    "//net",
208    "//services/network:network_service",
209    "//services/network/public/mojom",
210    "//services/service_manager/public/cpp",
211    "//services/service_manager/public/mojom",
212    "//third_party/blink/public:blink_headers",
213    "//third_party/blink/public/mojom:mojom_platform_headers",
214    "//ui/accessibility",
215    "//ui/base/mojom:cursor_type",
216    "//ui/gfx/geometry",
217    "//ui/surface",
218    "//url/ipc:url_ipc",
219  ]
220  deps = [
221    ":content_descriptor_keys",
222    "//build:branding_buildflags",
223
224    # This looks needless as we have //content/common in public_deps, but it's
225    # needed because of allow_circular_includes_from.
226    "//content/common:mojo_bindings",
227    "//media",
228    "//media/mojo/mojom",
229    "//ppapi/buildflags",
230    "//ppapi/c",
231    "//services/network/public/cpp",
232    "//services/service_manager/embedder:embedder_result_codes",
233    "//services/service_manager/public/cpp",
234    "//services/service_manager/zygote:zygote_buildflags",
235    "//skia",
236    "//storage/common",
237    "//third_party/blink/public/common",
238    "//third_party/icu",
239    "//ui/accessibility",
240    "//ui/base",
241    "//ui/base/cursor",
242    "//ui/gfx",
243    "//ui/gfx/ipc",
244    "//ui/gfx/ipc/color",
245    "//ui/gfx/ipc/geometry",
246    "//ui/gfx/ipc/skia",
247  ]
248
249  if (use_aura) {
250    deps += [ "//ui/aura" ]
251  }
252
253  if (is_android) {
254    deps += [ "//content/public/android:jni" ]
255  }
256
257  if (is_linux && !is_bsd) {
258    deps += [ "//services/service_manager/zygote" ]
259  }
260
261  if (is_chromeos) {
262    public_deps += [ "//media/capture/video/chromeos/public" ]
263  }
264
265  if (rtc_use_pipewire) {
266    configs +=
267        [ "//third_party/webrtc/modules/desktop_capture:pipewire_config" ]
268  }
269
270  # //content/common needs to include public headers.
271  allow_circular_includes_from = [
272    ":interfaces",
273    "//content/common",
274    "//content/common:mojo_bindings",
275  ]
276
277  if (!enable_plugins) {
278    sources -= [
279      "pepper_plugin_info.cc",
280      "pepper_plugin_info.h",
281    ]
282  }
283}
284
285mojom("interfaces") {
286  # We don't want Blink variants of these bindings to be generated.
287  disable_variants = true
288
289  # Must depend on //content/public/common/ instead, for component build.
290  visibility = [
291    ":common_sources",
292    "//content/common/*",
293    "//chrome/common:mojo_bindings",
294    "//chrome/common:mojo_bindings_blink",
295    "//extensions/common:mojom",
296    "//extensions/common:mojom_blink",
297  ]
298
299  sources = [
300    "browser_controls_state.mojom",
301    "drop_data.mojom",
302    "fullscreen_video_element.mojom",
303    "resource_usage_reporter.mojom",
304    "transferrable_url_loader.mojom",
305    "was_activated_option.mojom",
306    "webplugininfo.mojom",
307    "window_container_type.mojom",
308  ]
309
310  if (is_win) {
311    sources += [ "font_cache_win.mojom" ]
312  }
313
314  public_deps = [
315    ":client_hints_mojom",
316    "//mojo/public/mojom/base:base",
317    "//services/network/public/mojom",
318    "//services/network/public/mojom:mojom_ip_address",
319    "//services/network/public/mojom:websocket_mojom",
320    "//ui/accessibility:ax_enums_mojo",
321    "//url/mojom:url_mojom_gurl",
322    "//url/mojom:url_mojom_origin",
323  ]
324
325  component_output_prefix = "content_public_common_mojo_bindings"
326  export_class_attribute = "CONTENT_EXPORT"
327  export_define = "CONTENT_IMPLEMENTATION=1"
328  export_header = "content/common/content_export.h"
329}
330
331mojom("renderer_type") {
332  sources = [ "media_playback_renderer_type.mojom" ]
333}
334
335mojom("web_preferences_mojom") {
336  sources = [ "web_preferences.mojom" ]
337
338  public_deps = [ "//third_party/blink/public/mojom:mojom_platform" ]
339
340  overridden_deps = [ "//third_party/blink/public/mojom:mojom_platform" ]
341  component_deps = [ "//third_party/blink/public/common" ]
342}
343
344mojom("client_hints_mojom") {
345  sources = [ "client_hints.mojom" ]
346
347  public_deps = [
348    "//mojo/public/mojom/base",
349    "//third_party/blink/public/mojom:web_client_hints_types_mojo_bindings",
350    "//url/mojom:url_mojom_origin",
351  ]
352}
353
354mojom("service_names") {
355  sources = [ "service_names.mojom" ]
356}
357