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