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