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