Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / BUILD.gn
blobf828c23d8b630cb3d74eee6a1a06ec2e31e36caf
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")
9 # //build/config/android/rules.gni imports //tools/grit/grit_rule.gni, which
10 # produces a conflict for the "grit" template so we have to only include one.
11 if (is_android) {
12   import("//build/config/android/rules.gni")
13 } else {
14   import("//tools/grit/grit_rule.gni")
16 if (is_desktop_linux) {
17   import("//build/config/linux/pkg_config.gni")
20 about_credits_file = "$target_gen_dir/about_credits.html"
21 additional_modules_list_file =
22     "$root_gen_dir/chrome/browser/internal/additional_modules_list.txt"
24 gypi_values = exec_script("//build/gypi_to_gn.py",
25                           [ rebase_path("../chrome_browser.gypi") ],
26                           "scope",
27                           [ "../chrome_browser.gypi" ])
29 if (is_desktop_linux) {
30   # Gnome-keyring is normally dynamically loaded. The gnome_keyring config
31   # will set this up.
32   pkg_config("gnome_keyring") {
33     packages = [ "gnome-keyring-1" ]
34     defines = [
35       "USE_GNOME_KEYRING",
36       "DLOPEN_GNOME_KEYRING",
37     ]
38     ignore_libs = true
39   }
41   # If you want to link gnome-keyring directly (use only for unit tests)
42   # ADDITIONALLY add this config on top of ":gnome_keyring". pkg-config is a
43   # bit slow, so prefer not to run it again. In practice, gnome-keyring's libs
44   # are just itself and common gnome ones we link already, so we can get away
45   # with additionally just coding the library name here.
46   config("gnome_keyring_direct") {
47     libs = [ "gnome-keyring" ]
48   }
51 static_library("browser") {
52   configs += [
53     "//build/config/compiler:wexit_time_destructors",
54     "//third_party/WebKit/public:debug_devtools",
55   ]
56   defines = []
57   sources = []
58   libs = []
59   ldflags = []
61   # iOS/non-iOS shared deps. New dependencies should generally be added in the
62   # non-iOS deps below.
63   public_deps = [
64     "//components/autofill/core/browser",
65     "//content/public/browser",
66     "//sql",
67     "//sync",
68   ]
69   deps = [
70     "//base/allocator",
71     "//chrome:extra_resources",
72     "//chrome:resources",
73     "//chrome:strings",
74     "//chrome/app:generated_resources_map",
75     "//chrome/app/resources:platform_locale_settings",
76     "//chrome/app/theme:theme_resources",
77     "//chrome/browser/autocomplete:in_memory_url_index_cache_proto",
78     "//chrome/browser/net:cert_logger_proto",
79     "//chrome/browser/net:probe_message_proto",
80     "//chrome/browser/ui",
81     "//chrome/common",
82     "//chrome/common/net",
83     "//components/autofill/core/browser",
84     "//components/bookmarks/browser",
85     "//components/bookmarks/managed",
86     "//components/captive_portal",
87     "//components/cloud_devices/common",
88     "//components/component_updater",
89     "//components/content_settings/core/browser",
90     "//components/content_settings/core/common",
91     "//components/crx_file",
92     "//components/data_reduction_proxy/core/browser",
93     "//components/device_event_log",
94     "//components/domain_reliability",
95     "//components/enhanced_bookmarks",
96     "//components/favicon/core",
97     "//components/favicon_base",
98     "//components/gcm_driver",
99     "//components/google/core/browser",
100     "//components/handoff",
101     "//components/history/core/browser",
102     "//components/history/core/common",
103     "//components/infobars/core",
104     "//components/invalidation",
105     "//components/metrics:gpu",
106     "//components/metrics:net",
107     "//components/metrics:profiler",
108     "//components/metrics/proto:proto",
109     "//components/navigation_metrics",
110     "//components/network_time",
111     "//components/omnibox",
112     "//components/os_crypt",
113     "//components/packed_ct_ev_whitelist",
114     "//components/password_manager/core/browser",
115     "//components/password_manager/core/common",
116     "//components/policy:policy_component",
117     "//components/precache/core",
118     "//components/query_parser",
119     "//components/rappor",
120     "//components/renderer_context_menu",
121     "//components/search",
122     "//components/search_engines",
123     "//components/search_provider_logos",
124     "//components/signin/core/browser",
125     "//components/startup_metric_utils",
126     "//components/strings",
127     "//components/suggestions",
128     "//components/sync_driver",
129     "//components/translate/core/browser",
130     "//components/translate/core/common",
131     "//components/ui/zoom:ui_zoom",
132     "//components/update_client",
133     "//components/url_fixer",
134     "//components/user_prefs",
135     "//components/variations",
136     "//components/variations/net",
137     "//components/webdata/common",
138     "//components/webdata_services",
139     "//components/web_resource",
140     "//content/public/browser",
141     "//content/public/common",
142     "//courgette:courgette_lib",
143     "//crypto",
144     "//google_apis",
145     "//gpu/config",
146     "//jingle:notifier",
147     "//skia",
148     "//sql",
149     "//sync",
150     "//third_party/cacheinvalidation",
151     "//third_party/icu",
152     "//third_party/libxml",
153     "//third_party/libjingle",
154     "//third_party/widevine/cdm:version_h",
155     "//third_party/zlib",
156     "//third_party/zlib:minizip",
157     "//third_party/zlib:zip",
158     "//ui/base",
159     "//ui/events:events_base",
160     "//ui/gfx",
161     "//ui/gfx/geometry",
162     "//ui/message_center",
163     "//ui/shell_dialogs",
164     "//ui/strings",
165     "//ui/resources",
166   ]
168   sources +=
169       rebase_path(gypi_values.chrome_browser_undo_sources, ".", "//chrome")
171   if (!is_ios) {
172     sources +=
173         rebase_path(gypi_values.chrome_browser_non_ios_sources, ".", "//chrome")
174     sources += rebase_path(gypi_values.chrome_browser_autocomplete_sources,
175                            ".",
176                            "//chrome")
177     sources += rebase_path(gypi_values.chrome_browser_bookmark_sources,
178                            ".",
179                            "//chrome")
180     sources += rebase_path(gypi_values.chrome_browser_browser_process_sources,
181                            ".",
182                            "//chrome")
183     sources += rebase_path(gypi_values.chrome_browser_content_settings_sources,
184                            ".",
185                            "//chrome")
186     sources +=
187         rebase_path(gypi_values.chrome_browser_favicon_sources, ".", "//chrome")
188     sources +=
189         rebase_path(gypi_values.chrome_browser_google_sources, ".", "//chrome")
190     sources +=
191         rebase_path(gypi_values.chrome_browser_history_sources, ".", "//chrome")
192     sources +=
193         rebase_path(gypi_values.chrome_browser_metrics_sources, ".", "//chrome")
194     sources +=
195         rebase_path(gypi_values.chrome_browser_net_sources, ".", "//chrome")
196     sources += rebase_path(gypi_values.chrome_browser_password_manager_sources,
197                            ".",
198                            "//chrome")
199     sources += rebase_path(gypi_values.chrome_browser_permissions_sources,
200                            ".",
201                            "//chrome")
202     sources += rebase_path(gypi_values.chrome_browser_predictor_sources,
203                            ".",
204                            "//chrome")
205     sources +=
206         rebase_path(gypi_values.chrome_browser_pref_sources, ".", "//chrome")
207     sources += rebase_path(gypi_values.chrome_browser_profiles_sources,
208                            ".",
209                            "//chrome")
210     sources += rebase_path(gypi_values.chrome_browser_search_engines_sources,
211                            ".",
212                            "//chrome")
213     sources += rebase_path(gypi_values.chrome_browser_services_sources,
214                            ".",
215                            "//chrome")
216     sources +=
217         rebase_path(gypi_values.chrome_browser_session_sources, ".", "//chrome")
218     sources +=
219         rebase_path(gypi_values.chrome_browser_signin_sources, ".", "//chrome")
220     sources +=
221         rebase_path(gypi_values.chrome_browser_ssl_sources, ".", "//chrome")
222     sources +=
223         rebase_path(gypi_values.chrome_browser_sync_sources, ".", "//chrome")
224     sources += rebase_path(gypi_values.chrome_browser_web_resource_sources,
225                            ".",
226                            "//chrome")
228     deps += [
229       "//apps",
230       "//cc",
231       "//chrome/app:generated_resources_map",
232       "//chrome/app/theme:theme_resources",
233       "//chrome/browser/devtools",
234       "//chrome/browser/resources:component_extension_resources",
235       "//chrome/installer/util",
236       "//components/app_modal",
237       "//components/autofill/content/browser",
238       "//components/browsing_data",
239       "//components/data_reduction_proxy/content/browser",
240       "//components/dom_distiller/content",
241       "//components/favicon/content",
242       "//components/history/content/browser",
243       "//components/keyed_service/content",
244       "//components/navigation_interception",
245       "//components/password_manager/content/browser",
246       "//components/precache/content",
247       "//components/sessions:sessions_content",
248       "//components/storage_monitor",
249       "//components/translate/content/browser",
250       "//components/url_matcher",
251       "//components/visitedlink/browser",
252       "//components/visitedlink/common",
253       "//components/web_cache/browser",
254       "//components/web_modal",
255       "//content/app/resources",
256       "//media",
257       "//mojo/common",
258       "//mojo/environment:chromium",
259       "//net:extras",
260       "//net:net_with_v8",
261       "//storage/browser",
262       "//storage/common",
263       "//third_party/WebKit/public:image_resources",
264       "//third_party/WebKit/public:resources",
265       "//third_party/expat",
266       "//third_party/leveldatabase",
267       "//third_party/libaddressinput",
268       "//third_party/libyuv",
269       "//third_party/mojo/src/mojo/edk/system",
270       "//third_party/mojo/src/mojo/public/cpp/bindings",
271       "//third_party/mojo/src/mojo/public/js",
272       "//third_party/npapi",
273       "//third_party/re2",
274       "//third_party/smhasher:cityhash",
275       "//third_party/webrtc/modules/desktop_capture",
276       "//ui/base/ime",
277       "//ui/gl",
278       "//ui/resources",
279       "//ui/surface",
280       "//ui/web_dialogs",
281       "//v8",
282     ]
283   } else {  # iOS
284     sources +=
285         rebase_path(gypi_values.chrome_browser_ios_sources, ".", "//chrome")
286     sources +=
287         rebase_path(gypi_values.chrome_browser_google_sources, ".", "//chrome")
288     deps += [ "//net" ]
289     libs += [
290       "CoreTelephony.framework",
291       "CoreText.framework",
292       "MobileCoreServices.framework",
293       "QuartzCore.framework",
294     ]
295     ldflags += [
296       "-weak_framework",
297       "CoreImage",
298     ]
299   }
301   if (is_win || is_mac) {
302     sources +=
303         rebase_path(gypi_values.chrome_browser_win_mac_sources, ".", "//chrome")
304   }
305   if (!is_android && !is_ios && !is_chromeos && enable_configuration_policy) {
306     sources += [
307       "net/disk_cache_dir_policy_handler.cc",
308       "net/disk_cache_dir_policy_handler.h",
309     ]
310   }
311   if (!is_android && !is_ios && enable_configuration_policy) {
312     sources += [
313       "download/download_dir_policy_handler.cc",
314       "download/download_dir_policy_handler.h",
315     ]
316   }
317   if (is_mac) {
318     sources +=
319         rebase_path(gypi_values.chrome_browser_mac_sources, ".", "//chrome")
320     deps += [
321       #"app_shim"  TODO(GYP)
322       #"browser_app_shim"  TODO(GYP)
323     ]
324   }
325   if (enable_extensions) {
326     public_deps += [ "//chrome/browser/extensions" ]
327     deps += [
328       "//chrome/browser/sync_file_system/drive_backend:sync_file_system_drive_proto",
329       "//chrome/common/extensions/api",
330       "//chrome/common/extensions/api:api_registration",
331       "//components/proximity_auth/cryptauth",
332       "//extensions/components/javascript_dialog_extensions_client",
333       "//media/cast:net",
334     ]
335     sources += rebase_path(gypi_values.chrome_browser_extensions_sources,
336                            ".",
337                            "//chrome")
338   }
339   if (enable_background) {
340     sources += rebase_path(gypi_values.chrome_browser_background_sources,
341                            ".",
342                            "//chrome")
343     if (!use_aura || is_win || is_chromeos) {
344       sources -= [ "background/background_mode_manager_aura.cc" ]
345     }
346   }
347   if (enable_task_manager) {
348     sources += rebase_path(gypi_values.chrome_browser_task_manager_sources,
349                            ".",
350                            "//chrome")
351   }
352   if (enable_spellcheck) {
353     sources += rebase_path(gypi_values.chrome_browser_spellchecker_sources,
354                            ".",
355                            "//chrome")
356     deps += [ "//third_party/hunspell" ]
357   }
358   if (enable_nacl) {
359     sources +=
360         rebase_path(gypi_values.chrome_browser_nacl_sources, ".", "//chrome")
361     deps += [ "//components/nacl:nacl_browser" ]
362   }
364   if (enable_configuration_policy) {
365     sources +=
366         rebase_path(gypi_values.chrome_browser_policy_shared_with_ios_sources,
367                     ".",
368                     "//chrome")
369     deps += [
370       "//components/policy",
371       "//components/policy/proto",
372     ]
373     if (!is_ios) {
374       sources += rebase_path(gypi_values.chrome_browser_policy_non_ios_sources,
375                              ".",
376                              "//chrome")
377     }
378     if (!is_chromeos) {
379       sources += rebase_path(
380               gypi_values.chrome_browser_policy_shared_with_ios_not_chromeos_sources,
381               ".",
382               "//chrome")
383     }
384     if (is_win || is_mac || is_desktop_linux) {
385       sources += rebase_path(gypi_values.chrome_browser_policy_desktop_sources,
386                              ".",
387                              "//chrome")
388     }
389     if (is_android || is_ios) {
390       sources += rebase_path(gypi_values.chrome_browser_policy_mobile_sources,
391                              ".",
392                              "//chrome")
393     } else {
394       deps += [
395         "//chrome/browser/policy:path_parser",
396         "//net:net_browser_services",
397       ]
398     }
399   } else {
400     # Configuration policy disabled.
401     sources += rebase_path(gypi_values.chrome_browser_policy_disabled_sources,
402                            ".",
403                            "//chrome")
404   }
406   if (enable_plugins) {
407     sources +=
408         rebase_path(gypi_values.chrome_browser_plugins_sources, ".", "//chrome")
409     deps += [
410       "//components/pdf/browser",
411       "//ppapi/proxy:ipc",
412       "//third_party/adobe/flash:flapper_version_h",
413     ]
414   }
415   if (safe_browsing_mode != 0) {
416     sources +=
417         rebase_path(gypi_values.chrome_browser_safe_browsing_basic_sources,
418                     ".",
419                     "//chrome")
420     deps += [
421       "//chrome/browser/safe_browsing:chunk_proto",
422       "//chrome/browser/safe_browsing:metadata_proto",
423       "//chrome/browser/safe_browsing:report_proto",
424     ]
425     if (safe_browsing_mode == 1) {
426       sources +=
427           rebase_path(gypi_values.chrome_browser_safe_browsing_full_sources,
428                       ".",
429                       "//chrome")
430       defines += [ "FULL_SAFE_BROWSING" ]
431       deps += [ "//chrome/common/safe_browsing:proto" ]
432     } else if (safe_browsing_mode == 2) {
433       defines += [ "MOBILE_SAFE_BROWSING" ]
434     }
435   }
437   if (is_linux) {
438     deps += [
439       "//device/media_transfer_protocol",
440       "//device/udev_linux",
441     ]
442   }
443   if (is_linux && !is_chromeos) {
444     deps += [ "//third_party/speech-dispatcher" ]
445   }
447   if (is_chromeos) {
448     sources += rebase_path(gypi_values.chrome_browser_chromeos_sources,
449                            ".",
450                            "//chrome")
451     deps += [ "//chrome/browser/chromeos" ]
452   } else {
453     # Non-ChromeOS.
454     sources += rebase_path(gypi_values.chrome_browser_non_chromeos_sources,
455                            ".",
456                            "//chrome")
457   }
459   if (is_ios) {
460     sources -= [
461       "metrics/signin_status_metrics_provider_base.cc",
462       "metrics/signin_status_metrics_provider_base.h",
463     ]
464   }
466   if (is_chromeos || is_ios) {
467     sources -= [
468       "metrics/signin_status_metrics_provider.cc",
469       "metrics/signin_status_metrics_provider.h",
470     ]
471   }
473   if (use_cups) {
474     configs += [ "//printing:cups" ]
475   }
476   if (is_desktop_linux) {
477     sources += rebase_path(gypi_values.chrome_browser_gnome_keyring_sources,
478                            ".",
479                            "//chrome")
480     configs += [ ":gnome_keyring" ]
481   }
482   if (is_desktop_linux) {
483     sources += rebase_path(gypi_values.chrome_browser_libsecret_sources,
484                            ".",
485                            "//chrome")
486     defines += [ "USE_LIBSECRET" ]
487   }
488   if (use_aura) {
489     sources +=
490         rebase_path(gypi_values.chrome_browser_aura_sources, ".", "//chrome")
491     deps += [
492       "//ui/aura",
493       "//ui/compositor",
494       "//ui/keyboard",
495     ]
496   }
497   if (ui_compositor_image_transport) {
498     deps += [ "//ui/gl" ]
499   }
501   if (use_ash) {
502     sources +=
503         rebase_path(gypi_values.chrome_browser_ash_sources, ".", "//chrome")
504   }
506   if (use_x11) {
507     sources +=
508         rebase_path(gypi_values.chrome_browser_x11_sources, ".", "//chrome")
509   } else {
510     sources -= [ "password_manager/password_store_x.cc" ]
511   }
512   if (is_posix && !is_mac && !is_ios) {
513     sources += [
514       "//chrome/app/chrome_crash_reporter_client.cc",
515       "//chrome/app/chrome_crash_reporter_client.h",
516     ]
517     deps += [
518       "//components/crash/app",
519       "//components/crash/browser",
520     ]
521   }
522   if (use_nss_certs) {
523     sources +=
524         rebase_path(gypi_values.chrome_browser_nss_sources, ".", "//chrome")
525     if (is_chromeos) {
526       sources -= [ "net/nss_context_linux.cc" ]
527     }
528   }
529   if (enable_notifications) {
530     sources += rebase_path(gypi_values.chrome_browser_notifications_sources,
531                            ".",
532                            "//chrome")
533     if (!is_android) {
534       sources += rebase_path(
535               gypi_values.chrome_browser_notifications_non_android_sources,
536               ".",
537               "//chrome")
538     }
539   }
540   if (enable_themes) {
541     sources +=
542         rebase_path(gypi_values.chrome_browser_themes_sources, ".", "//chrome")
543   }
545   if (enable_basic_printing || enable_print_preview) {
546     # Some form of printing support.
547     sources += rebase_path(gypi_values.chrome_browser_printing_basic_sources,
548                            ".",
549                            "//chrome")
550     deps += [ "//printing" ]
551     if (is_win) {
552       sources += rebase_path(gypi_values.chrome_browser_printing_emf_sources,
553                              ".",
554                              "//chrome")
555     }
556     if (enable_print_preview) {
557       # Full printing on top of the above.
558       sources += rebase_path(gypi_values.chrome_browser_printing_full_sources,
559                              ".",
560                              "//chrome")
561     } else {
562       # Partial-only printing support.
563       sources +=
564           rebase_path(gypi_values.chrome_browser_printing_basic_only_sources,
565                       ".",
566                       "//chrome")
567     }
568   }
569   if (enable_captive_portal_detection) {
570     sources += rebase_path(gypi_values.chrome_browser_captive_portal_sources,
571                            ".",
572                            "//chrome")
573   }
574   if (enable_session_service) {
575     sources += rebase_path(gypi_values.chrome_browser_session_service_sources,
576                            ".",
577                            "//chrome")
578   }
580   if (!is_android && !is_ios && !is_chromeos) {
581     sources +=
582         rebase_path(gypi_values.chrome_browser_desktop_sources, ".", "//chrome")
583   }
585   if (is_android || is_ios) {
586     # Mobile.
587     sources +=
588         rebase_path(gypi_values.chrome_browser_mobile_sources, ".", "//chrome")
589   } else {
590     # Non-mobile.
591     sources += rebase_path(gypi_values.chrome_browser_non_mobile_sources,
592                            ".",
593                            "//chrome")
594     deps += [
595       "//components/feedback",
596       "//device/core",
597       "//device/usb",
598     ]
599   }
601   if (is_android) {
602     sources +=
603         rebase_path(gypi_values.chrome_browser_android_sources, ".", "//chrome")
604     deps += [
605       ":jni_headers",
606       "//components/cdm/browser",
607       "//components/enhanced_bookmarks",
608       "//components/resources:components_resources",
609       "//components/web_contents_delegate_android",
610       "//third_party/android_opengl/etc1",
611       "//third_party/libaddressinput:util",
612     ]
613     deps -= [
614       "//third_party/libaddressinput",
615       "//components/storage_monitor",
616       "//components/web_modal",
617     ]
618     defines += [ "ENABLE_DATA_REDUCTION_PROXY_DEBUGGING" ]
620     if (use_seccomp_bpf) {
621       defines += [ "USE_SECCOMP_BPF" ]
622     }
623   }
625   if (is_mac) {
626     deps += [
627       "//third_party/google_toolbox_for_mac",
628       "//third_party/mozilla",
629     ]
630     libs += [
631       "Accelerate.framework",
632       "AddressBook.framework",
633       "AudioUnit.framework",
634       "DiskArbitration.framework",
635       "IOKit.framework",
636       "ImageCaptureCore.framework",
637       "OpenGL.framework",
638       "QuartzCore.framework",
639       "SecurityInterface.framework",
640     ]
641   }
643   if (enable_rlz) {
644     sources +=
645         rebase_path(gypi_values.chrome_browser_rlz_sources, ".", "//chrome")
646     deps += [ "//rlz:rlz_lib" ]
647   }
649   # TODO(GYP)
650   # Temporary fix to break the browser target into smaller chunks so it
651   # will link with goma builds.
652   #["OS=="win" and chromium_win_pch==0", {
653   #  "msvs_shard": 4,
654   #}],
656   if (is_win) {
657     sources +=
658         rebase_path(gypi_values.chrome_browser_win_sources, ".", "//chrome")
659     if (!is_chrome_branded) {
660       sources -= [
661         "google/did_run_updater_win.cc",
662         "google/did_run_updater_win.h",
663       ]
664     }
665     public_deps += [
666       "//ui/views",
667       "//ui/views/controls/webview",
668     ]
669     deps += [
670       ":chrome_process_finder",
671       "//chrome:version_header",
672       "//chrome/installer/util:strings",
673       "//chrome_elf",
674       "//chrome_elf:constants",
675       "//chrome_elf:dll_hash",
676       "//components/browser_watcher",
677       "//components/browser_watcher:browser_watcher_client",
678       "//google_update",
679       "//third_party/iaccessible2",
680       "//third_party/isimpledom",
681       "//third_party/wtl",
682       "//ui/metro_viewer",
683       "//win8:metro_viewer",
684     ]
685     libs += [ "credui.lib" ]
686   } else {
687     # Non-Windows.
688     sources +=
689         rebase_path(gypi_values.chrome_browser_non_win_sources, ".", "//chrome")
690     if (toolkit_views) {
691       deps += [
692         "//ui/views",
693         "//ui/views/controls/webview",
694       ]
695     }
696   }
698   if (is_linux) {
699     sources +=
700         rebase_path(gypi_values.chrome_browser_linux_sources, ".", "//chrome")
701     if (use_aura) {
702       configs += [
703         "//build/config/linux:dbus",
704         "//build/config/linux:fontconfig",
705       ]
706       deps += [ "//dbus" ]
707     }
708     if (use_x11) {
709       configs += [ "//build/config/linux:x11" ]
710       deps += [ "//ui/gfx/x" ]
711     }
712   }
714   if (is_desktop_linux) {
715     sources += rebase_path(gypi_values.chrome_browser_linux_desktop_sources,
716                            ".",
717                            "//chrome")
718   }
719   if (enable_plugin_installation) {
720     sources +=
721         rebase_path(gypi_values.chrome_browser_plugin_installation_sources,
722                     ".",
723                     "//chrome")
724   }
725   if (enable_app_list) {
726     deps += [ "//ui/app_list" ]
727   }
728   if (enable_supervised_users) {
729     sources += rebase_path(gypi_values.chrome_browser_supervised_user_sources,
730                            ".",
731                            "//chrome")
732   }
733   if (enable_supervised_users && enable_themes) {
734     sources += rebase_path(
735             gypi_values.chrome_browser_supervised_user_and_themes_sources,
736             ".",
737             "//chrome")
738   }
739   if (enable_webrtc) {
740     sources +=
741         rebase_path(gypi_values.chrome_browser_webrtc_sources, ".", "//chrome")
742   }
743   if (enable_service_discovery) {
744     sources += rebase_path(gypi_values.chrome_browser_service_discovery_sources,
745                            ".",
746                            "//chrome")
747   }
748   if (enable_mdns) {
749     sources +=
750         rebase_path(gypi_values.chrome_browser_mdns_sources, ".", "//chrome")
751   }
752   if (!enable_autofill_dialog || is_android || is_ios) {
753     sources -= [
754       "autofill/validation_rules_storage_factory.cc",
755       "autofill/validation_rules_storage_factory.h",
756     ]
757   }
758   if (enable_wifi_bootstrapping) {
759     sources +=
760         rebase_path(gypi_values.chrome_browser_wifi_bootstrapping_sources,
761                     ".",
762                     "//chrome")
763     if (is_win || is_mac) {
764       # TODO(brettw) as of this writing wifi bootstrapping is set on Windows
765       # and Mac, so this test is meaningless. Can we merge these lists?
766       sources += rebase_path(
767               gypi_values.chrome_browser_wifi_bootstrapping_win_mac_sources,
768               ".",
769               "//chrome")
770     }
771   }
774 if (is_android) {
775   # GYP version: chrome/chrome_browser.gypi:chrome_browser_jni_headers
776   generate_jni("jni_headers") {
777     sources =
778         rebase_path(gypi_values.chrome_browser_jni_sources, ".", "//chrome")
779     jni_package = "chrome"
780   }
783 if (is_win) {
784   source_set("chrome_process_finder") {
785     sources = [
786       "chrome_process_finder_win.cc",
787       "chrome_process_finder_win.h",
788     ]
789     deps = [
790       "//base",
791       "//chrome/browser/metro_utils",
792       "//chrome/common:constants",
793     ]
794     if (enable_configuration_policy) {
795       deps += [ "//chrome/browser/policy:path_parser" ]
796     }
797   }
800 # GYP version: chrome/chrome_resources.gyp:chrome_resources
801 # (generate_browser_resources action)
802 grit("resources") {
803   source = "browser_resources.grd"
804   output_dir = "$root_gen_dir/chrome"
805   outputs = [
806     "grit/browser_resources.h",
807     "browser_resources.pak",
808   ]
810   omnibox_mojom_file =
811       "$root_gen_dir/chrome/browser/ui/webui/omnibox/omnibox.mojom.js"
813   grit_flags = [
814     "-E",
815     "about_credits_file=" + rebase_path(about_credits_file, root_build_dir),
816     "-E",
817     "additional_modules_list_file=" +
818         rebase_path(additional_modules_list_file, root_build_dir),
819     "-E",
820     "omnibox_mojom_file=" + rebase_path(omnibox_mojom_file, root_build_dir),
821   ]
823   deps = [
824     ":about_credits",
825     ":chrome_internal_resources_gen",
826   ]
827   inputs = [
828     omnibox_mojom_file,
829   ]
832 # GYP version: chrome/chrome_resource.gyp:about_credits
833 action("about_credits") {
834   script = "//tools/licenses.py"
836   inputs = [
837     # This is not a complete list. TODO(phajdan.jr, dbeam): licenses.py needs to
838     # generate a .d file with all the licenses/credits that about:credits uses.
839     # Then about:credits will automatically rebuild when one of them changes.
840     # See: depfile in gn's documentation (gn help depfile).
841     "resources/about_credits.tmpl",
842     "resources/about_credits_entry.tmpl",
843   ]
845   outputs = [
846     about_credits_file,
847   ]
849   args = [
850     "credits",
851     rebase_path(about_credits_file, root_build_dir),
852   ]
855 # GYP version: chrome/chrome_resource.gyp:chrome_internal_resources_gen
856 if (is_chrome_branded) {
857   action("chrome_internal_resources_gen") {
858     script = "internal/transform_additional_modules_list.py"
859     sources = [
860       "internal/resources/additional_modules_list.input",
861     ]
862     outputs = [
863       additional_modules_list_file,
864     ]
865     args = rebase_path(sources, root_build_dir) +
866            rebase_path(outputs, root_build_dir)
867   }
868 } else {
869   group("chrome_internal_resources_gen") {
870     # Empty placeholder.
871   }
874 # In GYP this is part of test_support_common.
875 source_set("test_support") {
876   testonly = true
878   # Always include this via the main test support target.
879   visibility = [ "//chrome/test:test_support" ]
881   sources = [
882     "browsing_data/mock_browsing_data_appcache_helper.cc",
883     "browsing_data/mock_browsing_data_appcache_helper.h",
884     "browsing_data/mock_browsing_data_channel_id_helper.cc",
885     "browsing_data/mock_browsing_data_channel_id_helper.h",
886     "browsing_data/mock_browsing_data_cookie_helper.cc",
887     "browsing_data/mock_browsing_data_cookie_helper.h",
888     "browsing_data/mock_browsing_data_database_helper.cc",
889     "browsing_data/mock_browsing_data_database_helper.h",
890     "browsing_data/mock_browsing_data_file_system_helper.cc",
891     "browsing_data/mock_browsing_data_file_system_helper.h",
892     "browsing_data/mock_browsing_data_flash_lso_helper.cc",
893     "browsing_data/mock_browsing_data_flash_lso_helper.h",
894     "browsing_data/mock_browsing_data_indexed_db_helper.cc",
895     "browsing_data/mock_browsing_data_indexed_db_helper.h",
896     "browsing_data/mock_browsing_data_local_storage_helper.cc",
897     "browsing_data/mock_browsing_data_local_storage_helper.h",
898     "browsing_data/mock_browsing_data_quota_helper.cc",
899     "browsing_data/mock_browsing_data_quota_helper.h",
900     "browsing_data/mock_browsing_data_service_worker_helper.cc",
901     "browsing_data/mock_browsing_data_service_worker_helper.h",
902     "download/download_test_file_activity_observer.cc",
903     "download/download_test_file_activity_observer.h",
904     "download/test_download_shelf.cc",
905     "download/test_download_shelf.h",
906     "invalidation/fake_invalidation_service.cc",
907     "invalidation/fake_invalidation_service.h",
908     "media/fake_desktop_media_list.cc",
909     "media/fake_desktop_media_list.h",
910     "net/dns_probe_test_util.cc",
911     "net/dns_probe_test_util.h",
912     "net/url_request_mock_util.cc",
913     "net/url_request_mock_util.h",
914     "notifications/notification_test_util.cc",
915     "notifications/notification_test_util.h",
916     "password_manager/mock_password_store_service.cc",
917     "password_manager/mock_password_store_service.h",
918     "password_manager/null_password_store_service.cc",
919     "password_manager/null_password_store_service.h",
920     "password_manager/test_password_store_service.cc",
921     "password_manager/test_password_store_service.h",
922     "prefs/pref_service_mock_factory.cc",
923     "prefs/pref_service_mock_factory.h",
924     "profile_resetter/profile_resetter_test_base.cc",
925     "profile_resetter/profile_resetter_test_base.h",
926     "search_engines/template_url_service_factory_test_util.cc",
927     "search_engines/template_url_service_factory_test_util.h",
928     "search_engines/template_url_service_test_util.cc",
929     "search_engines/template_url_service_test_util.h",
930     "sessions/session_restore_test_helper.cc",
931     "sessions/session_restore_test_helper.h",
932     "sessions/session_service_test_helper.cc",
933     "sessions/session_service_test_helper.h",
934     "signin/fake_account_reconcilor.cc",
935     "signin/fake_account_reconcilor.h",
936     "signin/fake_account_tracker_service.cc",
937     "signin/fake_account_tracker_service.h",
938     "signin/fake_profile_oauth2_token_service.cc",
939     "signin/fake_profile_oauth2_token_service.h",
940     "signin/fake_profile_oauth2_token_service_builder.cc",
941     "signin/fake_profile_oauth2_token_service_builder.h",
942     "signin/fake_signin_manager.cc",
943     "signin/fake_signin_manager.h",
944     "ssl/ssl_client_auth_requestor_mock.cc",
945     "ssl/ssl_client_auth_requestor_mock.h",
946     "sync/profile_sync_components_factory_mock.cc",
947     "sync/profile_sync_components_factory_mock.h",
948     "sync/profile_sync_service_mock.cc",
949     "sync/profile_sync_service_mock.h",
950     "ui/webui/signin/login_ui_test_utils.cc",
951     "ui/webui/signin/login_ui_test_utils.h",
952   ]
954   public_deps = [
955     ":browser",
956     "//chrome/browser/ui:test_support",
957   ]
958   deps = [
959     "//base:prefs_test_support",
960     "//chrome/browser",
961     "//chrome/common",
962     "//chrome/common/safe_browsing:proto",
963     "//components/invalidation",
964     "//components/invalidation:test_support",
965     "//components/password_manager/core/browser:test_support",
966     "//components/search_engines:test_support",
967     "//content/test:test_support",
968     "//chrome/app/theme:theme_resources",
969     "//net:test_support",
970     "//skia",
971     "//testing/gmock",
972     "//testing/gtest",
973     "//ui/gfx",
974   ]
976   if (!is_ios) {
977     deps += [
978       "//components/sessions:test_support",
979       "//google_apis:test_support",
980     ]
981   }
983   if (enable_extensions) {
984     sources += [
985       "extensions/extension_action_test_util.cc",
986       "extensions/extension_action_test_util.h",
987     ]
988     deps += [ "//extensions:test_support" ]
989   }
991   if (is_chromeos) {
992     sources += [
993       "chromeos/app_mode/fake_cws.cc",
994       "chromeos/app_mode/fake_cws.h",
995       "chromeos/file_manager/fake_disk_mount_manager.cc",
996       "chromeos/file_manager/fake_disk_mount_manager.h",
997       "chromeos/input_method/mock_candidate_window_controller.cc",
998       "chromeos/input_method/mock_candidate_window_controller.h",
999       "chromeos/input_method/mock_input_method_engine.cc",
1000       "chromeos/input_method/mock_input_method_engine.h",
1001       "chromeos/input_method/mock_input_method_manager.cc",
1002       "chromeos/input_method/mock_input_method_manager.h",
1003       "chromeos/login/screens/mock_device_disabled_screen_actor.cc",
1004       "chromeos/login/screens/mock_device_disabled_screen_actor.h",
1005       "chromeos/login/session/user_session_manager_test_api.cc",
1006       "chromeos/login/session/user_session_manager_test_api.h",
1007       "chromeos/login/test/js_checker.cc",
1008       "chromeos/login/test/js_checker.h",
1009       "chromeos/login/test/oobe_screen_waiter.cc",
1010       "chromeos/login/test/oobe_screen_waiter.h",
1011       "chromeos/login/ui/mock_login_display.cc",
1012       "chromeos/login/ui/mock_login_display.h",
1013       "chromeos/login/ui/mock_login_display_host.cc",
1014       "chromeos/login/ui/mock_login_display_host.h",
1015       "chromeos/login/users/avatar/mock_user_image_manager.cc",
1016       "chromeos/login/users/avatar/mock_user_image_manager.h",
1017       "chromeos/login/users/fake_chrome_user_manager.cc",
1018       "chromeos/login/users/fake_chrome_user_manager.h",
1019       "chromeos/login/users/fake_supervised_user_manager.cc",
1020       "chromeos/login/users/fake_supervised_user_manager.h",
1021       "chromeos/login/users/mock_user_manager.cc",
1022       "chromeos/login/users/mock_user_manager.h",
1023       "chromeos/net/network_portal_detector_test_utils.cc",
1024       "chromeos/net/network_portal_detector_test_utils.h",
1025       "chromeos/policy/cloud_external_data_manager_base_test_util.cc",
1026       "chromeos/policy/cloud_external_data_manager_base_test_util.h",
1027       "chromeos/policy/device_policy_builder.cc",
1028       "chromeos/policy/device_policy_builder.h",
1029       "chromeos/policy/fake_consumer_management_service.cc",
1030       "chromeos/policy/fake_consumer_management_service.h",
1031       "chromeos/policy/fake_device_cloud_policy_initializer.cc",
1032       "chromeos/policy/fake_device_cloud_policy_initializer.h",
1033       "chromeos/policy/fake_device_cloud_policy_manager.cc",
1034       "chromeos/policy/fake_device_cloud_policy_manager.h",
1035       "chromeos/policy/stub_enterprise_install_attributes.cc",
1036       "chromeos/policy/stub_enterprise_install_attributes.h",
1037       "chromeos/settings/device_settings_test_helper.cc",
1038       "chromeos/settings/device_settings_test_helper.h",
1039       "chromeos/system/fake_input_device_settings.cc",
1040       "chromeos/system/fake_input_device_settings.h",
1041     ]
1042     configs += [ "//build/config/linux:dbus" ]
1043     deps += [ "//chromeos:test_support" ]
1044   }
1046   if (enable_configuration_policy) {
1047     sources += [
1048       "policy/test/local_policy_test_server.cc",
1049       "policy/test/local_policy_test_server.h",
1050     ]
1051     public_deps += [
1052       "//components/policy:policy_component_test_support",
1053       "//components/policy:test_support",
1054     ]
1055   }
1057   if (safe_browsing_mode == 1) {
1058     sources += [
1059       "extensions/fake_safe_browsing_database_manager.cc",
1060       "extensions/fake_safe_browsing_database_manager.h",
1061     ]
1062   }
1064   if (enable_extensions) {
1065     sources += [
1066       "drive/dummy_drive_service.cc",
1067       "drive/dummy_drive_service.h",
1068       "drive/fake_drive_service.cc",
1069       "drive/fake_drive_service.h",
1070       "drive/test_util.cc",
1071       "drive/test_util.h",
1072       "extensions/api/messaging/native_messaging_test_util.cc",
1073       "extensions/api/messaging/native_messaging_test_util.h",
1074       "extensions/extension_notification_observer.cc",
1075       "extensions/extension_notification_observer.h",
1076       "extensions/mock_extension_special_storage_policy.cc",
1077       "extensions/mock_extension_special_storage_policy.h",
1078       "extensions/test_blacklist.cc",
1079       "extensions/test_blacklist.h",
1080       "extensions/test_blacklist_state_fetcher.cc",
1081       "extensions/test_blacklist_state_fetcher.h",
1082       "extensions/test_extension_dir.cc",
1083       "extensions/test_extension_dir.h",
1084       "extensions/test_extension_environment.cc",
1085       "extensions/test_extension_environment.h",
1086       "extensions/test_extension_prefs.cc",
1087       "extensions/test_extension_prefs.h",
1088       "extensions/test_extension_service.cc",
1089       "extensions/test_extension_service.h",
1090       "extensions/test_extension_system.cc",
1091       "extensions/test_extension_system.h",
1092       "media_galleries/media_galleries_test_util.cc",
1093       "media_galleries/media_galleries_test_util.h",
1094     ]
1095     deps += [ "//components/storage_monitor:test_support" ]
1096   }
1098   if (enable_mdns) {
1099     sources += [
1100       "local_discovery/test_service_discovery_client.cc",
1101       "local_discovery/test_service_discovery_client.h",
1102     ]
1103   }
1105   if (enable_app_list) {
1106     sources += [
1107       "ui/app_list/test/chrome_app_list_test_support.cc",
1108       "ui/app_list/test/chrome_app_list_test_support.h",
1109       "ui/app_list/test/test_app_list_controller_delegate.cc",
1110       "ui/app_list/test/test_app_list_controller_delegate.h",
1111     ]
1112   }
1114   if (enable_wifi_bootstrapping) {
1115     sources += [
1116       "local_discovery/wifi/mock_wifi_manager.cc",
1117       "local_discovery/wifi/mock_wifi_manager.h",
1118     ]
1119   }