[Extensions Toolbar] Observe original profile for extension host notifications
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blobe740125e5e4d890ed947113ecc69fd05453b5660
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")
7 gypi_values = exec_script("//build/gypi_to_gn.py",
8                           [ rebase_path("../chrome_common.gypi") ],
9                           "scope",
10                           [ "../chrome_common.gypi" ])
12 # GYP version: chrome/chrome_resources.gyp:chrome_resources
13 #              (generate_common_resources action)
14 grit("resources") {
15   source = "common_resources.grd"
16   output_dir = "$root_gen_dir/chrome"
17   output_name = "common_resources"
18   outputs = [
19     "grit/common_resources.h",
20     "common_resources.pak",
21   ]
24 # GYP version: chrome/chrome_resources.gyp:chrome_resources
25 #              (generate_extensions_api_resources action)
26 if (enable_extensions) {
27   grit("extensions_api_resources") {
28     source = "extensions_api_resources.grd"
29     output_dir = "$root_gen_dir/chrome"
30     outputs = [
31       "grit/extensions_api_resources.h",
32       "extensions_api_resources.pak",
33     ]
34   }
37 # GYP version: chrome/chrome_common.gyp:common
38 static_library("common") {
39   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
40   defines = []
42   configs += [ "//build/config/compiler:wexit_time_destructors" ]
44   deps = [
45     ":version",
46     "//base:base",
47     "//base:i18n",
48     "//base:prefs",
49     "//base:base_static",
50     "//chrome:resources",
51     "//chrome:strings",
52     "//chrome/app/theme:theme_resources",
53     "//chrome/common:constants",
54     "//chrome/common/net",
55     "//chrome/common/safe_browsing:proto",
56     "//chrome/installer/util",
57     "//components/cloud_devices/common",
58     "//components/content_settings/core/common",
59     "//components/json_schema",
60     "//components/metrics",
61     "//components/policy:policy_component_common",
62     "//components/translate/core/common",
63     "//components/variations",
64     "//content/public/common",
65     "//crypto",
66     "//extensions/common:common_constants",
67     "//net",
68     "//skia",
69     "//third_party/icu",
70     "//third_party/libxml",
71     "//third_party/sqlite",
72     "//third_party/zlib:zip",
73     "//ui/resources:resources",
74     "//url",
75   ]
77   if (is_ios) {
78     sources += [
79       # Use this Mac file that was filtered out.
80       "chrome_version_info_mac.mm",
81     ]
82   } else {
83     # Non-iOS.
84     deps += [
85       "//components/visitedlink/common",
86       "//components/autofill/content/common",
87       "//components/autofill/core/common",
88       "//components/password_manager/content/common",
89       "//components/password_manager/core/common",
90       "//components/signin/core/common",
91       "//components/translate/content/common",
92       "//ipc",
93       "//third_party/re2",
94       "//third_party/widevine/cdm:version_h",
95     ]
96   }
98   if (enable_extensions) {
99     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
100                            ".",
101                            "//chrome")
102     deps += [
103       "//device/usb",
104       "//chrome/common/extensions/api",
105       "//extensions/common",
106       "//extensions/common/api",
107       "//extensions:extensions_resources",
108       "//extensions/strings",
109       "//media/cast:net",
110     ]
111   }
113   if (is_win || is_mac) {
114     sources +=
115         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
116     deps += [ "//breakpad:client" ]
117   }
118   if (is_win || is_mac || is_chromeos) {
119     if (use_openssl) {
120       sources += rebase_path(
121               gypi_values.chrome_common_networking_private_sources_openssl,
122               ".",
123               "//chrome")
125       # networking_private_crypto_openssl.cc depends on boringssl.
126       deps += [ "//third_party/boringssl" ]
127     } else {
128       sources +=
129           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
130                       ".",
131                       "//chrome")
132     }
133   }
134   if (is_mac) {
135     sources +=
136         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
137   }
139   if (enable_nacl) {
140     deps += [
141       #'<(DEPTH)/components/nacl.gyp:nacl_common',  TODO(GYP)
142     ]
143   }
145   # Printing.
146   if (enable_basic_printing || enable_print_preview) {
147     deps += [
148       "//components/printing/common:printing_common",
149       "//printing",
150     ]
151     if (enable_print_preview) {
152       # Full printing support.
153       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
154                              ".",
155                              "//chrome")
156     }
157   }
159   if (enable_service_discovery) {
160     sources += [
161       "local_discovery/service_discovery_client.cc",
162       "local_discovery/service_discovery_client.h",
163     ]
164   }
165   if (enable_mdns) {
166     sources += [
167       "local_discovery/service_discovery_client_impl.cc",
168       "local_discovery/service_discovery_client_impl.h",
169     ]
170   }
172   if (is_android) {
173     sources -= [
174       "badge_util.cc",
175       "chrome_version_info_posix.cc",
176       "icon_with_badge_image_source.cc",
177       "media_galleries/metadata_types.h",
178       "spellcheck_common.cc",
179     ]
180   } else {
181     # Non-Android.
182     sources +=
183         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
184   }
186   if (is_chromeos) {
187     sources -= [ "chrome_version_info_posix.cc" ]
188   }
190   if (is_win) {
191     deps += [ "//third_party/wtl" ]
192   }
194   if (enable_mdns) {
195     sources += [ "local_discovery/local_discovery_messages.h" ]
196   }
198   if (is_mac) {
199     sources -= [ "chrome_version_info_posix.cc" ]
200     deps += [
201       "//third_party/mach_override",
202       "//third_party/google_toolbox_for_mac",
203     ]
204   }
206   if (enable_plugins) {
207     sources += [
208       "pepper_flash.cc",
209       "pepper_flash.h",
210     ]
211     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
212   }
213   if (enable_plugins && enable_extensions) {
214     sources += [
215       "pepper_permission_util.cc",
216       "pepper_permission_util.h",
217     ]
218   }
219   if (!enable_webrtc) {
220     sources -= [ "media/webrtc_logging_messages.h" ]
221   }
222   if (enable_configuration_policy) {
223     deps += [ "//components/policy" ]
224   }
226   if (safe_browsing_mode == 1) {
227     defines += [ "FULL_SAFE_BROWSING" ]
228     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
229                            ".",
230                            "//chrome")
231   }
232   if (safe_browsing_mode == 2) {
233     defines += [ "MOBILE_SAFE_BROWSING" ]
234   }
237 import("//chrome/version.gni")
238 process_version("version") {
239   visibility = [ ":common" ]
240   source = "chrome_version_info_values.h.version"
241   output = "$target_gen_dir/chrome_version_info_values.h"
244 process_version("make_chrome_version") {
245   source = "chrome_version.cc.version"
246   output = "$target_gen_dir/chrome_version.cc"
249 # GN version: chrome/common_constants.gyp:common_constants
250 static_library("constants") {
251   sources = [
252     "chrome_constants.cc",
253     "chrome_constants.h",
254     "chrome_icon_resources_win.cc",
255     "chrome_icon_resources_win.h",
256     "chrome_paths.cc",
257     "chrome_paths.h",
258     "chrome_paths_android.cc",
259     "chrome_paths_internal.h",
260     "chrome_paths_linux.cc",
261     "chrome_paths_mac.mm",
262     "chrome_paths_win.cc",
263     "chrome_switches.cc",
264     "chrome_switches.h",
265     "env_vars.cc",
266     "env_vars.h",
267     "net/test_server_locations.cc",
268     "net/test_server_locations.h",
269     "pref_font_script_names-inl.h",
270     "pref_font_webkit_names.h",
271     "pref_names.cc",
272     "pref_names.h",
273     "widevine_cdm_constants.cc",
274     "widevine_cdm_constants.h",
275   ]
276   sources += get_target_outputs(":make_chrome_version")
278   deps = [
279     ":make_chrome_version",
280     "//base",
281     "//base/third_party/dynamic_annotations",
282     "//components/bookmarks/common",
283     "//third_party/widevine/cdm:version_h",
284   ]
286   if (enable_nacl) {
287     deps += [
288       #'../components/nacl.gyp:nacl_switches',  TODO(GYP)
289     ]
290   }
293 source_set("test_support") {
294   testonly = true
295   visibility = [ "//chrome/test:test_support" ]
297   sources = []
299   deps = [
300     ":common",
301     "//base",
302     "//testing/gtest",
303   ]
305   if (is_win || is_mac) {
306     sources += [
307       "media_galleries/picasa_test_util.cc",
308       "media_galleries/picasa_test_util.h",
309       "media_galleries/pmp_test_util.cc",
310       "media_galleries/pmp_test_util.h",
311     ]
312   }
314   if (enable_extensions) {
315     sources += [
316       "extensions/extension_test_util.cc",
317       "extensions/extension_test_util.h",
318     ]
319   }