Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / BUILD.gn
bloba722c0c8626b3197ed0375cc4b1830e646a0a64a
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   defines = []
17   libs = []
18   ldflags = []
20   # Shared deps. See also non-iOS deps below.
21   deps = [
22     "//base",
23     "//base:base_static",
24     "//content:resources",
25     "//content/browser/background_sync:background_sync_proto",
26     "//content/browser/cache_storage:cache_storage_proto",
27     "//content/browser/notifications:notification_proto",
28     "//content/browser/service_worker:service_worker_proto",
29     "//content/browser/speech/proto",
30     "//content/public/common:common_sources",
31     "//crypto",
32     "//device/battery",
33     "//device/vibration",
34     "//google_apis",
35     "//net",
36     "//skia",
37     "//sql",
38     "//third_party/npapi",
39     "//third_party/re2",
40     "//third_party/WebKit/public:blink_headers",
41     "//third_party/zlib",
42     "//third_party/zlib:zip",
43     "//ui/accessibility",
44     "//ui/accessibility:ax_gen",
45     "//ui/base",
46     "//ui/base/ime",
47     "//ui/events",
48     "//ui/events:gesture_detection",
49     "//ui/gfx",
50     "//ui/gfx/geometry",
51     "//ui/gl",
52     "//ui/native_theme",
53     "//ui/resources",
54     "//ui/snapshot",
55   ]
57   if (is_ios) {
58     # iOS doesn't get the normal file list and only takes these whitelisted
59     # files.
60     sources = [
61       "browser_context.cc",
62       "browser_main_loop.cc",
63       "browser_main_runner.cc",
64       "browser_process_sub_thread.cc",
65       "browser_thread_impl.cc",
66       "browser_url_handler_impl.cc",
67       "cert_store_impl.cc",
68       "download/download_create_info.cc",
69       "notification_service_impl.cc",
70       "signed_certificate_timestamp_store_impl.cc",
71       "user_metrics.cc",
72       "web_contents/navigation_entry_impl.cc",
73     ]
74   } else {
75     # Normal non-iOS sources get everything.
76     sources = rebase_path(content_browser_gypi_values.private_browser_sources,
77                           ".",
78                           "//content")
80     # TODO(GYP) these generated files are listed as sources in content_browser.
81     # This is a bit suspicious. The GN grit template will make a source set
82     # containing the generated code so it should be sufficient to just depend
83     # on the grit rule. But maybe some of these will need to be added?
84     #
85     # Need this annoying rebase_path call to match what happened with the
86     # sources.
87     sources -= rebase_path(
88             [
89               "$root_gen_dir/blink/grit/devtools_resources.h",
90               "$root_gen_dir/blink/grit/devtools_resources_map.cc",
91               "$root_gen_dir/blink/grit/devtools_resources_map.h",
92               "$root_gen_dir/content/browser/devtools/protocol/devtools_protocol_dispatcher.cc",
93               "$root_gen_dir/content/browser/devtools/protocol/devtools_protocol_dispatcher.h",
94               "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
95               "$root_gen_dir/ui/resources/grit/webui_resources_map.cc",
96             ],
97             ".")
99     # Non-iOS deps.
100     deps += [
101       "//cc",
102       "//cc/surfaces",
103       "//content/app/resources",
104       "//content/app/strings",
105       "//content/browser/devtools:resources",
106       "//content/common:mojo_bindings",
107       "//content/public/common:mojo_bindings",
108       "//device/bluetooth",
109       "//net:http_server",
110       "//storage/browser",
111       "//storage/common",
112       "//third_party/WebKit/public:image_resources",
113       "//third_party/WebKit/public:resources",
114       "//third_party/angle:commit_id",
115       "//third_party/icu",
116       "//third_party/leveldatabase",
117       "//third_party/libyuv",
118       "//third_party/mojo/src/mojo/public/cpp/bindings",
119       "//third_party/mojo/src/mojo/public/interfaces/application",
120       "//third_party/mojo/src/mojo/public/js",
121       "//ui/events/blink",
122       "//ui/resources",
123       "//ui/surface",
124       "//ui/touch_selection",
125     ]
126   }
128   configs += [
129     "//content:content_implementation",
130     "//third_party/WebKit/public:debug_devtools",
131   ]
133   if (toolkit_views) {
134     deps += [ "//ui/events" ]
135   }
137   if (is_win) {
138     sources += [
139       "power_profiler/power_data_provider_ia_win.cc",
140       "power_profiler/power_data_provider_ia_win.h",
141     ]
142     deps += [ "//third_party/power_gadget" ]
143   } else {
144     sources += [
145       "file_descriptor_info_impl.cc",
146       "file_descriptor_info_impl.h",
147       "power_profiler/power_data_provider_dummy.cc",
148     ]
149     sources -= [ "renderer_host/web_input_event_aurawin.cc" ]
150   }
152   if (!is_win && !is_mac && !is_android && (!is_linux || !use_udev)) {
153     sources += [ "gamepad/gamepad_platform_data_fetcher.cc" ]
154   }
156   if (enable_basic_printing || enable_print_preview) {
157     deps += [ "//printing" ]
158   }
160   # TODO(GYP)
161   #   ['OS!="ios" and chrome_multiple_dll!=1', {
162   #     'dependencies': [
163   #       '../third_party/WebKit/public/blink.gyp:blink',
164   #     ],
165   #   }],
166   if (!is_mac && !is_ios) {
167     deps += [ "//sandbox" ]
168   }
169   if (!is_android && !is_ios) {
170     deps += [ "//content/browser/tracing:resources" ]
171   }
173   if (enable_webrtc) {
174     sources += rebase_path(content_browser_gypi_values.webrtc_browser_sources,
175                            ".",
176                            "//content")
177     deps += [ "//jingle:jingle_glue" ]
178     if (is_linux) {
179       deps += [ "//third_party/libjingle:libjingle_webrtc" ]
180     }
181     if (is_linux || is_mac || is_win) {
182       sources += [
183         "media/capture/desktop_capture_device.cc",
184         "media/capture/desktop_capture_device.h",
185         "media/capture/desktop_capture_device_uma_types.cc",
186         "media/capture/desktop_capture_device_uma_types.h",
187       ]
188       if (use_aura) {
189         sources += [
190           "media/capture/aura_window_capture_machine.cc",
191           "media/capture/aura_window_capture_machine.h",
192           "media/capture/desktop_capture_device_aura.cc",
193           "media/capture/desktop_capture_device_aura.h",
194         ]
195       }
196       defines += [ "ENABLE_SCREEN_CAPTURE=1" ]
197       deps += [ "//third_party/webrtc/modules/desktop_capture" ]
198     }
199     if (is_linux || is_mac) {
200       sources += [
201         "renderer_host/media/video_capture_texture_wrapper.cc",
202         "renderer_host/media/video_capture_texture_wrapper.h",
203       ]
204     }
205   }
207   if (is_win) {
208     sources -= [
209       "device_sensors/data_fetcher_shared_memory_default.cc",
210       "geolocation/empty_wifi_data_provider.cc",
211     ]
212     defines += [
213       # This prevents the inclusion of atlhost.h which paired
214       # with the windows 8 sdk it does the wrong thing.
215       "__ATLHOST_H__",
216     ]
217     deps += [
218       "//third_party/iaccessible2",
219       "//third_party/isimpledom",
220     ]
221     libs += [
222       "comctl32.lib",
223       "dinput8.lib",
224       "dwmapi.lib",
225       "dxguid.lib",
226       "sensorsapi.lib",
227       "portabledeviceguids.lib",
228     ]
230     # TODI(GYP)
231     #       'msvs_settings': {
232     #         'VCLinkerTool': {
233     #           'DelayLoadDLLs': [
234     #             'dinput8.dll',
235     #             'user32.dll',
236     #             'dwmapi.dll',
237     #           ],
238   }
240   if (is_linux) {
241     deps += [ "//sandbox/linux:libc_urandom_override" ]
242   }
244   if (use_udev) {
245     deps += [ "//device/udev_linux" ]
246   } else {
247     # Remove udev-specific sources.
248     sources -= [
249       "device_monitor_udev.cc",
250       "device_monitor_udev.h",
251     ]
252     if (is_linux) {
253       # Already filtered out on non-Linux.
254       sources -= [
255         "gamepad/gamepad_platform_data_fetcher_linux.cc",
256         "udev_linux.cc",
257         "udev_linux.h",
258       ]
259     }
260   }
262   if (enable_plugins) {
263     sources += rebase_path(content_browser_gypi_values.plugin_browser_sources,
264                            ".",
265                            "//content")
266     deps += [
267       "//ppapi/proxy:ipc",
268       "//ppapi/shared_impl",
269     ]
270     if (!use_ozone || use_pango) {
271       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_ozone.cc" ]
272     }
273     if (!use_pango) {
274       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_pango.cc" ]
275     }
276   }
278   if (is_linux && use_aura) {
279     configs += [ "//build/config/linux:fontconfig" ]
280   }
282   if (use_x11) {
283     configs += [ "//build/config/linux:x11" ]
284     deps += [ "//ui/gfx/x" ]
285   }
287   # Dealing with power_save_blocker_{x11,ozone}.cc is a little complicated
288   # given the interaction between os_chromeos and the feature flags for X11 and
289   # ozone, so do it all in one spot.
290   if (is_chromeos || !use_ozone) {
291     sources -= [ "power_save_blocker_ozone.cc" ]
292   }
293   if (is_chromeos || !use_x11) {
294     sources -= [ "power_save_blocker_x11.cc" ]
295   }
297   # Dealing with *wifi_data_provider_*.cc is also a bit complicated given
298   # android, chromeos, linux and use_dbus.
299   if (is_android) {
300     sources -= [ "geolocation/wifi_data_provider_common.cc" ]
301   }
302   if (is_chromeos || (is_linux && !use_dbus)) {
303     sources -= [ "geolocation/wifi_data_provider_linux.cc" ]
304   }
305   if (is_linux && use_dbus) {
306     sources -= [ "geolocation/empty_wifi_data_provider.cc" ]
307   }
309   if (use_pango) {
310     configs += [ "//build/config/linux:pangocairo" ]
311   }
313   if (is_android) {
314     sources += rebase_path(content_browser_gypi_values.android_browser_sources,
315                            ".",
316                            "//content")
317     sources -= [
318       "browser_ipc_logging.cc",
319       "device_sensors/data_fetcher_shared_memory_default.cc",
320       "geolocation/network_location_provider.cc",
321       "geolocation/network_location_provider.h",
322       "geolocation/network_location_request.cc",
323       "geolocation/network_location_request.h",
324       "tracing/tracing_ui.cc",
325       "tracing/tracing_ui.h",
327       # Android skips most, but not all, of the speech code.
328       "speech/audio_buffer.cc",
329       "speech/audio_buffer.h",
330       "speech/audio_encoder.cc",
331       "speech/audio_encoder.h",
332       "speech/chunked_byte_buffer.cc",
333       "speech/chunked_byte_buffer.h",
334       "speech/endpointer/endpointer.cc",
335       "speech/endpointer/endpointer.h",
336       "speech/endpointer/energy_endpointer.cc",
337       "speech/endpointer/energy_endpointer.h",
338       "speech/endpointer/energy_endpointer_params.cc",
339       "speech/endpointer/energy_endpointer_params.h",
340       "speech/google_one_shot_remote_engine.cc",
341       "speech/google_one_shot_remote_engine.h",
342       "speech/google_streaming_remote_engine.cc",
343       "speech/google_streaming_remote_engine.h",
344       "speech/speech_recognition_engine.cc",
345       "speech/speech_recognition_engine.h",
346       "speech/speech_recognizer_impl.cc",
347       "speech/speech_recognizer_impl.h",
348     ]
349     deps += [
350       "//content/public/android:jni",
351       "//media",
352       "//mojo/android:libsystem_java",
353       "//ui/android",
354     ]
355     libs += [ "jnigraphics" ]
356   }
358   if (is_mac) {
359     sources -= [
360       "device_sensors/data_fetcher_shared_memory_default.cc",
361       "geolocation/empty_wifi_data_provider.cc",
362       "geolocation/empty_wifi_data_provider.h",
363     ]
364     deps += [ "//ui/accelerated_widget_mac" ]
365     libs += [ "bsm" ]
366   }
368   if (is_chromeos) {
369     sources -= [ "device_sensors/data_fetcher_shared_memory_default.cc" ]
370     deps += [
371       "//chromeos",
372       "//chromeos:power_manager_proto",
373     ]
374   }
376   if (use_aura) {
377     deps += [
378       "//ui/aura",
379       "//ui/aura_extra",
380       "//ui/strings",
381       "//ui/wm",
382     ]
383   } else {  # Not aura.
384     sources -= [
385       "renderer_host/input/synthetic_gesture_target_aura.cc",
386       "renderer_host/input/synthetic_gesture_target_aura.h",
387       "renderer_host/native_web_keyboard_event_aura.cc",
388       "renderer_host/render_widget_host_view_aura.cc",
389       "renderer_host/render_widget_host_view_aura.h",
390       "renderer_host/ui_events_helper.cc",
391       "renderer_host/ui_events_helper.h",
392       "renderer_host/web_input_event_aura.cc",
393       "renderer_host/web_input_event_aura.h",
394       "web_contents/aura/gesture_nav_simple.cc",
395       "web_contents/aura/gesture_nav_simple.h",
396       "web_contents/aura/overscroll_navigation_overlay.cc",
397       "web_contents/aura/overscroll_navigation_overlay.h",
398       "web_contents/aura/shadow_layer_delegate.cc",
399       "web_contents/aura/shadow_layer_delegate.h",
400       "web_contents/aura/window_slider.cc",
401       "web_contents/aura/window_slider.h",
402       "web_contents/touch_editable_impl_aura.cc",
403       "web_contents/touch_editable_impl_aura.h",
404       "web_contents/web_contents_view_aura.cc",
405       "web_contents/web_contents_view_aura.h",
406     ]
407   }
409   if (use_aura || is_mac) {
410     sources +=
411         rebase_path(content_browser_gypi_values.compositor_browser_sources,
412                     ".",
413                     "//content")
414     if (!use_x11) {
415       sources -= [
416         "compositor/software_output_device_x11.cc",
417         "compositor/software_output_device_x11.h",
418       ]
419     }
421     if (!use_ozone) {
422       sources -= [
423         "compositor/overlay_candidate_validator_ozone.cc",
424         "compositor/overlay_candidate_validator_ozone.h",
425         "compositor/software_output_device_ozone.cc",
426         "compositor/software_output_device_ozone.h",
427       ]
428     }
429     deps += [ "//ui/compositor" ]
430   }
432   if (enable_web_speech) {
433     deps += [
434       "//third_party/flac",
435       "//third_party/speex",
436     ]
437   }
439   if (is_linux && use_dbus) {
440     deps += [ "//dbus" ]
441   }
443   if (enable_browser_cdms) {
444     sources += [
445       "media/cdm/browser_cdm_manager.cc",
446       "media/cdm/browser_cdm_manager.h",
447       "media/media_web_contents_observer.cc",
448       "media/media_web_contents_observer.h",
449     ]
450   }
452   if (is_linux && use_openssl) {
453     deps += [ "//third_party/boringssl" ]
454   }
456   if (enable_media_mojo_renderer) {
457     deps += [ "//media/mojo/services:renderer_service" ]
458   }