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