[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / BUILD.gn
blob599a55505a659ca0223572b2501794370e7b64cc
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.
5 import("//build/config/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8 import("//content/browser/browser.gni")
9 import("//media/media_options.gni")
11 source_set("browser") {
12   # Only the public target should depend on this. All other targets (even
13   # internal content ones) should depend on the public one.
14   visibility = [ "//content/public/browser:browser_sources" ]
16   configs += [ "//build/config:precompiled_headers" ]
17   defines = []
18   libs = []
19   ldflags = []
21   # Shared deps. See also non-iOS deps below.
22   deps = [
23     "//base",
24     "//base:base_static",
25     "//components/mime_util",
26     "//components/url_formatter",
27     "//content:resources",
28     "//content/browser/background_sync:background_sync_proto",
29     "//content/browser/cache_storage:cache_storage_proto",
30     "//content/browser/notifications:notification_proto",
31     "//content/browser/service_worker:service_worker_proto",
32     "//content/browser/speech/proto",
33     "//content/public/common:common_sources",
34     "//content/public/common:mojo_bindings",
35     "//crypto",
36     "//device/battery",
37     "//device/vibration",
38     "//google_apis",
39     "//mojo/application/public/cpp:cpp_for_chromium",
40     "//mojo/application/public/interfaces",
41     "//mojo/common",
42     "//mojo/package_manager",
43     "//mojo/shell",
44     "//net",
45     "//net:extras",
46     "//skia",
47     "//sql",
48     "//third_party/mojo/src/mojo/public/cpp/bindings",
49     "//third_party/npapi",
50     "//third_party/re2",
51     "//third_party/WebKit/public:blink_headers",
52     "//third_party/zlib",
53     "//third_party/zlib:zip",
54     "//ui/accessibility",
55     "//ui/accessibility:ax_gen",
56     "//ui/base",
57     "//ui/base/ime",
58     "//ui/events",
59     "//ui/events:gesture_detection",
60     "//ui/gfx",
61     "//ui/gfx/geometry",
62     "//ui/gl",
63     "//ui/native_theme",
64     "//ui/resources",
65     "//ui/snapshot",
66   ]
68   if (is_ios) {
69     # iOS doesn't get the normal file list and only takes these whitelisted
70     # files.
71     sources = [
72       "browser_context.cc",
73       "browser_main_loop.cc",
74       "browser_main_runner.cc",
75       "browser_process_sub_thread.cc",
76       "browser_thread_impl.cc",
77       "browser_url_handler_impl.cc",
78       "cert_store_impl.cc",
79       "download/download_create_info.cc",
80       "notification_service_impl.cc",
81       "signed_certificate_timestamp_store_impl.cc",
82       "user_metrics.cc",
83       "web_contents/navigation_entry_impl.cc",
84     ]
85   } else {
86     # Normal non-iOS sources get everything.
87     sources = rebase_path(content_browser_gypi_values.private_browser_sources,
88                           ".",
89                           "//content")
91     # TODO(GYP) these generated files are listed as sources in content_browser.
92     # This is a bit suspicious. The GN grit template will make a source set
93     # containing the generated code so it should be sufficient to just depend
94     # on the grit rule. But maybe some of these will need to be added?
95     #
96     # Need this annoying rebase_path call to match what happened with the
97     # sources.
98     sources -= rebase_path(
99             [
100               "$root_gen_dir/blink/grit/devtools_resources.h",
101               "$root_gen_dir/blink/grit/devtools_resources_map.cc",
102               "$root_gen_dir/blink/grit/devtools_resources_map.h",
103               "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
104               "$root_gen_dir/ui/resources/grit/webui_resources_map.cc",
105             ],
106             ".")
108     # Non-iOS deps.
109     deps += [
110       "//cc",
111       "//cc/surfaces",
112       "//content/app/resources",
113       "//content/app/strings",
114       "//content/browser/devtools:gen_devtools_protocol_handler",
115       "//content/browser/devtools:resources",
116       "//content/common:mojo_bindings",
117       "//content/public/common:mojo_bindings",
118       "//device/bluetooth",
119       "//gin",
120       "//mojo/application/public/interfaces",
121       "//mojo/common:url_type_converters",
122       "//mojo/converters/geometry",
123       "//skia/public",
124       "//storage/browser",
125       "//storage/common",
126       "//third_party/WebKit/public:image_resources",
127       "//third_party/WebKit/public:resources",
128       "//third_party/angle:commit_id",
129       "//third_party/icu",
130       "//third_party/leveldatabase",
131       "//third_party/libyuv",
132       "//third_party/mojo/src/mojo/public/cpp/bindings",
133       "//third_party/mojo/src/mojo/public/js",
134       "//ui/events/blink",
135       "//ui/resources",
136       "//ui/surface",
137       "//ui/touch_selection",
138     ]
139   }
141   configs += [
142     "//content:content_implementation",
143     "//third_party/WebKit/public:debug_devtools",
144   ]
146   if (toolkit_views) {
147     deps += [ "//ui/events" ]
148   }
150   if (is_win) {
151     sources += [
152       "power_profiler/power_data_provider_ia_win.cc",
153       "power_profiler/power_data_provider_ia_win.h",
154     ]
155     deps += [ "//third_party/power_gadget" ]
156   } else {
157     sources += [
158       "file_descriptor_info_impl.cc",
159       "file_descriptor_info_impl.h",
160       "power_profiler/power_data_provider_dummy.cc",
161     ]
162     sources -= [ "renderer_host/web_input_event_aurawin.cc" ]
163   }
165   if (!is_win && !is_mac && !is_android && (!is_linux || !use_udev)) {
166     sources += [ "gamepad/gamepad_platform_data_fetcher.cc" ]
167   }
169   if (enable_basic_printing || enable_print_preview) {
170     deps += [ "//printing" ]
171   }
173   # TODO(GYP)
174   #   ['OS!="ios" and chrome_multiple_dll!=1', {
175   #     'dependencies': [
176   #       '../third_party/WebKit/public/blink.gyp:blink',
177   #     ],
178   #   }],
179   if (!is_mac && !is_ios) {
180     deps += [ "//sandbox" ]
181   }
182   if (!is_android && !is_ios) {
183     deps += [ "//content/browser/tracing:resources" ]
184   }
186   if (enable_webrtc) {
187     sources += rebase_path(content_browser_gypi_values.webrtc_browser_sources,
188                            ".",
189                            "//content")
190     deps += [ "//jingle:jingle_glue" ]
191     if (is_linux) {
192       deps += [ "//third_party/libjingle:libjingle_webrtc" ]
193     }
194     if (is_linux || is_mac || is_win) {
195       sources += [
196         "media/capture/desktop_capture_device.cc",
197         "media/capture/desktop_capture_device.h",
198         "media/capture/desktop_capture_device_uma_types.cc",
199         "media/capture/desktop_capture_device_uma_types.h",
200       ]
201       if (use_aura) {
202         sources += [
203           "media/capture/aura_window_capture_machine.cc",
204           "media/capture/aura_window_capture_machine.h",
205           "media/capture/desktop_capture_device_aura.cc",
206           "media/capture/desktop_capture_device_aura.h",
207         ]
208       }
209       defines += [ "ENABLE_SCREEN_CAPTURE=1" ]
210       deps += [ "//third_party/webrtc/modules/desktop_capture" ]
211     }
212   }
214   if (is_win) {
215     sources -= [
216       "device_sensors/data_fetcher_shared_memory_default.cc",
217       "geolocation/empty_wifi_data_provider.cc",
218     ]
219     defines += [
220       # This prevents the inclusion of atlhost.h which paired
221       # with the windows 8 sdk it does the wrong thing.
222       "__ATLHOST_H__",
223     ]
224     deps += [
225       "//third_party/iaccessible2",
226       "//third_party/isimpledom",
227     ]
228     libs += [
229       "comctl32.lib",
230       "dinput8.lib",
231       "dwmapi.lib",
232       "dxguid.lib",
233       "oleacc.lib",
234       "sensorsapi.lib",
235       "portabledeviceguids.lib",
236     ]
238     # TODI(GYP)
239     #       'msvs_settings': {
240     #         'VCLinkerTool': {
241     #           'DelayLoadDLLs': [
242     #             'dinput8.dll',
243     #             'user32.dll',
244     #             'dwmapi.dll',
245     #           ],
246   }
248   if (is_linux && !use_openssl) {
249     deps += [ "//sandbox/linux:libc_urandom_override" ]
250   }
252   if (use_udev) {
253     deps += [ "//device/udev_linux" ]
254   } else {
255     # Remove udev-specific sources.
256     sources -= [
257       "device_monitor_udev.cc",
258       "device_monitor_udev.h",
259     ]
260     if (is_linux) {
261       # Already filtered out on non-Linux.
262       sources -= [
263         "gamepad/gamepad_platform_data_fetcher_linux.cc",
264         "udev_linux.cc",
265         "udev_linux.h",
266       ]
267     }
268   }
270   if (enable_plugins) {
271     sources += rebase_path(content_browser_gypi_values.plugin_browser_sources,
272                            ".",
273                            "//content")
274     deps += [
275       "//ppapi/host",
276       "//ppapi/proxy:ipc",
277       "//ppapi/shared_impl",
278     ]
279     if (!use_ozone || use_pango) {
280       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_ozone.cc" ]
281     }
282     if (!use_pango) {
283       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_pango.cc" ]
284     }
285   }
287   if (use_atk) {
288     sources +=
289         rebase_path(content_browser_gypi_values.auralinux_browser_sources,
290                     ".",
291                     "//content")
293     configs += [
294       "//build/config/linux:atk",
295       "//build/config/linux:atk_warnings",
296       "//build/config/linux:gconf",
297       "//build/config/linux:glib",
298     ]
299   }
301   if (is_linux && use_aura) {
302     configs += [ "//build/config/linux:fontconfig" ]
303   }
305   if (use_x11) {
306     configs += [ "//build/config/linux:x11" ]
307     deps += [ "//ui/gfx/x" ]
308   }
310   # Dealing with power_save_blocker_{x11,ozone}.cc is a little complicated
311   # given the interaction between os_chromeos and the feature flags for X11 and
312   # ozone, so do it all in one spot.
313   if (is_chromeos || !use_ozone) {
314     sources -= [ "power_save_blocker_ozone.cc" ]
315   }
316   if (is_chromeos || !use_x11) {
317     sources -= [ "power_save_blocker_x11.cc" ]
318   }
320   # Dealing with *wifi_data_provider_*.cc is also a bit complicated given
321   # android, chromeos, linux and use_dbus.
322   if (is_android) {
323     sources -= [ "geolocation/wifi_data_provider_common.cc" ]
324   }
325   if (is_chromeos || (is_linux && !use_dbus)) {
326     sources -= [ "geolocation/wifi_data_provider_linux.cc" ]
327   }
328   if (is_linux && use_dbus) {
329     sources -= [ "geolocation/empty_wifi_data_provider.cc" ]
330   }
332   if (use_pango) {
333     configs += [ "//build/config/linux:pangocairo" ]
334   }
336   if (is_android) {
337     sources += rebase_path(content_browser_gypi_values.android_browser_sources,
338                            ".",
339                            "//content")
340     sources -= [
341       "browser_ipc_logging.cc",
342       "device_sensors/data_fetcher_shared_memory_default.cc",
343       "geolocation/network_location_provider.cc",
344       "geolocation/network_location_provider.h",
345       "geolocation/network_location_request.cc",
346       "geolocation/network_location_request.h",
347       "power_usage_monitor_impl.cc",
348       "power_usage_monitor_impl.h",
349       "renderer_host/begin_frame_observer_proxy.cc",
350       "tracing/tracing_ui.cc",
351       "tracing/tracing_ui.h",
353       # Android skips most, but not all, of the speech code.
354       "speech/audio_buffer.cc",
355       "speech/audio_buffer.h",
356       "speech/audio_encoder.cc",
357       "speech/audio_encoder.h",
358       "speech/chunked_byte_buffer.cc",
359       "speech/chunked_byte_buffer.h",
360       "speech/endpointer/endpointer.cc",
361       "speech/endpointer/endpointer.h",
362       "speech/endpointer/energy_endpointer.cc",
363       "speech/endpointer/energy_endpointer.h",
364       "speech/endpointer/energy_endpointer_params.cc",
365       "speech/endpointer/energy_endpointer_params.h",
366       "speech/google_one_shot_remote_engine.cc",
367       "speech/google_one_shot_remote_engine.h",
368       "speech/google_streaming_remote_engine.cc",
369       "speech/google_streaming_remote_engine.h",
370       "speech/speech_recognition_engine.cc",
371       "speech/speech_recognition_engine.h",
372       "speech/speech_recognizer_impl.cc",
373       "speech/speech_recognizer_impl.h",
374     ]
375     deps -= [ "//device/battery" ]
376     deps += [
377       "//content/public/android:jni",
378       "//media",
379       "//mojo/android:libsystem_java",
380       "//ui/android",
381     ]
382     libs += [ "jnigraphics" ]
383   }
385   if (is_mac) {
386     sources -= [
387       "device_sensors/data_fetcher_shared_memory_default.cc",
388       "geolocation/empty_wifi_data_provider.cc",
389       "geolocation/empty_wifi_data_provider.h",
390     ]
391     deps += [
392       "//sandbox/mac:sandbox",
393       "//third_party/mozilla",
394       "//third_party/sudden_motion_sensor",
395       "//ui/accelerated_widget_mac",
396     ]
397     libs += [
398       "bsm",
399       "QTKit.framework",
400     ]
401   }
403   if (is_chromeos) {
404     sources -= [ "device_sensors/data_fetcher_shared_memory_default.cc" ]
405     deps += [
406       "//chromeos",
407       "//chromeos:power_manager_proto",
408     ]
409   }
411   if (use_aura) {
412     deps += [
413       "//ui/aura",
414       "//ui/aura_extra",
415       "//ui/strings",
416       "//ui/wm",
417     ]
418   } else {  # Not aura.
419     sources -= [
420       "renderer_host/compositor_resize_lock_aura.cc",
421       "renderer_host/compositor_resize_lock_aura.h",
422       "renderer_host/input/synthetic_gesture_target_aura.cc",
423       "renderer_host/input/synthetic_gesture_target_aura.h",
424       "renderer_host/input/touch_selection_controller_client_aura.cc",
425       "renderer_host/input/touch_selection_controller_client_aura.h",
426       "renderer_host/native_web_keyboard_event_aura.cc",
427       "renderer_host/render_widget_host_view_aura.cc",
428       "renderer_host/render_widget_host_view_aura.h",
429       "renderer_host/ui_events_helper.cc",
430       "renderer_host/ui_events_helper.h",
431       "renderer_host/web_input_event_aura.cc",
432       "renderer_host/web_input_event_aura.h",
433       "web_contents/aura/gesture_nav_simple.cc",
434       "web_contents/aura/gesture_nav_simple.h",
435       "web_contents/aura/overscroll_navigation_overlay.cc",
436       "web_contents/aura/overscroll_navigation_overlay.h",
437       "web_contents/aura/overscroll_window_animation.cc",
438       "web_contents/aura/overscroll_window_animation.h",
439       "web_contents/aura/overscroll_window_delegate.cc",
440       "web_contents/aura/overscroll_window_delegate.h",
441       "web_contents/aura/shadow_layer_delegate.cc",
442       "web_contents/aura/shadow_layer_delegate.h",
443       "web_contents/web_contents_view_aura.cc",
444       "web_contents/web_contents_view_aura.h",
445     ]
446   }
448   if (use_aura || is_mac) {
449     sources +=
450         rebase_path(content_browser_gypi_values.compositor_browser_sources,
451                     ".",
452                     "//content")
453     if (!use_x11) {
454       sources -= [
455         "compositor/software_output_device_x11.cc",
456         "compositor/software_output_device_x11.h",
457       ]
458     }
460     if (!use_ozone) {
461       sources -= [
462         "compositor/browser_compositor_overlay_candidate_validator_ozone.cc",
463         "compositor/browser_compositor_overlay_candidate_validator_ozone.h",
464         "compositor/software_output_device_ozone.cc",
465         "compositor/software_output_device_ozone.h",
466       ]
467     }
468     deps += [ "//ui/compositor" ]
469   }
471   if (!is_ios) {
472     sources += [
473       "compositor/surface_utils.cc",
474       "compositor/surface_utils.h",
475     ]
476   }
478   if (enable_web_speech) {
479     deps += [ "//third_party/flac" ]
480   }
482   if (is_linux && use_dbus) {
483     deps += [ "//dbus" ]
484   }
486   if (enable_browser_cdms) {
487     sources += [
488       "media/cdm/browser_cdm_manager.cc",
489       "media/cdm/browser_cdm_manager.h",
490       "media/media_web_contents_observer.cc",
491       "media/media_web_contents_observer.h",
492     ]
493   }
495   if (is_linux && use_openssl) {
496     deps += [ "//third_party/boringssl" ]
497   }
499   if (enable_mojo_media == "browser") {
500     deps += [ "//media/mojo/services:application" ]
501   }
503   if (enable_webvr) {
504     sources += [
505       "vr/vr_device.cc",
506       "vr/vr_device.h",
507       "vr/vr_device_manager.cc",
508       "vr/vr_device_manager.h",
509       "vr/vr_device_provider.h",
510     ]
511   }
513   if (enable_webvr && is_android) {
514     sources += [
515       "vr/android/cardboard/cardboard_vr_device.cc",
516       "vr/android/cardboard/cardboard_vr_device.h",
517       "vr/android/cardboard/cardboard_vr_device_provider.cc",
518       "vr/android/cardboard/cardboard_vr_device_provider.h",
519     ]
520   }