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