chromium/printing/buildflags/buildflags.gni

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

import("//build/config/cast.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//pdf/features.gni")

declare_args() {
  # Enables printing support.
  enable_printing = !is_ios && !is_castos && !is_cast_android

  # TODO(crbug.com/40263786): iOS blink port only enables printing_tests to run
  # unit tests and web tests for now because the port does not enable the
  # printing feature yet.
  enable_printing_tests = is_ios && use_blink
}

declare_args() {
  # Enables printing with print preview.
  # Print preview requires PDF per //printing/BUILD.gn.
  # The is_android condition is currently redundant but left for clarity.
  enable_print_preview = enable_printing && enable_pdf && !is_android

  # Enables the printing system dialog for platforms that support printing
  # and have a system dialog.
  enable_basic_print_dialog = enable_printing && !is_chromeos && !is_fuchsia

  if (use_fuzzing_engine && (is_linux || is_chromeos)) {
    # For fuzzing, just restrict to chromeos and linux.
    use_cups = true
  } else {
    use_cups = (is_chromeos_device || (is_linux && !is_castos) || is_mac) &&
               !is_fuchsia
  }

  # Enables out-of-process printing.  Do not have this definition just be
  # based on `enable_print_preview`; this feature could still be appropriate
  # for some build configurations which explicitly disable print preview.
  enable_oop_printing = enable_printing && !is_android && !is_fuchsia
}

declare_args() {
  enable_concurrent_basic_print_dialogs = enable_basic_print_dialog && is_linux

  # Enables the printing system dialog being invoked from out-of-process for
  # platforms that support printing, have a system dialog, and which can invoke
  # that system print dialog from a process other than the browser process.
  # TODO(crbug.com/40561724)  Determine if Linux Wayland can be made to have a
  # system dialog be modal against an application window in the browser process.
  enable_oop_basic_print_dialog = enable_oop_printing && is_win

  # Enables out-of-process print handling for platforms which support a system
  # print dialog but are unable to invoke that dialog from the Print Backend
  # service.
  enable_oop_printing_no_oop_basic_print_dialog =
      enable_oop_printing && (is_linux || is_mac)
}

declare_args() {
  # Enables the CUPS IPP printing backend.
  # TODO(crbug.com/41003486): Remove this after CUPS PPD API calls are removed.
  use_cups_ipp = use_cups
}