printing_features.cc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2019 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.
  4. #include "printing/printing_features.h"
  5. #include "build/build_config.h"
  6. #include "printing/buildflags/buildflags.h"
  7. #if BUILDFLAG(ENABLE_OOP_PRINTING)
  8. #include "base/metrics/field_trial_params.h"
  9. #endif
  10. namespace printing {
  11. namespace features {
  12. #if BUILDFLAG(IS_MAC)
  13. // Use the CUPS IPP printing backend instead of the original CUPS backend that
  14. // calls the deprecated PPD API.
  15. const base::Feature kCupsIppPrintingBackend{"CupsIppPrintingBackend",
  16. base::FEATURE_ENABLED_BY_DEFAULT};
  17. #endif // BUILDFLAG(IS_MAC)
  18. #if BUILDFLAG(IS_WIN)
  19. // When using PostScript level 3 printing, render text with Type 42 fonts if
  20. // possible.
  21. const base::Feature kPrintWithPostScriptType42Fonts{
  22. "PrintWithPostScriptType42Fonts", base::FEATURE_DISABLED_BY_DEFAULT};
  23. // When using GDI printing, avoid rasterization if possible.
  24. const base::Feature kPrintWithReducedRasterization{
  25. "PrintWithReducedRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
  26. // Read printer capabilities with XPS when use XPS for printing.
  27. const base::Feature kReadPrinterCapabilitiesWithXps{
  28. "ReadPrinterCapabilitiesWithXps", base::FEATURE_DISABLED_BY_DEFAULT};
  29. // Use XPS for printing instead of GDI.
  30. const base::Feature kUseXpsForPrinting{"UseXpsForPrinting",
  31. base::FEATURE_DISABLED_BY_DEFAULT};
  32. // Use XPS for printing instead of GDI for printing PDF documents. This is
  33. // independent of `kUseXpsForPrinting`; can use XPS for PDFs even if still using
  34. // GDI for modifiable content.
  35. const base::Feature kUseXpsForPrintingFromPdf{
  36. "UseXpsForPrintingFromPdf", base::FEATURE_DISABLED_BY_DEFAULT};
  37. bool IsXpsPrintCapabilityRequired() {
  38. return base::FeatureList::IsEnabled(features::kUseXpsForPrinting) ||
  39. base::FeatureList::IsEnabled(features::kUseXpsForPrintingFromPdf);
  40. }
  41. bool ShouldPrintUsingXps(bool source_is_pdf) {
  42. return base::FeatureList::IsEnabled(source_is_pdf
  43. ? features::kUseXpsForPrintingFromPdf
  44. : features::kUseXpsForPrinting);
  45. }
  46. #endif // BUILDFLAG(IS_WIN)
  47. #if BUILDFLAG(ENABLE_OOP_PRINTING)
  48. // Enables printing interactions with the operating system to be performed
  49. // out-of-process.
  50. const base::Feature kEnableOopPrintDrivers{"EnableOopPrintDrivers",
  51. base::FEATURE_DISABLED_BY_DEFAULT};
  52. const base::FeatureParam<bool> kEnableOopPrintDriversJobPrint{
  53. &kEnableOopPrintDrivers, "JobPrint", false};
  54. const base::FeatureParam<bool> kEnableOopPrintDriversSandbox{
  55. &kEnableOopPrintDrivers, "Sandbox", false};
  56. #endif // BUILDFLAG(ENABLE_OOP_PRINTING)
  57. #if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
  58. // Enables scanning of to-be-printed pages and documents for sensitive data if
  59. // the OnPrintEnterpriseConnector policy is enabled.
  60. const base::Feature kEnablePrintContentAnalysis{
  61. "EnablePrintContentAnalysis", base::FEATURE_DISABLED_BY_DEFAULT};
  62. #endif // BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
  63. } // namespace features
  64. } // namespace printing