Daniel Hosseinian | 7b57a42 | 2019-06-11 23:52:32 | [diff] [blame] | 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 | |
Alan Screen | 113d014 | 2020-01-31 06:11:21 | [diff] [blame] | 5 | #include "printing/printing_features.h" |
Daniel Hosseinian | 7b57a42 | 2019-06-11 23:52:32 | [diff] [blame] | 6 | |
Xiaohan Wang | e3d00dd6 | 2022-01-08 02:33:28 | [diff] [blame] | 7 | #include "build/build_config.h" |
Alan Screen | ed2fdda | 2021-09-15 17:24:46 | [diff] [blame] | 8 | #include "printing/buildflags/buildflags.h" |
Yuta Hijikata | 2f66389 | 2020-10-06 10:34:22 | [diff] [blame] | 9 | |
Alan Screen | 68e7b1a | 2022-04-26 05:40:26 | [diff] [blame] | 10 | #if BUILDFLAG(ENABLE_OOP_PRINTING) |
Alan Screen | 3dbd132 | 2021-08-31 23:03:54 | [diff] [blame] | 11 | #include "base/metrics/field_trial_params.h" |
| 12 | #endif |
| 13 | |
Daniel Hosseinian | 7b57a42 | 2019-06-11 23:52:32 | [diff] [blame] | 14 | namespace printing { |
| 15 | namespace features { |
| 16 | |
Xiaohan Wang | e3d00dd6 | 2022-01-08 02:33:28 | [diff] [blame] | 17 | #if BUILDFLAG(IS_MAC) |
Daniel Hosseinian | 159cb3d | 2020-03-13 03:02:02 | [diff] [blame] | 18 | // Use the CUPS IPP printing backend instead of the original CUPS backend that |
| 19 | // calls the deprecated PPD API. |
| 20 | const base::Feature kCupsIppPrintingBackend{"CupsIppPrintingBackend", |
Daniel Hosseinian | 50a09f00 | 2021-04-20 01:01:32 | [diff] [blame] | 21 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Xiaohan Wang | e3d00dd6 | 2022-01-08 02:33:28 | [diff] [blame] | 22 | #endif // BUILDFLAG(IS_MAC) |
Daniel Hosseinian | 159cb3d | 2020-03-13 03:02:02 | [diff] [blame] | 23 | |
Xiaohan Wang | e3d00dd6 | 2022-01-08 02:33:28 | [diff] [blame] | 24 | #if BUILDFLAG(IS_WIN) |
Lei Zhang | 1419cab | 2021-09-09 17:04:44 | [diff] [blame] | 25 | // When using PostScript level 3 printing, render text with Type 42 fonts if |
| 26 | // possible. |
| 27 | const base::Feature kPrintWithPostScriptType42Fonts{ |
| 28 | "PrintWithPostScriptType42Fonts", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 29 | |
Lei Zhang | 92eadbb | 2020-05-13 22:32:36 | [diff] [blame] | 30 | // When using GDI printing, avoid rasterization if possible. |
| 31 | const base::Feature kPrintWithReducedRasterization{ |
| 32 | "PrintWithReducedRasterization", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 33 | |
Cuc Doan | 074d8ed | 2022-03-14 22:03:34 | [diff] [blame] | 34 | // Read printer capabilities with XPS when use XPS for printing. |
| 35 | const base::Feature kReadPrinterCapabilitiesWithXps{ |
| 36 | "ReadPrinterCapabilitiesWithXps", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 37 | |
Alan Screen | c006076 | 2019-11-22 17:52:06 | [diff] [blame] | 38 | // Use XPS for printing instead of GDI. |
| 39 | const base::Feature kUseXpsForPrinting{"UseXpsForPrinting", |
| 40 | base::FEATURE_DISABLED_BY_DEFAULT}; |
Alan Screen | 4938811 | 2019-12-13 23:34:21 | [diff] [blame] | 41 | |
Daniel Hosseinian | 159cb3d | 2020-03-13 03:02:02 | [diff] [blame] | 42 | // Use XPS for printing instead of GDI for printing PDF documents. This is |
Daniel Hosseinian | 3553e27 | 2021-04-24 00:51:18 | [diff] [blame] | 43 | // independent of `kUseXpsForPrinting`; can use XPS for PDFs even if still using |
Alan Screen | 4938811 | 2019-12-13 23:34:21 | [diff] [blame] | 44 | // GDI for modifiable content. |
| 45 | const base::Feature kUseXpsForPrintingFromPdf{ |
| 46 | "UseXpsForPrintingFromPdf", base::FEATURE_DISABLED_BY_DEFAULT}; |
Alan Screen | 28aeff3 | 2020-03-01 04:46:06 | [diff] [blame] | 47 | |
| 48 | bool IsXpsPrintCapabilityRequired() { |
| 49 | return base::FeatureList::IsEnabled(features::kUseXpsForPrinting) || |
| 50 | base::FeatureList::IsEnabled(features::kUseXpsForPrintingFromPdf); |
| 51 | } |
| 52 | |
| 53 | bool ShouldPrintUsingXps(bool source_is_pdf) { |
| 54 | return base::FeatureList::IsEnabled(source_is_pdf |
| 55 | ? features::kUseXpsForPrintingFromPdf |
| 56 | : features::kUseXpsForPrinting); |
| 57 | } |
Xiaohan Wang | e3d00dd6 | 2022-01-08 02:33:28 | [diff] [blame] | 58 | #endif // BUILDFLAG(IS_WIN) |
Alan Screen | c006076 | 2019-11-22 17:52:06 | [diff] [blame] | 59 | |
Alan Screen | ed2fdda | 2021-09-15 17:24:46 | [diff] [blame] | 60 | #if BUILDFLAG(ENABLE_OOP_PRINTING) |
Alan Screen | 652ddbb | 2020-09-16 07:14:53 | [diff] [blame] | 61 | // Enables printing interactions with the operating system to be performed |
| 62 | // out-of-process. |
| 63 | const base::Feature kEnableOopPrintDrivers{"EnableOopPrintDrivers", |
| 64 | base::FEATURE_DISABLED_BY_DEFAULT}; |
Alan Screen | 3dbd132 | 2021-08-31 23:03:54 | [diff] [blame] | 65 | |
| 66 | const base::FeatureParam<bool> kEnableOopPrintDriversJobPrint{ |
| 67 | &kEnableOopPrintDrivers, "JobPrint", false}; |
Alan Screen | 2371913 | 2022-04-27 21:42:57 | [diff] [blame] | 68 | |
| 69 | const base::FeatureParam<bool> kEnableOopPrintDriversSandbox{ |
| 70 | &kEnableOopPrintDrivers, "Sandbox", false}; |
Alan Screen | ed2fdda | 2021-09-15 17:24:46 | [diff] [blame] | 71 | #endif // BUILDFLAG(ENABLE_OOP_PRINTING) |
Alan Screen | 652ddbb | 2020-09-16 07:14:53 | [diff] [blame] | 72 | |
Dominique Fauteux-Chapleau | 5bf9197 | 2022-04-14 17:31:02 | [diff] [blame] | 73 | #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. |
| 76 | const base::Feature kEnablePrintContentAnalysis{ |
| 77 | "EnablePrintContentAnalysis", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 78 | #endif // BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS) |
| 79 | |
Daniel Hosseinian | 7b57a42 | 2019-06-11 23:52:32 | [diff] [blame] | 80 | } // namespace features |
| 81 | } // namespace printing |