Update mojo surfaces bindings and mojo/cc/ glue
[chromium-blink-merge.git] / chrome / browser / BUILD.gn
blobd0218204fc528d29b0c188295bc860b36119db7e
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("//components/nacl/nacl_defines.gni")
9 import("//tools/grit/grit_rule.gni")
11 about_credits_file = "$target_gen_dir/about_credits.html"
12 additional_modules_list_file =
13     "$root_gen_dir/chrome/browser/internal/additional_modules_list.txt"
15 gypi_values = exec_script(
16     "//build/gypi_to_gn.py",
17     [ rebase_path("../chrome_browser.gypi") ],
18     "scope",
19     [ "../chrome_browser.gypi" ])
21 static_library("browser") {
22   configs += [ "//build/config/compiler:wexit_time_destructors" ]
23   defines = []
24   sources = []
25   libs = []
26   ldflags = []
28   # iOS/non-iOS shared deps. New dependencies should generally be added in the
29   # non-iOS deps below.
30   deps = [
31     "//base/allocator",
32     "//chrome:extra_resources",
33     "//chrome:resources",
34     "//chrome:strings",
35     "//chrome/app:generated_resources_map",
36     "//chrome/app/resources:platform_locale_settings",
37     "//chrome/app/theme:theme_resources",
38     "//chrome/browser/history:in_memory_url_index_cache_proto",
39     "//chrome/browser/net:cert_logger_proto",
40     "//chrome/browser/net:probe_message_proto",
41     "//chrome/browser/ui",
42     "//chrome/common",
43     "//chrome/common/net",
44     "//components/autofill/core/browser",
45     "//components/bookmarks/browser",
46     "//components/captive_portal",
47     "//components/cloud_devices/common",
48     "//components/component_updater",
49     "//components/content_settings/core/common",
50     "//components/crx_file",
51     "//components/data_reduction_proxy/browser",
52     "//components/domain_reliability",
53     "//components/favicon_base",
54     "//components/favicon/core",
55     "//components/feedback",
56     "//components/gcm_driver",
57     "//components/google/core/browser",
58     "//components/history/core/browser",
59     "//components/history/core/common",
60     "//components/infobars/core",
61     "//components/invalidation",
62     "//components/metrics:net",
63     "//components/metrics/proto:proto",
64     "//components/navigation_metrics",
65     "//components/network_time",
66     "//components/omaha_query_params",
67     "//components/omnibox",
68     "//components/os_crypt",
69     "//components/password_manager/core/browser",
70     "//components/password_manager/core/common",
71     "//components/policy:policy_component",
72     "//components/precache/core",
73     "//components/query_parser",
74     "//components/rappor",
75     "//components/renderer_context_menu",
76     "//components/search",
77     "//components/search_engines",
78     "//components/search_provider_logos",
79     "//components/signin/core/browser",
80     "//components/startup_metric_utils",
81     "//components/strings",
82     "//components/suggestions",
83     "//components/sync_driver",
84     "//components/translate/core/browser",
85     "//components/translate/core/common",
86     "//components/url_fixer",
87     "//components/user_prefs",
88     "//components/webdata/common",
89     "//content/public/browser",
90     "//content/public/common",
91     "//courgette:courgette_lib",
92     "//crypto",
93     "//google_apis",
94     "//jingle:notifier",
95     "//skia",
96     "//sql",
97     "//sync",
98     "//third_party/cacheinvalidation",
99     "//third_party/icu",
100     "//third_party/libxml",
101     "//third_party/libjingle",
102     "//third_party/widevine/cdm:version_h",
103     "//third_party/zlib",
104     "//third_party/zlib:minizip",
105     "//third_party/zlib:zip",
106     "//ui/base",
107     "//ui/events",
108     "//ui/gfx",
109     "//ui/gfx/geometry",
110     "//ui/message_center",
111     "//ui/shell_dialogs",
112     "//ui/strings",
113     "//ui/resources",
114   ]
116   forward_dependent_configs_from = [
117     "//components/autofill/core/browser",
118     "//content/public/browser",
119     "//sql",
120     "//sync",
121   ]
123   if (!is_ios) {
124     sources += rebase_path(gypi_values.chrome_browser_non_ios_sources,
125                            ".", "//chrome")
126     #TODO(GYP) Add these sources:
127     #        # These files are generated by GRIT.
128     #        '<(grit_out_dir)/grit/component_extension_resources_map.cc',
129     #        '<(grit_out_dir)/grit/theme_resources_map.cc',
130     #        '<(SHARED_INTERMEDIATE_DIR)/ui/resources/grit/ui_resources_map.cc',
131     #
132     #        # This file is generated by
133     #        # chrome/browser/metrics/variations/generate_resources_map.py
134     #        '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/metrics/variations/generated_resources_map.cc',
136     defines = nacl_defines
138     # TODO(GYP) remove this when the real webrtc target is used below.
139     configs += [ "//content:webrtc_stub_config" ]
141     deps += [
142       "//apps",
143       "//cc",
144       "//chrome/browser/devtools",
145       "//chrome/browser/performance_monitor",
146       "//chrome/common/extensions/api:api",
147       "//chrome/installer/util",
148       "//components/autofill/content/browser",
149       "//components/dom_distiller/content",
150       "//components/keyed_service/content",
151       "//components/navigation_interception",
152       "//components/password_manager/content/browser",
153       "//components/precache/content",
154       "//components/sessions",
155       "//components/storage_monitor",
156       "//components/translate/content/browser",
157       "//components/url_matcher",
158       "//components/usb_service",
159       "//components/visitedlink/browser",
160       "//components/visitedlink/common",
161       "//components/web_modal",
162       "//content/app/resources",
163       "//media",
164       "//media/cast:net",
165       "//mojo/environment:chromium",
166       "//mojo/public/cpp/bindings",
167       "//mojo/public/js/bindings",
168       "//mojo/system",
169       "//net:net_with_v8",
170       "//third_party/WebKit/public:resources",
171       "//third_party/adobe/flash:flapper_version_h",
172       "//third_party/expat",
173       "//third_party/leveldatabase",
174       "//third_party/libaddressinput",
175       "//third_party/libyuv",
176       "//third_party/npapi",
177       "//third_party/re2",
178       "//third_party/smhasher:cityhash",
179       "//ui/gl",
180       "//ui/surface",
181       "//ui/web_dialogs",
182       "//v8",
183       "//webkit/browser:storage",
184       "//webkit/common",
185       "//webkit/common:storage",
186       ## TODO(tonyg): Remove this dependency (crbug.com/280157).
187       #"../testing/perf/perf_test.gyp:*",  TODO(GYP)
188       # Note: for this one also remove the webrtc_stub_config
189       #"../third_party/webrtc/modules/modules.gyp:desktop_capture",  TODO(GYP)
190     ]
191   } else {  # iOS
192     sources += rebase_path(gypi_values.chrome_browser_ios_sources,
193                           ".", "//chrome")
194     deps += [
195       "//net",
196     ]
197     libs += [
198       "CoreTelephony.framework",
199       "CoreText.framework",
200       "MobileCoreServices.framework",
201       "QuartzCore.framework",
202     ]
203     ldflags += [ "-weak_framework", "CoreImage" ]
204   }
206   if (is_win || is_mac) {
207     sources += rebase_path(gypi_values.chrome_browser_win_mac_sources,
208                            ".", "//chrome")
209   }
210   if (!is_android && !is_ios && !is_chromeos && enable_configuration_policy) {
211     sources += [
212       "net/disk_cache_dir_policy_handler.cc",
213       "net/disk_cache_dir_policy_handler.h",
214     ]
215   }
216   if (!is_android && !is_ios && enable_configuration_policy) {
217     sources += [
218       "download/download_dir_policy_handler.cc",
219       "download/download_dir_policy_handler.h",
220     ]
221   }
222   if (is_mac) {
223     sources += rebase_path(gypi_values.chrome_browser_mac_sources,
224                            ".", "//chrome")
225     deps += [
226       #"app_shim"  TODO(GYP)
227     ]
228   }
229   if (cld2_data_source == "component") {
230     sources += [
231       "component_updater/cld_component_installer.cc",
232       "component_updater/cld_component_installer.h",
233     ]
234   }
235   if (enable_extensions) {
236     deps += [
237       "//chrome/browser/extensions",
238       "//chrome/browser/sync_file_system/drive_backend:sync_file_system_drive_proto",
239     ]
240     sources += rebase_path(gypi_values.chrome_browser_extensions_sources,
241                            ".", "//chrome")
242   }
243   if (enable_background) {
244     sources += rebase_path(gypi_values.chrome_browser_background_sources,
245                            ".", "//chrome")
246     if (!use_aura || is_win) {
247       sources -= [ "background/background_mode_manager_aura.cc" ]
248     }
249   }
250   if (enable_task_manager) {
251     sources += rebase_path(gypi_values.chrome_browser_task_manager_sources,
252                            ".", "//chrome")
253   }
254   if (enable_spellcheck) {
255     sources += rebase_path(gypi_values.chrome_browser_spellchecker_sources,
256                            ".", "//chrome")
257     deps += [ "//third_party/hunspell" ]
258   }
259   if (enable_nacl) {
260     sources += rebase_path(gypi_values.chrome_browser_nacl_sources,
261                            ".", "//chrome")
262     #deps += [ "//components/nacl:nacl_browser" ]  TODO(GYP)
263   }
264   # ["debug_devtools==1", {  TODO(GYP)
265   #   "defines": [
266   #     "DEBUG_DEVTOOLS=1",
267   # ],
268   if (enable_configuration_policy) {
269     sources += rebase_path(
270         gypi_values.chrome_browser_policy_shared_with_ios_sources,
271         ".", "//chrome")
272     deps += [
273       "//components/policy",
274       "//components/policy/proto",
275     ]
276     if (!is_ios) {
277       sources += rebase_path(
278           gypi_values.chrome_browser_policy_non_ios_sources,
279           ".", "//chrome")
280     }
281     if (!is_chromeos) {
282       sources += rebase_path(
283           gypi_values.chrome_browser_policy_shared_with_ios_not_chromeos_sources,
284           ".", "//chrome")
285     }
286     if (is_win || is_mac || is_desktop_linux) {
287       sources += rebase_path(gypi_values.chrome_browser_policy_desktop_sources,
288                              ".", "//chrome")
289     }
290     if (is_android || is_ios) {
291       sources += rebase_path(gypi_values.chrome_browser_mobile_sources,
292                              ".", "//chrome")
293     } else {  # Non-mobile
294       deps += [
295         #"policy_path_parser",  TODO(GYP)
296       ]
297     }
298   } else {
299     # Configuration policy disabled.
300     sources += rebase_path(gypi_values.chrome_browser_policy_disabled_sources,
301                            ".", "//chrome")
302   }
304   if (enable_plugins) {
305     sources += rebase_path(gypi_values.chrome_browser_plugins_sources,
306                            ".", "//chrome")
307     deps += [
308       "//ppapi:ppapi_ipc",
309     ]
310   }
311   if (safe_browsing_mode != 0) {
312     sources += rebase_path(
313         gypi_values.chrome_browser_basic_safe_browsing_sources,
314         ".", "//chrome")
315     deps += [
316       "//chrome/browser/safe_browsing:chunk_proto",
317       "//chrome/browser/safe_browsing:report_proto",
318     ]
319     if (safe_browsing_mode == 1) {
320       sources += rebase_path(
321           gypi_values.chrome_browser_full_safe_browsing_sources,
322           ".", "//chrome")
323       defines += [ "FULL_SAFE_BROWSING" ]
324       deps += [
325         "//chrome/common/safe_browsing:proto",
326       ]
327     } else if (safe_browsing_mode == 2) {
328       defines += [ "MOBILE_SAFE_BROWSING" ]
329     }
330   }
332   if (is_linux) {
333     configs += [ "//build/config/linux:udev" ]
334     deps += [ "//device/media_transfer_protocol" ]
335   }
336   if (is_linux && !is_chromeos) {
337     deps += [ "//third_party/speech-dispatcher" ]
338   }
340   if (is_chromeos) {
341     sources += rebase_path(gypi_values.chrome_browser_chromeos_sources,
342                            ".", "//chrome")
343     deps += [
344       #"browser_chromeos",  TODO(GYP)
345     ]
346   } else {
347     # Non-ChromeOS.
348     sources += rebase_path(gypi_values.chrome_browser_non_chromeos_sources,
349                            ".", "//chrome")
350   }
352   if (use_cups) {
353     configs += [ "//printing:cups" ]
354   }
355   if (is_desktop_linux) {
356     sources += rebase_path(gypi_values.chrome_browser_gnome_keyring_sources,
357                            ".", "//chrome")
358     configs += [ "//build/config/linux:gnome_keyring" ]
359   }
360   if (use_aura) {
361     sources += rebase_path(gypi_values.chrome_browser_aura_sources,
362                            ".", "//chrome")
363     deps += [
364       "//ui/aura",
365       "//ui/compositor",
366       "//ui/keyboard",
367     ]
368   }
369   if (ui_compositor_image_transport) {
370     deps += [ "//ui/gl" ]
371   }
373   if (use_ash) {
374     sources += rebase_path(gypi_values.chrome_browser_ash_sources,
375                            ".", "//chrome")
376   }
378   if (use_x11) {
379     sources += rebase_path(gypi_values.chrome_browser_x11_sources,
380                            ".", "//chrome")
381     if (!is_chromeos) {
382       configs += [ "//build/config/linux:xscrnsaver" ]
383     }
384   }
385   if (is_posix && !is_mac && !is_ios) {
386     sources += [
387       "//chrome/app/chrome_breakpad_client.cc",
388       "//chrome/app/chrome_breakpad_client.h",
389     ]
390     deps += [
391       "//components/breakpad/app",
392       "//components/breakpad/browser",
393     ]
394   }
395   if (use_nss_certs) {
396     sources += rebase_path(gypi_values.chrome_browser_nss_sources,
397                            ".", "//chrome")
398   }
399   if (enable_notifications) {
400     sources += rebase_path(gypi_values.chrome_browser_notifications_sources,
401                            ".", "//chrome")
402     if (!is_android) {
403       sources += rebase_path(
404           gypi_values.chrome_browser_non_android_notifications_sources,
405           ".", "//chrome")
406     }
407   }
408   if (enable_themes) {
409     sources += rebase_path(gypi_values.chrome_browser_themes_sources,
410                            ".", "//chrome")
411   }
413   if (printing_mode != 0) {
414     # Some form of printing support.
415     sources += rebase_path(gypi_values.chrome_browser_basic_printing_sources,
416                            ".", "//chrome")
417     deps += [
418       "//printing",
419     ]
420     if (is_win && win_pdf_metafile_for_printing) {
421       sources += rebase_path(gypi_values.chrome_browser_printing_emf_sources,
422                              ".", "//chrome")
423     }
424     if (printing_mode == 1) {
425       # Full printing on top of the above.
426       sources += rebase_path(gypi_values.chrome_browser_full_printing_sources,
427                              ".", "//chrome")
428     } else if (printing_mode == 2) {
429       # Partial-only printing support.
430       sources += rebase_path(
431           gypi_values.chrome_browser_basic_only_printing_sources,
432           ".", "//chrome")
433     }
434   }
435   if (enable_captive_portal_detection) {
436     sources += rebase_path(gypi_values.chrome_browser_captive_portal_sources,
437                            ".", "//chrome")
438   }
439   if (enable_session_service) {
440     sources += rebase_path(gypi_values.chrome_browser_session_service_sources,
441                            ".", "//chrome")
442   }
444   if (is_android || is_ios) {
445     # Mobile.
446     sources += rebase_path(gypi_values.chrome_browser_mobile_sources,
447                            ".", "//chrome")
448   } else {
449     # Non-mobile.
450     sources += rebase_path(gypi_values.chrome_browser_non_mobile_sources,
451                            ".", "//chrome")
452   }
454   if (is_android) {
455     sources += rebase_path(gypi_values.chrome_browser_android_sources,
456                            ".", "//chrome")
457     deps += [
458       "//components/cdm/browser",
459       #"../components/components.gyp:web_contents_delegate_android",  TODO(GYP)
460       #"chrome_browser_jni_headers",  TODO(GYP)
461     ]
462     deps -= [
463       "//third_party/libaddressinput",
464       "//components/feedback",
465       "//components/storage_monitor",
466       "//components/usb_service",
467       "//components/web_modal",
468     ]
469   } else {
470     sources += rebase_path(gypi_values.chrome_browser_non_android_sources,
471                            ".", "//chrome")
472   }
474   if (is_mac) {
475     deps += [
476       "//third_party/google_toolbox_for_mac",
477       #"../third_party/mozilla/mozilla.gyp:mozilla",  TODO(GYP)
478     ]
479     libs += [
480       "Accelerate.framework",
481       "AddressBook.framework",
482       "AudioUnit.framework",
483       "DiskArbitration.framework",
484       "IOKit.framework",
485       "ImageCaptureCore.framework",
486       "OpenGL.framework",
487       "QuartzCore.framework",
488       "SecurityInterface.framework",
489     ]
490   }
492   if (enable_rlz) {
493     sources += rebase_path(gypi_values.chrome_browser_rlz_sources,
494                            ".", "//chrome")
495     deps += [ "//rlz:rlz_lib" ]
496   }
498   # TODO(GYP)
499   # Temporary fix to break the browser target into smaller chunks so it
500   # will link with goma builds.
501   #["OS=="win" and chromium_win_pch==0", {
502   #  "msvs_shard": 4,
503   #}],
505   if (is_win) {
506     sources += rebase_path(gypi_values.chrome_browser_win_sources,
507                            ".", "//chrome")
508     deps += [
509       "//chrome:version_header",
510       "//chrome/installer/util:strings",
511       "//third_party/iaccessible2",
512       "//third_party/isimpledom",
513       "//third_party/wtl",
514       "//ui/views",
515       "//ui/views/controls/webview",
516       #"chrome_process_finder",  TODO(GYP)
517       #"../chrome_elf/chrome_elf.gyp:chrome_elf",  TODO(GYP)
518       #"../chrome_elf/chrome_elf.gyp:chrome_elf_constants",  TODO(GYP)
519       #"../chrome_elf/chrome_elf.gyp:dll_hash",  TODO(GYP)
520       #"../google_update/google_update.gyp:google_update",  TODO(GYP)
521       #"../ui/metro_viewer/metro_viewer.gyp:metro_viewer_messages",  TODO(GYP)
522       #"../win8/win8.gyp:metro_viewer",  TODO(GYP)
523     ]
524     forward_dependent_configs_from += [
525       "//ui/views",
526       "//ui/views/controls/webview",
527     ]
528   } else {
529     # Non-Windows.
530     sources += rebase_path(gypi_values.chrome_browser_non_win_sources,
531                            ".", "//chrome")
532     if (toolkit_views) {
533       deps += [
534       "//ui/views",
535       "//ui/views/controls/webview",
536       ]
537       # TODO(GYP) why is this needed? Very susicious.
538       #  "include_dirs": [
539       #    "<(INTERMEDIATE_DIR)/chrome",
540       #  ],
541     }
542   }
544   if (is_linux) {
545     sources += rebase_path(gypi_values.chrome_browser_linux_sources,
546                            ".", "//chrome")
547     if (use_aura) {
548       configs += [
549         "//build/config/linux:dbus",
550         "//build/config/linux:fontconfig",
551       ]
552       deps += [
553         "//dbus",
554       ]
555     }
556     if (use_x11) {
557       configs += [ "//build/config/linux:x11" ]
558       deps += [ "//ui/gfx/x" ]
559     }
560   }
562   if (is_desktop_linux) {
563     sources += rebase_path(gypi_values.chrome_browser_desktop_linux_sources,
564                            ".", "//chrome")
565   }
566   if (enable_plugin_installation) {
567     sources += rebase_path(
568         gypi_values.chrome_browser_plugin_installation_sources,
569         ".", "//chrome")
570   }
571   if (enable_app_list) {
572     deps += [
573       "//ui/app_list",
574     ]
575   }
576   if (enable_managed_users) {
577     sources += rebase_path(
578         gypi_values.chrome_browser_supervised_user_sources,
579         ".", "//chrome")
580   }
581   if (enable_webrtc) {
582     sources += rebase_path(
583         gypi_values.chrome_browser_webrtc_sources,
584         ".", "//chrome")
585   }
586   if (enable_service_discovery) {
587     sources += rebase_path(
588         gypi_values.chrome_browser_service_discovery_sources,
589         ".", "//chrome")
590   }
591   if (enable_mdns) {
592     sources += rebase_path(
593         gypi_values.chrome_browser_mdns_sources,
594         ".", "//chrome")
595   }
596   if (!enable_autofill_dialog || is_android || is_ios) {
597     sources -= [
598       "autofill/validation_rules_storage_factory.cc",
599       "autofill/validation_rules_storage_factory.h",
600     ]
601   }
602   if (enable_wifi_bootstrapping) {
603     sources += rebase_path(
604         gypi_values.chrome_browser_wifi_bootstrapping_sources,
605         ".", "//chrome")
606     if (is_win || is_mac) {
607       # TODO(brettw) as of this writing wifi bootstrapping is set on Windows
608       # and Mac, so this test is meaningless. Can we merge these lists?
609       sources += rebase_path(
610           gypi_values.chrome_browser_win_mac_wifi_bootstrapping_sources,
611           ".", "//chrome")
612     }
613   }
616 # GYP version: chrome/chrome_resources.gyp:chrome_resources
617 # (generate_browser_resources action)
618 grit("resources") {
619   source = "browser_resources.grd"
620   output_dir = "$root_gen_dir/chrome"
621   outputs = [
622     "grit/browser_resources.h",
623     "browser_resources.pak",
624   ]
626   omnibox_mojom_file = "$root_gen_dir/chrome/browser/ui/webui/omnibox/omnibox.mojom.js"
628   grit_flags = [
629     "-E", "about_credits_file=" +
630           rebase_path(about_credits_file, root_build_dir),
631     "-E", "additional_modules_list_file=" +
632           rebase_path(additional_modules_list_file, root_build_dir),
633     "-E", "omnibox_mojom_file=" +
634           rebase_path(omnibox_mojom_file, root_build_dir),
635   ]
637   deps = [
638     ":about_credits",
639     ":chrome_internal_resources_gen",
640     "//chrome/browser/ui/webui/omnibox:mojo_bindings",
641   ]
644 # GYP version: chrome/chrome_resource.gyp:about_credits
645 action("about_credits") {
646   script = "//tools/licenses.py"
648   # TODO(phajdan.jr): input dependencies so this can be regenerated
649   # automatically when one of the credits changes. The way this should work is
650   # that licenses.py should write a .d file listing the input dependencies (see
651   # "depfile" in GN).
652   outputs = [ about_credits_file ]
654   args = [
655     "credits",
656     rebase_path(about_credits_file, root_build_dir),
657   ]
660 # GYP version: chrome/chrome_resource.gyp:chrome_internal_resources_gen
661 # TODO(GYP) write internal action
662 if (false) {  #if (is_chrome_branded) {
663   action("chrome_internal_resources_gen") {
664     # TODO(GYP)
665   }
666 } else {
667   group("chrome_internal_resources_gen") {
668     # Empty placeholder.
669   }