Remove INJECT_EVENTS permissions from test APKs.
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blobc96180355c949b3656a887ff43acab3e4bd6237b
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("//tools/grit/grit_rule.gni")
6 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
8 gypi_values = exec_script("//build/gypi_to_gn.py",
9                           [ rebase_path("../chrome_common.gypi") ],
10                           "scope",
11                           [ "../chrome_common.gypi" ])
13 # GYP version: chrome/chrome_resources.gyp:chrome_resources
14 #              (generate_common_resources action)
15 grit("resources") {
16   source = "common_resources.grd"
17   output_dir = "$root_gen_dir/chrome"
18   output_name = "common_resources"
19   outputs = [
20     "grit/common_resources.h",
21     "common_resources.pak",
22   ]
25 # GYP version: chrome/chrome_resources.gyp:chrome_resources
26 #              (generate_extensions_api_resources action)
27 if (enable_extensions) {
28   grit("extensions_api_resources") {
29     source = "extensions_api_resources.grd"
30     output_dir = "$root_gen_dir/chrome"
31     outputs = [
32       "grit/extensions_api_resources.h",
33       "extensions_api_resources.pak",
34     ]
35   }
38 # GYP version: chrome/chrome_common.gyp:common
39 static_library("common") {
40   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
41   defines = []
43   configs += [ "//build/config/compiler:wexit_time_destructors" ]
45   public_deps = [
46     "//chrome/common:constants",
47     "//chrome/common/net",
48     "//chrome/common/safe_browsing:proto",
49   ]
50   deps = [
51     ":version",
52     "//base:base",
53     "//base:i18n",
54     "//base:prefs",
55     "//base:base_static",
56     "//chrome:resources",
57     "//chrome:strings",
58     "//chrome/app/theme:theme_resources",
59     "//chrome/installer/util",
60     "//components/cloud_devices/common",
61     "//components/component_updater",
62     "//components/content_settings/core/common",
63     "//components/favicon_base",
64     "//components/json_schema",
65     "//components/metrics",
66     "//components/policy:policy_component_common",
67     "//components/translate/core/common",
68     "//components/variations",
69     "//content/public/common",
70     "//crypto",
71     "//extensions/common:common_constants",
72     "//net",
73     "//skia",
74     "//third_party/icu",
75     "//third_party/libxml",
76     "//third_party/sqlite",
77     "//third_party/zlib:zip",
78     "//ui/resources:resources",
79     "//url",
80   ]
82   if (is_ios) {
83     sources += [
84       # Use this Mac file that was filtered out.
85       "chrome_version_info_mac.mm",
86     ]
87     sources -= [
88       "resource_usage_reporter_type_converters.cc",
89       "resource_usage_reporter_type_converters.h",
90     ]
91   } else {
92     # Non-iOS.
93     deps += [
94       ":mojo_bindings",
95       "//components/visitedlink/common",
96       "//components/autofill/content/common",
97       "//components/autofill/core/common",
98       "//components/password_manager/content/common",
99       "//components/password_manager/core/common",
100       "//components/signin/core/common",
101       "//components/translate/content/common",
102       "//ipc",
103       "//third_party/re2",
104       "//third_party/widevine/cdm:version_h",
105     ]
106     public_deps += [ "//third_party/mojo/src/mojo/public/cpp/bindings" ]
107   }
109   if (enable_extensions) {
110     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
111                            ".",
112                            "//chrome")
113     deps += [
114       "//device/usb",
115       "//chrome/common/extensions/api",
116       "//extensions/common",
117       "//extensions/common/api",
118       "//extensions:extensions_resources",
119       "//extensions/strings",
120       "//media/cast:net",
121     ]
122     if (is_chromeos) {
123       sources +=
124           rebase_path(gypi_values.chrome_common_extensions_chromeos_sources,
125                       ".",
126                       "//chrome")
127     }
128   }
130   if (is_win || is_mac) {
131     sources +=
132         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
133     deps += [ "//breakpad:client" ]
134   }
135   if (is_win || is_mac || is_chromeos) {
136     if (use_openssl) {
137       sources += rebase_path(
138               gypi_values.chrome_common_networking_private_sources_openssl,
139               ".",
140               "//chrome")
142       # networking_private_crypto_openssl.cc depends on boringssl.
143       deps += [ "//third_party/boringssl" ]
144     } else {
145       sources +=
146           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
147                       ".",
148                       "//chrome")
149     }
150   }
151   if (is_mac) {
152     sources +=
153         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
154     deps += [ ":app_mode_app_support" ]
155   }
157   if (enable_nacl) {
158     deps += [ "//components/nacl:nacl_common" ]
159   }
161   # Printing.
162   if (enable_basic_printing || enable_print_preview) {
163     deps += [
164       "//components/printing/common:printing_common",
165       "//printing",
166     ]
167     if (enable_print_preview) {
168       # Full printing support.
169       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
170                              ".",
171                              "//chrome")
172     }
173   }
175   if (enable_service_discovery) {
176     sources += [
177       "local_discovery/service_discovery_client.cc",
178       "local_discovery/service_discovery_client.h",
179     ]
180   }
181   if (enable_mdns) {
182     sources += [
183       "local_discovery/service_discovery_client_impl.cc",
184       "local_discovery/service_discovery_client_impl.h",
185     ]
186   }
188   if (is_android) {
189     sources -= [
190       "badge_util.cc",
191       "chrome_version_info_posix.cc",
192       "icon_with_badge_image_source.cc",
193       "media_galleries/metadata_types.h",
194       "spellcheck_common.cc",
195     ]
196   } else {
197     # Non-Android.
198     sources +=
199         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
200   }
202   if (is_chromeos) {
203     sources -= [ "chrome_version_info_posix.cc" ]
204   }
206   if (is_win) {
207     deps += [
208       "//components/dom_distiller/core",  # Needed by chrome_content_client.cc.
209       "//third_party/wtl",
210     ]
211   }
213   if (enable_mdns) {
214     sources += [ "local_discovery/local_discovery_messages.h" ]
215   }
217   if (is_mac) {
218     sources -= [ "chrome_version_info_posix.cc" ]
219     deps += [
220       "//third_party/mach_override",
221       "//third_party/google_toolbox_for_mac",
222     ]
223   }
225   if (enable_plugins) {
226     sources += [
227       "pepper_flash.cc",
228       "pepper_flash.h",
229       "ppapi_utils.cc",
230       "ppapi_utils.h",
231     ]
232     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
233   }
234   if (enable_plugins && enable_extensions) {
235     sources += [
236       "pepper_permission_util.cc",
237       "pepper_permission_util.h",
238     ]
239   }
240   if (!enable_webrtc) {
241     sources -= [ "media/webrtc_logging_messages.h" ]
242   }
243   if (enable_configuration_policy) {
244     deps += [ "//components/policy" ]
245   }
247   if (safe_browsing_mode == 1) {
248     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
249                            ".",
250                            "//chrome")
251   }
254 # This target allows other targets to depend on result_codes.h which is a
255 # header-only dependency, without bringing in all of content.
256 source_set("result_codes") {
257   sources = [
258     "chrome_result_codes.h",
259   ]
262 import("//chrome/version.gni")
263 process_version("version") {
264   visibility = [ ":common" ]
265   template_file = "chrome_version_info_values.h.version"
266   output = "$target_gen_dir/chrome_version_info_values.h"
269 process_version("make_chrome_version") {
270   template_file = "chrome_version.cc.version"
271   output = "$target_gen_dir/chrome_version.cc"
274 # GN version: chrome/common_constants.gyp:common_constants
275 static_library("constants") {
276   sources = [
277     "chrome_constants.cc",
278     "chrome_constants.h",
279     "chrome_icon_resources_win.cc",
280     "chrome_icon_resources_win.h",
281     "chrome_paths.cc",
282     "chrome_paths.h",
283     "chrome_paths_android.cc",
284     "chrome_paths_internal.h",
285     "chrome_paths_linux.cc",
286     "chrome_paths_mac.mm",
287     "chrome_paths_win.cc",
288     "chrome_switches.cc",
289     "chrome_switches.h",
290     "env_vars.cc",
291     "env_vars.h",
292     "net/test_server_locations.cc",
293     "net/test_server_locations.h",
294     "pref_font_script_names-inl.h",
295     "pref_font_webkit_names.h",
296     "pref_names.cc",
297     "pref_names.h",
298     "widevine_cdm_constants.cc",
299     "widevine_cdm_constants.h",
300   ]
302   deps = [
303     ":make_chrome_version",
304     "//base",
305     "//base/third_party/dynamic_annotations",
306     "//components/bookmarks/common",
307     "//third_party/widevine/cdm:version_h",
308   ]
310   if (enable_nacl) {
311     deps += [ "//components/nacl:nacl_switches" ]
312   }
315 source_set("test_support") {
316   testonly = true
317   visibility = [ "//chrome/test:test_support" ]
319   sources = []
321   deps = [
322     ":common",
323     "//base",
324     "//testing/gtest",
325   ]
327   if (is_win || is_mac) {
328     sources += [
329       "media_galleries/picasa_test_util.cc",
330       "media_galleries/picasa_test_util.h",
331       "media_galleries/pmp_test_util.cc",
332       "media_galleries/pmp_test_util.h",
333     ]
334   }
336   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
338   if (enable_extensions) {
339     sources += [
340       "extensions/extension_test_util.cc",
341       "extensions/extension_test_util.h",
342     ]
343   }
346 # GN version: chrome/chrome.gyp:app_mode_app_support
347 static_library("app_mode_app_support") {
348   sources = [
349     "mac/app_mode_chrome_locator.h",
350     "mac/app_mode_chrome_locator.mm",
351     "mac/app_mode_common.h",
352     "mac/app_mode_common.mm",
353   ]
355   deps = [
356     ":constants",
357     "//base",
358   ]
361 mojom("mojo_bindings") {
362   sources = [
363     "resource_usage_reporter.mojom",
364   ]