0

Printing: Port CupsIppPrintingBackend feature to Linux

Take the existing CupsIppPrintingBackend feature, which is Mac-only, and
enable it on Linux as well. Unlike Mac, where the feature is enabled by
default, it starts out disabled by default on Linux.

Bug: 339188518
Change-Id: Ic06fc593130ee7188ecc9cf54b8f12fbdfc6de46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5560307
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Alan Screen <awscreen@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1304711}
This commit is contained in:
Lei Zhang
2024-05-22 22:05:17 +00:00
committed by Chromium LUCI CQ
parent 7069ed0cc0
commit 2b50c8aada
8 changed files with 32 additions and 25 deletions

@ -7037,12 +7037,12 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(printing::features::kAddPrinterViaPrintscanmgr)},
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
{"cups-ipp-printing-backend",
flag_descriptions::kCupsIppPrintingBackendName,
flag_descriptions::kCupsIppPrintingBackendDescription, kOsMac,
flag_descriptions::kCupsIppPrintingBackendDescription, kOsDesktop,
FEATURE_VALUE_TYPE(printing::features::kCupsIppPrintingBackend)},
#endif // BUILDFLAG(IS_MAC)
#endif // BUILDFLAG(IS_LINUX) ||BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_WIN)
{"print-with-postscript-type42-fonts",

@ -5462,13 +5462,6 @@ const char kUseXpsForPrintingFromPdfDescription[] =
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(ENABLE_PRINTING)
const char kCupsIppPrintingBackendName[] = "CUPS IPP Printing Backend";
const char kCupsIppPrintingBackendDescription[] =
"Use the CUPS IPP printing backend instead of the original CUPS backend "
"that calls the PPD API.";
#endif // BUILDFLAG(ENABLE_PRINTING)
const char kEnableExtensibleEnterpriseSSOName[] = "Extensible Enterprise SSO";
const char kEnableExtensibleEnterpriseSSODescription[] =
"Enables support for extensible enterprise SSO in Chrome";
@ -7931,6 +7924,13 @@ const char kRestartToGainAccessToKeychainName[] =
const char kRestartToGainAccessToKeychainDescription[] =
"Controls whether the Chrome shows bubbles and banner, prompting the user "
"to restart Chrome to gain access to computer's password manager.";
#if BUILDFLAG(ENABLE_PRINTING)
const char kCupsIppPrintingBackendName[] = "CUPS IPP Printing Backend";
const char kCupsIppPrintingBackendDescription[] =
"Use the CUPS IPP printing backend instead of the original CUPS backend "
"that calls the PPD API.";
#endif // BUILDFLAG(ENABLE_PRINTING)
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)

@ -3182,11 +3182,6 @@ extern const char kUseXpsForPrintingFromPdfDescription[];
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(ENABLE_PRINTING)
extern const char kCupsIppPrintingBackendName[];
extern const char kCupsIppPrintingBackendDescription[];
#endif // BUILDFLAG(ENABLE_PRINTING)
extern const char kEnableExtensibleEnterpriseSSOName[];
extern const char kEnableExtensibleEnterpriseSSODescription[];
@ -4599,6 +4594,11 @@ extern const char kForcePasswordInitialSyncWhenDecryptionFailsDescription[];
extern const char kRestartToGainAccessToKeychainName[];
extern const char kRestartToGainAccessToKeychainDescription[];
#if BUILDFLAG(ENABLE_PRINTING)
extern const char kCupsIppPrintingBackendName[];
extern const char kCupsIppPrintingBackendDescription[];
#endif // BUILDFLAG(ENABLE_PRINTING)
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)

@ -129,6 +129,8 @@ base::Value AssemblePrinterCapabilities(const std::string& device_name,
#if BUILDFLAG(PRINT_MEDIA_L10N_ENABLED)
bool populate_paper_names = true;
#if BUILDFLAG(IS_MAC)
// TODO(crbug.com/339188518): Is this needed on Linux?
//
// Paper display name localization and vendor ID assignment is intended for
// use with the CUPS IPP backend. If the CUPS IPP backend is not enabled,
// localization will not properly occur.

@ -26,12 +26,12 @@
#include "printing/mojom/print.mojom.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
#include "base/feature_list.h"
#include "printing/backend/cups_connection.h"
#include "printing/backend/print_backend_cups_ipp.h"
#include "printing/printing_features.h"
#endif // BUILDFLAG(IS_MAC)
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
namespace printing {
@ -296,11 +296,11 @@ bool PrintBackendCUPS::IsValidPrinter(const std::string& printer_name) {
#if !BUILDFLAG(IS_CHROMEOS)
scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl(
const std::string& locale) {
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
if (base::FeatureList::IsEnabled(features::kCupsIppPrintingBackend)) {
return base::MakeRefCounted<PrintBackendCupsIpp>(CupsConnection::Create());
}
#endif // BUILDFLAG(IS_MAC)
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
return base::MakeRefCounted<PrintBackendCUPS>(
GURL(), HTTP_ENCRYPT_NEVER, /*cups_blocking=*/false, locale);
}

@ -63,5 +63,5 @@ declare_args() {
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 && !is_linux
use_cups_ipp = use_cups
}

@ -21,13 +21,18 @@ BASE_FEATURE(kAddPrinterViaPrintscanmgr,
base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
// Use the CUPS IPP printing backend instead of the original CUPS backend that
// calls the deprecated PPD API.
BASE_FEATURE(kCupsIppPrintingBackend,
"CupsIppPrintingBackend",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif
);
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_WIN)
// When using PostScript level 3 printing, render text with Type 42 fonts if

@ -22,9 +22,9 @@ COMPONENT_EXPORT(PRINTING_BASE)
BASE_DECLARE_FEATURE(kAddPrinterViaPrintscanmgr);
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
COMPONENT_EXPORT(PRINTING_BASE) BASE_DECLARE_FEATURE(kCupsIppPrintingBackend);
#endif // BUILDFLAG(IS_MAC)
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_WIN)
COMPONENT_EXPORT(PRINTING_BASE)