When enabling new profile management programmatically, make sure to set the
[chromium-blink-merge.git] / content / browser / BUILD.gn
blobd76f458c7c6e3f533200b81d55e34bbe97e32585
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")
9 source_set("browser") {
10   # Only targets in the content tree can depend directly on this target.
11   visibility = [ "//content/*" ]
13   defines = []
14   libs = []
15   ldflags = []
17   # Shared deps. See also non-iOS deps below.
18   deps = [
19     "//base",
20     "//content:resources",
21     "//content/browser/service_worker:database_proto",
22     "//content/browser/speech/proto",
23     "//crypto",
24     "//google_apis",
25     "//net",
26     "//skia",
27     "//sql",
28     "//third_party/re2",
29     "//third_party/WebKit/public:blink_headers",
30     "//third_party/zlib",
31     "//third_party/zlib:zip",
32     "//ui/accessibility",
33     "//ui/accessibility:ax_gen",
34     "//ui/base",
35     "//ui/events",
36     "//ui/events:gesture_detection",
37     "//ui/gfx",
38     "//ui/gfx/geometry",
39     "//ui/resources",
40     "//ui/snapshot",
41   ]
43   if (is_ios) {
44     # iOS doesn't get the normal file list and only takes these whitelisted
45     # files.
46     sources = [
47       "browser_context.cc",
48       "browser_main_loop.cc",
49       "browser_main_runner.cc",
50       "browser_process_sub_thread.cc",
51       "browser_thread_impl.cc",
52       "browser_url_handler_impl.cc",
53       "cert_store_impl.cc",
54       "download/download_create_info.cc",
55       "notification_service_impl.cc",
56       "signed_certificate_timestamp_store_impl.cc",
57       "user_metrics.cc",
58       "web_contents/navigation_entry_impl.cc",
59     ]
60   } else {
61     # Normal non-iOS sources get everything.
62     sources = rebase_path(content_browser_gypi_values.private_browser_sources,
63                           ".", "//content")
65     # TODO(GYP) these generated files are listed as sources in content_browser.
66     # This is a bit suspicious. The GN grit template will make a source set
67     # containing the generated code so it should be sufficient to just depend
68     # on the grit rule. But maybe some of these will need to be added?
69     #
70     # Need this annoying rebase_path call to match what happened with the
71     # sources.
72     sources -= rebase_path([
73       "$root_gen_dir/webkit/grit/devtools_resources.h",
74       "$root_gen_dir/webkit/grit/devtools_resources_map.cc",
75       "$root_gen_dir/webkit/grit/devtools_resources_map.h",
76       "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
77       "$root_gen_dir/ui/ui_resources/grit/webui_resources_map.cc",
78       "$root_gen_dir/content/browser/devtools/devtools_protocol_constants.cc",
79       "$root_gen_dir/content/browser/devtools/devtools_protocol_constants.h",
80     ], ".")
82     # Non-iOS deps.
83     deps += [
84       "//content/browser/devtools:resources",
85       "//content/common:mojo_bindings",
86       "//cc",
87       "//cc:cc_surfaces",
88       "//mojo/public/cpp/bindings",
89       "//mojo/public/interfaces/service_provider:service_provider",
90       "//mojo/public/js/bindings",
91       "//net:http_server",
92       "//third_party/icu",
93       "//third_party/leveldatabase",
94       "//third_party/libyuv",
95       "//ui/resources",
96       "//ui/surface",
97       "//ui/webui/resources",
98       "//webkit:resources",
99       "//webkit:strings",
100       "//webkit/browser:storage",
101       "//webkit/common",
102       "//webkit/common:storage",
103       # TODO(GYP)
104       #"//third_party/angle:commit_id",
105     ]
106   }
108   configs += [
109     "//content:content_implementation",
110     "//content:libjingle_stub_config",  # TODO(GYP) remove when libjingle is ready.
111     "//content:webrtc_stub_config",  # TODO(GYP) remove when webrtc is ready.
112   ]
114   if (toolkit_views) {
115     deps += [ "//ui/events" ]
116   }
118   if (is_win) {
119     sources += [
120       "power_profiler/power_data_provider_ia_win.cc",
121       "power_profiler/power_data_provider_ia_win.h",
122     ]
123     deps += [ "//third_party/power_gadget" ]
124   } else {
125     sources += [ "power_profiler/power_data_provider_dummy.cc" ]
126     sources -= [ "renderer_host/web_input_event_aurawin.cc" ]
127   }
129   if (!is_win && !is_mac && (!is_linux || !use_udev)) {
130     sources += [ "gamepad/gamepad_platform_data_fetcher.cc" ]
131   }
133   if (enable_printing != 0) {
134     deps += [ "//printing" ]
135   }
137 # TODO(GYP)
138 #   ['OS!="ios" and chrome_multiple_dll!=1', {
139 #     'dependencies': [
140 #       '../third_party/WebKit/public/blink.gyp:blink',
141 #     ],
142 #   }],
143   if (!is_mac && !is_ios) {
144     deps += [ "//sandbox" ]
145   }
146   if (!is_android && !is_ios) {
147     deps += [ "//content/browser/tracing:resources" ]
148   }
150   if (enable_webrtc) {
151     sources += rebase_path(content_browser_gypi_values.webrtc_browser_sources,
152                            ".", "//content")
153     # TODO(GYP)
154     #deps += [ "//jingle:glue" ]
155     if (is_linux) {
156       # TODO(GYP)
157       #deps += [ "//third_party/libjingle:libjingle_webrtc" ]
158     }
159     if (is_linux || is_mac || is_win) {
160       sources += [
161         "media/capture/desktop_capture_device.cc",
162         "media/capture/desktop_capture_device.h",
163         "media/capture/desktop_capture_device_aura.cc",
164         "media/capture/desktop_capture_device_aura.h",
165         "media/capture/desktop_capture_device_uma_types.cc",
166         "media/capture/desktop_capture_device_uma_types.h",
167       ]
168       defines += [ "ENABLE_SCREEN_CAPTURE=1" ]
169       # TODO(GYP)
170       #deps += [ "//third_party/webrtc/modules:desktop_capture" ]
171     }
172   }
174   if (is_win) {
175     sources -= [
176       "device_sensors/data_fetcher_shared_memory_default.cc",
177       "geolocation/empty_wifi_data_provider.cc",
178     ]
179     defines += [
180       # This prevents the inclusion of atlhost.h which paired
181       # with the windows 8 sdk it does the wrong thing.
182       "__ATLHOST_H__",
183     ]
184     deps += [
185       "//third_party/iaccessible2",
186       "//third_party/isimpledom",
187     ]
188     libs += [
189       "comctl32.lib",
190       "dinput8.lib",
191       "dwmapi.lib",
192       "dxguid.lib",
193       "sensorsapi.lib",
194       "portabledeviceguids.lib",
195     ]
196     # TODI(GYP)
197 #       'msvs_settings': {
198 #         'VCLinkerTool': {
199 #           'DelayLoadDLLs': [
200 #             'dinput8.dll',
201 #             'user32.dll',
202 #             'dwmapi.dll',
203 #           ],
204   }
206   if (is_linux) {
207     deps += [ "//sandbox/linux:libc_urandom_override" ]
208   }
210   if (use_udev) {
211     configs += [ "//build/config/linux:udev" ]
212   } else {
213     # Remove udev-specific sources.
214     sources -= [
215       "device_monitor_udev.cc",
216       "device_monitor_udev.h",
217     ]
218     if (is_linux) {
219       # Already filtered out on non-Linux.
220       sources -= [
221         "gamepad/gamepad_platform_data_fetcher_linux.cc",
222         "udev_linux.cc",
223         "udev_linux.h",
224       ]
225     }
226   }
228   if (enable_plugins) {
229     sources += rebase_path(content_browser_gypi_values.plugin_browser_sources,
230                            ".", "//content")
231     deps += [
232       "//ppapi:ppapi_ipc",
233       "//ppapi:ppapi_shared",
234     ]
235     if (!use_ozone || use_pango) {
236       sources -= [ "renderer_host/pepper/pepper_truetype_font_list_ozone.cc" ]
237     }
238   }
240   if (is_linux && use_aura) {
241     configs += [ "//build/config/linux:fontconfig" ]
242   }
244   if (use_x11) {
245     configs += [ "//build/config/linux:x11" ]
246   } else {
247     sources -= [
248       "power_save_blocker_x11.cc",
249       "renderer_host/web_input_event_aurax11.cc",
250     ]
251   }
253   if (use_pango) {
254     configs += [ "//build/config/linux:pangocairo" ]
255   }
257   if (is_android) {
258     sources += rebase_path(content_browser_gypi_values.android_browser_sources,
259                            ".", "//content")
260     sources -= [
261       "battery_status/battery_status_manager_default.cc",
262       "browser_ipc_logging.cc",
263       "device_sensors/data_fetcher_shared_memory_default.cc",
264       "font_list_async.cc",
265       "geolocation/device_data_provider.cc",
266       "geolocation/empty_device_data_provider.cc",
267       "geolocation/network_location_provider.cc",
268       "geolocation/network_location_provider.h",
269       "geolocation/network_location_request.cc",
270       "geolocation/network_location_request.h",
271       "geolocation/wifi_data_provider_common.cc",
272       "renderer_host/native_web_keyboard_event.cc",
273       "tracing/tracing_ui.cc",
274       "tracing/tracing_ui.h",
276       # Android skips most, but not all, of the speech code.
277       "speech/audio_buffer.cc",
278       "speech/audio_buffer.h",
279       "speech/audio_encoder.cc",
280       "speech/audio_encoder.h",
281       "speech/chunked_byte_buffer.cc",
282       "speech/chunked_byte_buffer.h",
283       "speech/endpointer/endpointer.cc",
284       "speech/endpointer/endpointer.h",
285       "speech/endpointer/energy_endpointer.cc",
286       "speech/endpointer/energy_endpointer.h",
287       "speech/endpointer/energy_endpointer_params.cc",
288       "speech/endpointer/energy_endpointer_params.h",
289       "speech/google_one_shot_remote_engine.cc",
290       "speech/google_one_shot_remote_engine.h",
291       "speech/google_streaming_remote_engine.cc",
292       "speech/google_streaming_remote_engine.h",
293       "speech/speech_recognition_engine.cc",
294       "speech/speech_recognition_engine.h",
295       "speech/speech_recognizer_impl.cc",
296       "speech/speech_recognizer_impl.h",
297     ]
298     deps += [
299       #"//content:jni_headers",  TODO(GYP)
300       #"//media",  TODO(GYP)
301     ]
302     libs += [ "jnigraphics" ]
303   }
305   if (is_mac) {
306     sources -= [
307       "device_sensors/data_fetcher_shared_memory_default.cc",
308       "geolocation/empty_wifi_data_provider.cc",
309       "geolocation/empty_wifi_data_provider.h",
310     ]
311     libs += [ "bsm" ]
312   }
314   if (is_chromeos) {
315     sources -= [
316       "geolocation/wifi_data_provider_linux.cc",
317       "power_save_blocker_ozone.cc",
318       "power_save_blocker_x11.cc",
319     ]
320     deps += [ "//chromeos:power_manager_proto" ]
321   }
323   if (use_aura) {
324     deps += [
325       "//ui/aura",
326       "//ui/strings",
327     ]
328   } else {  # Not aura.
329     sources -= [
330       "renderer_host/render_widget_host_view_aura.cc",
331       "renderer_host/render_widget_host_view_aura.h",
332       "web_contents/touch_editable_impl_aura.cc",
333       "web_contents/touch_editable_impl_aura.h",
334       "renderer_host/ui_events_helper.cc",
335       "renderer_host/ui_events_helper.h",
336     ]
337   }
339   if (use_aura || is_mac) {
340     sources += rebase_path(
341       content_browser_gypi_values.compositor_browser_sources,
342       ".", "//content")
343     if (!use_x11) {
344       sources -= [
345         "compositor/software_output_device_x11.cc",
346         "compositor/software_output_device_x11.h",
347       ]
348     }
349     deps += [ "//ui/compositor" ]
350   }
352   if (enable_speech_input) {
353     deps += [
354       "//third_party/flac",
355       "//third_party/speex",
356     ]
357   }
359   if (is_linux) {
360     if (use_dbus) {
361       sources -= [
362         "geolocation/empty_wifi_data_provider.cc",
363       ]
364       deps += [ "//dbus" ]
365     } else {
366       # This will already have gotten removed for all non-Linux cases.
367        sources -= [ "geolocation/wifi_data_provider_linux.cc" ]
368     }
369   }