blob: 0091fb13aead05960e21f4be250804d801ed44fc [file] [log] [blame]
Daniel Hosseinian7b57a422019-06-11 23:52:321// 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
Alan Screen113d0142020-01-31 06:11:215#include "printing/printing_features.h"
Daniel Hosseinian7b57a422019-06-11 23:52:326
Xiaohan Wange3d00dd62022-01-08 02:33:287#include "build/build_config.h"
Alan Screened2fdda2021-09-15 17:24:468#include "printing/buildflags/buildflags.h"
Yuta Hijikata2f663892020-10-06 10:34:229
Alan Screen68e7b1a2022-04-26 05:40:2610#if BUILDFLAG(ENABLE_OOP_PRINTING)
Alan Screen3dbd1322021-08-31 23:03:5411#include "base/metrics/field_trial_params.h"
12#endif
13
Daniel Hosseinian7b57a422019-06-11 23:52:3214namespace printing {
15namespace features {
16
Xiaohan Wange3d00dd62022-01-08 02:33:2817#if BUILDFLAG(IS_MAC)
Daniel Hosseinian159cb3d2020-03-13 03:02:0218// Use the CUPS IPP printing backend instead of the original CUPS backend that
19// calls the deprecated PPD API.
20const base::Feature kCupsIppPrintingBackend{"CupsIppPrintingBackend",
Daniel Hosseinian50a09f002021-04-20 01:01:3221 base::FEATURE_ENABLED_BY_DEFAULT};
Xiaohan Wange3d00dd62022-01-08 02:33:2822#endif // BUILDFLAG(IS_MAC)
Daniel Hosseinian159cb3d2020-03-13 03:02:0223
Xiaohan Wange3d00dd62022-01-08 02:33:2824#if BUILDFLAG(IS_WIN)
Lei Zhang1419cab2021-09-09 17:04:4425// When using PostScript level 3 printing, render text with Type 42 fonts if
26// possible.
27const base::Feature kPrintWithPostScriptType42Fonts{
28 "PrintWithPostScriptType42Fonts", base::FEATURE_DISABLED_BY_DEFAULT};
29
Lei Zhang92eadbb2020-05-13 22:32:3630// When using GDI printing, avoid rasterization if possible.
31const base::Feature kPrintWithReducedRasterization{
32 "PrintWithReducedRasterization", base::FEATURE_DISABLED_BY_DEFAULT};
33
Cuc Doan074d8ed2022-03-14 22:03:3434// Read printer capabilities with XPS when use XPS for printing.
35const base::Feature kReadPrinterCapabilitiesWithXps{
36 "ReadPrinterCapabilitiesWithXps", base::FEATURE_DISABLED_BY_DEFAULT};
37
Alan Screenc0060762019-11-22 17:52:0638// Use XPS for printing instead of GDI.
39const base::Feature kUseXpsForPrinting{"UseXpsForPrinting",
40 base::FEATURE_DISABLED_BY_DEFAULT};
Alan Screen49388112019-12-13 23:34:2141
Daniel Hosseinian159cb3d2020-03-13 03:02:0242// Use XPS for printing instead of GDI for printing PDF documents. This is
Daniel Hosseinian3553e272021-04-24 00:51:1843// independent of `kUseXpsForPrinting`; can use XPS for PDFs even if still using
Alan Screen49388112019-12-13 23:34:2144// GDI for modifiable content.
45const base::Feature kUseXpsForPrintingFromPdf{
46 "UseXpsForPrintingFromPdf", base::FEATURE_DISABLED_BY_DEFAULT};
Alan Screen28aeff32020-03-01 04:46:0647
48bool IsXpsPrintCapabilityRequired() {
49 return base::FeatureList::IsEnabled(features::kUseXpsForPrinting) ||
50 base::FeatureList::IsEnabled(features::kUseXpsForPrintingFromPdf);
51}
52
53bool ShouldPrintUsingXps(bool source_is_pdf) {
54 return base::FeatureList::IsEnabled(source_is_pdf
55 ? features::kUseXpsForPrintingFromPdf
56 : features::kUseXpsForPrinting);
57}
Xiaohan Wange3d00dd62022-01-08 02:33:2858#endif // BUILDFLAG(IS_WIN)
Alan Screenc0060762019-11-22 17:52:0659
Alan Screened2fdda2021-09-15 17:24:4660#if BUILDFLAG(ENABLE_OOP_PRINTING)
Alan Screen652ddbb2020-09-16 07:14:5361// Enables printing interactions with the operating system to be performed
62// out-of-process.
63const base::Feature kEnableOopPrintDrivers{"EnableOopPrintDrivers",
64 base::FEATURE_DISABLED_BY_DEFAULT};
Alan Screen3dbd1322021-08-31 23:03:5465
66const base::FeatureParam<bool> kEnableOopPrintDriversJobPrint{
67 &kEnableOopPrintDrivers, "JobPrint", false};
Alan Screen23719132022-04-27 21:42:5768
69const base::FeatureParam<bool> kEnableOopPrintDriversSandbox{
70 &kEnableOopPrintDrivers, "Sandbox", false};
Alan Screened2fdda2021-09-15 17:24:4671#endif // BUILDFLAG(ENABLE_OOP_PRINTING)
Alan Screen652ddbb2020-09-16 07:14:5372
Dominique Fauteux-Chapleau5bf91972022-04-14 17:31:0273#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
74// Enables scanning of to-be-printed pages and documents for sensitive data if
75// the OnPrintEnterpriseConnector policy is enabled.
76const base::Feature kEnablePrintContentAnalysis{
77 "EnablePrintContentAnalysis", base::FEATURE_DISABLED_BY_DEFAULT};
78#endif // BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
79
Daniel Hosseinian7b57a422019-06-11 23:52:3280} // namespace features
81} // namespace printing