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