Fixes for cr-settings-page-header
[chromium-blink-merge.git] / content / browser / BUILD.gn
blob11631ec1a910458cebf64ef8f5249e940edbe50f
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     "//components/mime_util",
25     "//content:resources",
26     "//content/browser/background_sync:background_sync_proto",
27     "//content/browser/cache_storage:cache_storage_proto",
28     "//content/browser/notifications:notification_proto",
29     "//content/browser/service_worker:service_worker_proto",
30     "//content/browser/speech/proto",
31     "//content/public/common:common_sources",
32     "//crypto",
33     "//device/battery",
34     "//device/vibration",
35     "//google_apis",
36     "//net",
37     "//skia",
38     "//sql",
39     "//third_party/npapi",
40     "//third_party/re2",
41     "//third_party/WebKit/public:blink_headers",
42     "//third_party/zlib",
43     "//third_party/zlib:zip",
44     "//ui/accessibility",
45     "//ui/accessibility:ax_gen",
46     "//ui/base",
47     "//ui/base/ime",
48     "//ui/events",
49     "//ui/events:gesture_detection",
50     "//ui/gfx",
51     "//ui/gfx/geometry",
52     "//ui/gl",
53     "//ui/native_theme",
54     "//ui/resources",
55     "//ui/snapshot",
56   ]
58   if (is_ios) {
59     # iOS doesn't get the normal file list and only takes these whitelisted
60     # files.
61     sources = [
62       "browser_context.cc",
63       "browser_main_loop.cc",
64       "browser_main_runner.cc",
65       "browser_process_sub_thread.cc",
66       "browser_thread_impl.cc",
67       "browser_url_handler_impl.cc",
68       "cert_store_impl.cc",
69       "download/download_create_info.cc",
70       "notification_service_impl.cc",
71       "signed_certificate_timestamp_store_impl.cc",
72       "user_metrics.cc",
73       "web_contents/navigation_entry_impl.cc",
74     ]
75   } else {
76     # Normal non-iOS sources get everything.
77     sources = rebase_path(content_browser_gypi_values.private_browser_sources,
78                           ".",
79                           "//content")
81     # TODO(GYP) these generated files are listed as sources in content_browser.
82     # This is a bit suspicious. The GN grit template will make a source set
83     # containing the generated code so it should be sufficient to just depend
84     # on the grit rule. But maybe some of these will need to be added?
85     #
86     # Need this annoying rebase_path call to match what happened with the
87     # sources.
88     sources -= rebase_path(
89             [
90               "$root_gen_dir/blink/grit/devtools_resources.h",
91               "$root_gen_dir/blink/grit/devtools_resources_map.cc",
92               "$root_gen_dir/blink/grit/devtools_resources_map.h",
93               "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
94               "$root_gen_dir/ui/resources/grit/webui_resources_map.cc",
95             ],
96             ".")
98     # Non-iOS deps.
99     deps += [
100       "//cc",
101       "//cc/surfaces",
102       "//components/scheduler:common",
103       "//content/app/resources",
104       "//content/app/strings",
105       "//content/browser/devtools:gen_devtools_protocol_handler",
106       "//content/browser/devtools:resources",
107       "//content/common:mojo_bindings",
108       "//content/public/common:mojo_bindings",
109       "//device/bluetooth",
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   }
201   if (is_win) {
202     sources -= [
203       "device_sensors/data_fetcher_shared_memory_default.cc",
204       "geolocation/empty_wifi_data_provider.cc",
205     ]
206     defines += [
207       # This prevents the inclusion of atlhost.h which paired
208       # with the windows 8 sdk it does the wrong thing.
209       "__ATLHOST_H__",
210     ]
211     deps += [
212       "//third_party/iaccessible2",
213       "//third_party/isimpledom",
214     ]
215     libs += [
216       "comctl32.lib",
217       "dinput8.lib",
218       "dwmapi.lib",
219       "dxguid.lib",
220       "oleacc.lib",
221       "sensorsapi.lib",
222       "portabledeviceguids.lib",
223     ]
225     # TODI(GYP)
226     #       'msvs_settings': {
227     #         'VCLinkerTool': {
228     #           'DelayLoadDLLs': [
229     #             'dinput8.dll',
230     #             'user32.dll',
231     #             'dwmapi.dll',
232     #           ],
233   }
235   if (is_linux) {
236     deps += [ "//sandbox/linux:libc_urandom_override" ]
237   }
239   if (use_udev) {
240     deps += [ "//device/udev_linux" ]
241   } else {
242     # Remove udev-specific sources.
243     sources -= [
244       "device_monitor_udev.cc",
245       "device_monitor_udev.h",
246     ]
247     if (is_linux) {
248       # Already filtered out on non-Linux.
249       sources -= [
250         "gamepad/gamepad_platform_data_fetcher_linux.cc",
251         "udev_linux.cc",
252         "udev_linux.h",
253       ]
254     }
255   }
257   if (enable_plugins) {
258     sources += rebase_path(content_browser_gypi_values.plugin_browser_sources,
259                            ".",
260                            "//content")
261     deps += [
262       "//ppapi/proxy:ipc",
263       "//ppapi/shared_impl",
264     ]
265     if (!use_ozone || use_pango) {
266       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_ozone.cc" ]
267     }
268     if (!use_pango) {
269       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_pango.cc" ]
270     }
271   }
273   if (is_linux && use_aura) {
274     configs += [ "//build/config/linux:fontconfig" ]
275   }
277   if (use_x11) {
278     configs += [ "//build/config/linux:x11" ]
279     deps += [ "//ui/gfx/x" ]
280   }
282   # Dealing with power_save_blocker_{x11,ozone}.cc is a little complicated
283   # given the interaction between os_chromeos and the feature flags for X11 and
284   # ozone, so do it all in one spot.
285   if (is_chromeos || !use_ozone) {
286     sources -= [ "power_save_blocker_ozone.cc" ]
287   }
288   if (is_chromeos || !use_x11) {
289     sources -= [ "power_save_blocker_x11.cc" ]
290   }
292   # Dealing with *wifi_data_provider_*.cc is also a bit complicated given
293   # android, chromeos, linux and use_dbus.
294   if (is_android) {
295     sources -= [ "geolocation/wifi_data_provider_common.cc" ]
296   }
297   if (is_chromeos || (is_linux && !use_dbus)) {
298     sources -= [ "geolocation/wifi_data_provider_linux.cc" ]
299   }
300   if (is_linux && use_dbus) {
301     sources -= [ "geolocation/empty_wifi_data_provider.cc" ]
302   }
304   if (use_pango) {
305     configs += [ "//build/config/linux:pangocairo" ]
306   }
308   if (is_android) {
309     sources += rebase_path(content_browser_gypi_values.android_browser_sources,
310                            ".",
311                            "//content")
312     sources -= [
313       "browser_ipc_logging.cc",
314       "device_sensors/data_fetcher_shared_memory_default.cc",
315       "geolocation/network_location_provider.cc",
316       "geolocation/network_location_provider.h",
317       "geolocation/network_location_request.cc",
318       "geolocation/network_location_request.h",
319       "renderer_host/begin_frame_observer_proxy.cc",
320       "tracing/tracing_ui.cc",
321       "tracing/tracing_ui.h",
323       # Android skips most, but not all, of the speech code.
324       "speech/audio_buffer.cc",
325       "speech/audio_buffer.h",
326       "speech/audio_encoder.cc",
327       "speech/audio_encoder.h",
328       "speech/chunked_byte_buffer.cc",
329       "speech/chunked_byte_buffer.h",
330       "speech/endpointer/endpointer.cc",
331       "speech/endpointer/endpointer.h",
332       "speech/endpointer/energy_endpointer.cc",
333       "speech/endpointer/energy_endpointer.h",
334       "speech/endpointer/energy_endpointer_params.cc",
335       "speech/endpointer/energy_endpointer_params.h",
336       "speech/google_one_shot_remote_engine.cc",
337       "speech/google_one_shot_remote_engine.h",
338       "speech/google_streaming_remote_engine.cc",
339       "speech/google_streaming_remote_engine.h",
340       "speech/speech_recognition_engine.cc",
341       "speech/speech_recognition_engine.h",
342       "speech/speech_recognizer_impl.cc",
343       "speech/speech_recognizer_impl.h",
344     ]
345     deps += [
346       "//content/public/android:jni",
347       "//media",
348       "//mojo/android:libsystem_java",
349       "//ui/android",
350     ]
351     libs += [ "jnigraphics" ]
352   }
354   if (is_mac) {
355     sources -= [
356       "device_sensors/data_fetcher_shared_memory_default.cc",
357       "geolocation/empty_wifi_data_provider.cc",
358       "geolocation/empty_wifi_data_provider.h",
359     ]
360     deps += [
361       "//sandbox/mac:sandbox",
362       "//third_party/mozilla",
363       "//third_party/sudden_motion_sensor",
364       "//ui/accelerated_widget_mac",
365     ]
366     libs += [
367       "bsm",
368       "QTKit.framework",
369     ]
370   }
372   if (is_chromeos) {
373     sources -= [ "device_sensors/data_fetcher_shared_memory_default.cc" ]
374     deps += [
375       "//chromeos",
376       "//chromeos:power_manager_proto",
377     ]
378   }
380   if (use_aura) {
381     deps += [
382       "//ui/aura",
383       "//ui/aura_extra",
384       "//ui/strings",
385       "//ui/wm",
386     ]
387   } else {  # Not aura.
388     sources -= [
389       "renderer_host/compositor_resize_lock_aura.cc",
390       "renderer_host/compositor_resize_lock_aura.h",
391       "renderer_host/input/synthetic_gesture_target_aura.cc",
392       "renderer_host/input/synthetic_gesture_target_aura.h",
393       "renderer_host/native_web_keyboard_event_aura.cc",
394       "renderer_host/render_widget_host_view_aura.cc",
395       "renderer_host/render_widget_host_view_aura.h",
396       "renderer_host/ui_events_helper.cc",
397       "renderer_host/ui_events_helper.h",
398       "renderer_host/web_input_event_aura.cc",
399       "renderer_host/web_input_event_aura.h",
400       "web_contents/aura/gesture_nav_simple.cc",
401       "web_contents/aura/gesture_nav_simple.h",
402       "web_contents/aura/overscroll_navigation_overlay.cc",
403       "web_contents/aura/overscroll_navigation_overlay.h",
404       "web_contents/aura/overscroll_window_animation.cc",
405       "web_contents/aura/overscroll_window_animation.h",
406       "web_contents/aura/overscroll_window_delegate.cc",
407       "web_contents/aura/overscroll_window_delegate.h",
408       "web_contents/aura/shadow_layer_delegate.cc",
409       "web_contents/aura/shadow_layer_delegate.h",
410       "web_contents/touch_editable_impl_aura.cc",
411       "web_contents/touch_editable_impl_aura.h",
412       "web_contents/web_contents_view_aura.cc",
413       "web_contents/web_contents_view_aura.h",
414     ]
415   }
417   if (use_aura || is_mac) {
418     sources +=
419         rebase_path(content_browser_gypi_values.compositor_browser_sources,
420                     ".",
421                     "//content")
422     if (!use_x11) {
423       sources -= [
424         "compositor/software_output_device_x11.cc",
425         "compositor/software_output_device_x11.h",
426       ]
427     }
429     if (!use_ozone) {
430       sources -= [
431         "compositor/browser_compositor_overlay_candidate_validator_ozone.cc",
432         "compositor/browser_compositor_overlay_candidate_validator_ozone.h",
433         "compositor/software_output_device_ozone.cc",
434         "compositor/software_output_device_ozone.h",
435       ]
436     }
437     deps += [ "//ui/compositor" ]
438   }
440   if (enable_web_speech) {
441     deps += [
442       "//third_party/flac",
443       "//third_party/speex",
444     ]
445   }
447   if (is_linux && use_dbus) {
448     deps += [ "//dbus" ]
449   }
451   if (enable_browser_cdms) {
452     sources += [
453       "media/cdm/browser_cdm_manager.cc",
454       "media/cdm/browser_cdm_manager.h",
455       "media/media_web_contents_observer.cc",
456       "media/media_web_contents_observer.h",
457     ]
458   }
460   if (is_linux && use_openssl) {
461     deps += [ "//third_party/boringssl" ]
462   }
464   if (enable_media_mojo_renderer) {
465     deps += [ "//media/mojo/services:renderer_service" ]
466   }