# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file contains UI-related build flags. It should theoretically be in the
# src/ui directory and only things that depend on the ui module should get the
# definitions.
#
# However, today we have many "bad" dependencies on some of these flags from,
# e.g. base, so they need to be global.
#
# See also build/config/ui.gni

if (is_android) {
  import("//build/config/android/config.gni")
}

declare_args() {
  # Multicast DNS.
  enable_mdns = is_win || is_linux

  enable_plugins = !is_android && !is_ios

  # Enables Native Client support.
  # TODO(GYP) enable this when nacl works in GN.
  enable_nacl = false
  #enable_nacl = (!is_ios && !is_android)

  # If debug_devtools is set to true, JavaScript files for DevTools are stored
  # as is and loaded from disk. Otherwise, a concatenated file is stored in
  # resources.pak. It is still possible to load JS files from disk by passing
  # --debug-devtools cmdline switch.
  debug_devtools = false

  # Enables WebRTC.
  #enable_webrtc = !is_ios  TODO(GYP) use this condition when WebRTC works in
  #                         the GN build.
  enable_webrtc = false
}

# Additional dependent variables -----------------------------------------------

# Set the version of CLD.
#   0: Don't specify the version. This option is for the Finch testing.
#   1: Use only CLD1.
#   2: Use only CLD2.
if (is_android || is_ios) {
  cld_version = 1
} else {
  cld_version = 2
}

# libudev usage. This currently only affects the content layer.
use_udev = is_linux

# Enable the spell checker.
enable_spellcheck = !is_android

enable_pepper_cdms = enable_plugins && (is_linux || is_mac || is_win)

enable_browser_cdms = is_android

# Enable printing support and UI. This variable is used to configure which
# parts of printing will be built. 0 disables printing completely, 1 enables it
# fully, and 2 enables only the codepath to generate a Metafile (e.g.  usually
# a PDF or EMF) and disables print preview, cloud print, UI, etc.
if (is_android) {
  printing_mode = 2
} else {
  printing_mode = 1
}

# The seccomp-bpf sandbox is only supported on three architectures
# currently.
# Do not disable seccomp_bpf anywhere without talking to
# security@chromium.org!
use_seccomp_bpf = (is_linux || is_android) &&
  (cpu_arch == "x86" || cpu_arch == "x64" || cpu_arch == "arm")

# Enable notifications everywhere except Android/iOS.
# Android is http://crbug.com/115320
enable_notifications = !is_android && !is_ios

# TODO(brettw) this should be moved to net and only dependents get this define.
disable_ftp_support = is_ios

enable_web_speech = (!is_android && !is_ios)

use_dbus = is_linux

enable_extensions = (!is_android && !is_ios)

# Variable safe_browsing is used to control the build time configuration for
# safe browsing feature. Safe browsing can be compiled in 3 different levels: 0
# disables it, 1 enables it fully, and 2 enables only UI and reporting features
# without enabling phishing and malware detection. This is useful to integrate
# a third party phishing/malware detection to existing safe browsing logic.
if (is_android) {
  safe_browsing_mode = 2
} else if (is_ios) {
  safe_browsing_mode = 0
} else {
  safe_browsing_mode = 1
}

enable_configuration_policy = true

# The data acquisition mode for CLD2. Possible values are:
#   static:     CLD2 data is statically linked to the executable.
#   standalone: CLD2 data is provided in a standalone file that is
#               bundled with the executable.
#   component:  CLD2 data is provided as a Chrome "component" and is
#               downloaded via the component updater.
#
# For more information on switching the CLD2 data source, see:
#   https://sites.google.com/a/chromium.org/dev/developers/how-tos/compact-language-detector-cld-data-source-configuration
cld2_data_source = "static"

# Enables support for background apps.
enable_background = !is_ios && !is_android

enable_task_manager = !is_ios && !is_android

use_cups = is_desktop_linux || is_mac

enable_themes = !is_android && !is_chromeos

# TODO(scottmg) remove this when we've fixed printing.
win_pdf_metafile_for_printing = true

enable_captive_portal_detection = !is_android && !is_ios

# Enables use of the session service, which is enabled by default.
# Android stores them separately on the Java side.
enable_session_service = !is_android && !is_ios

# Whether we are using the rlz library or not.  Platforms like Android send
# rlz codes for searches but do not use the library.
enable_rlz = is_chrome_branded && (is_win || is_mac || is_ios || is_chromeos)

enable_plugin_installation = is_win || is_mac

enable_app_list = !is_ios && !is_android
enable_settings_app = enable_app_list && !is_chromeos

enable_managed_users = !is_ios

enable_service_discovery = enable_mdns || is_mac

enable_autofill_dialog = !is_ios && !(is_android && is_android_webview_build)

enable_wifi_bootstrapping = is_win || is_mac

# Image loader extension is enabled on ChromeOS only.
enable_image_loader_extension = is_chromeos

enable_remoting = !is_ios && !is_android

enable_google_now = !is_ios && !is_android

enable_one_click_signin = is_win || is_mac || (is_linux && !is_chromeos)

# Chrome OS: whether to also build the upcoming version of
# ChromeVox, which can then be enabled via a command-line switch.
enable_chromevox_next = false

# Use brlapi from brltty for braille display support.
use_brlapi = is_chromeos

# Option controlling the use of GConf (the classic GNOME configuration
# system).
# TODO(GYP) also require !embedded to enable.
use_gconf = is_linux && !is_chromeos