diff --git a/printing/BUILD.gn b/printing/BUILD.gn index e71403b9065d73..14a948d31053d6 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chromeos/ui_mode.gni") import("//build/config/features.gni") import("//build/config/sysroot.gni") import("//build/config/ui.gni") @@ -14,7 +15,7 @@ if (is_mac) { if (is_android) { import("//build/config/android/rules.gni") } -if (use_cups && is_chromeos) { +if (use_cups && is_chromeos_ash) { import("//printing/backend/tools/code_generator.gni") } @@ -28,7 +29,7 @@ if ((enable_basic_printing && is_win) || enable_print_preview) { # Enable the CUPS IPP printing backend. # TODO(crbug.com/226176): Remove this after CUPS PPD API calls are removed. declare_args() { - use_cups_ipp = use_cups && !is_linux + use_cups_ipp = use_cups && !(is_linux || is_chromeos_lacros) } # Several targets want to include this header file. We separate it out @@ -37,7 +38,7 @@ source_set("printing_export") { sources = [ "printing_export.h" ] } -if (use_cups_ipp && is_chromeos) { +if (use_cups_ipp && is_chromeos_ash) { ipp_handler_map_path = "$target_gen_dir/backend/ipp_handler_map.cc" ipp_code_generate("ipp_handlers_generate") { @@ -125,7 +126,7 @@ component("printing") { ] } - if (is_chromeos) { + if (is_chromeos_ash) { defines += [ "PRINT_BACKEND_AVAILABLE" ] sources += [ @@ -136,7 +137,7 @@ component("printing") { ] } - if (is_linux) { + if (is_linux || is_chromeos_lacros) { sources += [ "printed_document_linux.cc", "printing_context_linux.cc", @@ -239,7 +240,7 @@ component("printing") { ] } - if (is_chromeos) { + if (is_chromeos_ash) { deps += [ ":ipp_handlers_generate" ] sources += [ @@ -272,7 +273,7 @@ component("printing") { } } - if (use_cups_ipp || is_chromeos) { + if (use_cups_ipp || is_chromeos_ash) { sources += [ "printer_query_result.h", "printer_status.cc", @@ -381,7 +382,7 @@ test("printing_unittests") { sources += [ "backend/cups_ipp_helper_unittest.cc" ] } - if (is_chromeos) { + if (is_chromeos_ash) { sources += [ "printing_context_chromeos_unittest.cc" ] } else { sources += [ diff --git a/printing/backend/cups_ipp_constants.cc b/printing/backend/cups_ipp_constants.cc index 5981f8d6f1d259..1473d483a63d23 100644 --- a/printing/backend/cups_ipp_constants.cc +++ b/printing/backend/cups_ipp_constants.cc @@ -24,7 +24,7 @@ constexpr char kIppPinEncryption[] = "job-password-encryption"; // PWG 5100.11 constexpr char kCollated[] = "separate-documents-collated-copies"; constexpr char kUncollated[] = "separate-documents-uncollated-copies"; -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) constexpr char kIppDocumentAttributes[] = "document-creation-attributes"; // PWG 5100.5 @@ -35,6 +35,6 @@ constexpr char kPinEncryptionNone[] = "none"; constexpr char kOptionFalse[] = "false"; constexpr char kOptionTrue[] = "true"; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } // namespace printing diff --git a/printing/backend/cups_ipp_constants.h b/printing/backend/cups_ipp_constants.h index 83fa9a25f927ca..38d1c46a8c8085 100644 --- a/printing/backend/cups_ipp_constants.h +++ b/printing/backend/cups_ipp_constants.h @@ -25,7 +25,7 @@ PRINTING_EXPORT extern const char kIppPinEncryption[]; PRINTING_EXPORT extern const char kCollated[]; PRINTING_EXPORT extern const char kUncollated[]; -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) PRINTING_EXPORT extern const char kIppDocumentAttributes[]; PRINTING_EXPORT extern const char kIppJobAttributes[]; @@ -35,7 +35,7 @@ PRINTING_EXPORT extern const char kPinEncryptionNone[]; PRINTING_EXPORT extern const char kOptionFalse[]; PRINTING_EXPORT extern const char kOptionTrue[]; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } // namespace printing diff --git a/printing/backend/cups_ipp_helper.cc b/printing/backend/cups_ipp_helper.cc index 4e86ba71cd6f9d..570a3a900efa1a 100644 --- a/printing/backend/cups_ipp_helper.cc +++ b/printing/backend/cups_ipp_helper.cc @@ -24,19 +24,19 @@ #include "printing/printing_utils.h" #include "printing/units.h" -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) #include "base/callback.h" #include "base/metrics/histogram_functions.h" #include "base/no_destructor.h" #include "printing/backend/ipp_handler_map.h" #include "printing/printing_features.h" -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace printing { -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) constexpr int kPinMinimumLength = 4; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace { @@ -256,7 +256,7 @@ bool CollateDefault(const CupsOptionProvider& printer) { return name && !base::StringPiece(name).compare(kCollated); } -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) bool PinSupported(const CupsOptionProvider& printer) { ipp_attribute_t* attr = printer.GetSupportedOptionValues(kIppPin); if (!attr) @@ -311,7 +311,7 @@ void ExtractAdvancedCapabilities(const CupsOptionProvider& printer, attr_count += AddAttributes(printer, kIppDocumentAttributes, options); base::UmaHistogramCounts1000("Printing.CUPS.IppAttributesCount", attr_count); } -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } // namespace @@ -334,11 +334,11 @@ void CapsAndDefaultsFromPrinter(const CupsOptionProvider& printer, printer_info->default_paper = DefaultPaper(printer); printer_info->papers = SupportedPapers(printer); -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) printer_info->pin_supported = PinSupported(printer); if (base::FeatureList::IsEnabled(printing::features::kAdvancedPpdAttributes)) ExtractAdvancedCapabilities(printer, printer_info); -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) ExtractCopies(printer, printer_info); ExtractColor(printer, printer_info); diff --git a/printing/backend/cups_ipp_helper_unittest.cc b/printing/backend/cups_ipp_helper_unittest.cc index 0713dc5e92df38..5bb5c7ec964596 100644 --- a/printing/backend/cups_ipp_helper_unittest.cc +++ b/printing/backend/cups_ipp_helper_unittest.cc @@ -285,7 +285,7 @@ TEST_F(PrintBackendCupsIppHelperTest, OmitPapersWithSpecialVendorIds) { "iso b0"))); } -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) TEST_F(PrintBackendCupsIppHelperTest, PinSupported) { printer_->SetSupportedOptions("job-password", MakeInteger(ipp_, 4)); printer_->SetSupportedOptions("job-password-encryption", @@ -364,6 +364,6 @@ TEST_F(PrintBackendCupsIppHelperTest, AdvancedCaps) { EXPECT_EQ(3u, caps.advanced_capabilities[5].values.size()); histograms.ExpectUniqueSample("Printing.CUPS.IppAttributesCount", 5, 1); } -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } // namespace printing diff --git a/printing/backend/mojom/BUILD.gn b/printing/backend/mojom/BUILD.gn index 3433bc1ad039e0..5a4fdc6abfd697 100644 --- a/printing/backend/mojom/BUILD.gn +++ b/printing/backend/mojom/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chromeos/ui_mode.gni") import("//mojo/public/tools/bindings/mojom.gni") mojom("mojom") { @@ -30,11 +31,14 @@ mojom("mojom") { ] traits_sources = [ "print_backend_mojom_traits.cc" ] traits_headers = [ "print_backend_mojom_traits.h" ] - traits_deps = [ "//printing:printing" ] + traits_deps = [ + "//build:chromeos_buildflags", + "//printing:printing", + ] }, ] - if (is_chromeos) { + if (is_chromeos_ash) { cpp_typemaps += [ { types = [ diff --git a/printing/backend/mojom/print_backend_mojom_traits.cc b/printing/backend/mojom/print_backend_mojom_traits.cc index 473be1bd34a65d..ca7a99e5182d0f 100644 --- a/printing/backend/mojom/print_backend_mojom_traits.cc +++ b/printing/backend/mojom/print_backend_mojom_traits.cc @@ -7,6 +7,7 @@ #include #include "base/logging.h" +#include "build/chromeos_buildflags.h" #include "ui/gfx/geometry/mojom/geometry.mojom-shared.h" #include "ui/gfx/geometry/mojom/geometry_mojom_traits.h" @@ -38,7 +39,7 @@ struct less<::printing::PrinterSemanticCapsAndDefaults::Paper> { } }; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) template <> struct less<::printing::AdvancedCapability> { bool operator()(const ::printing::AdvancedCapability& lhs, @@ -48,7 +49,7 @@ struct less<::printing::AdvancedCapability> { return lhs.display_name < rhs.display_name; } }; -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } // namespace std @@ -114,7 +115,7 @@ bool StructTraitsvendor_id) && data.ReadSizeUm(&out->size_um); } -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) // static printing::mojom::AdvancedCapabilityType EnumTraitsdefault_value) && data.ReadValues(&out->values); } -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) // static bool StructTraitspin_supported = data.pin_supported(); if (!data.ReadAdvancedCapabilities(&out->advanced_capabilities)) return false; -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) // Extra validity checks. @@ -247,7 +248,7 @@ bool StructTraits advanced_capabilities_dup_checker; if (advanced_capabilities_dup_checker.HasDuplicates( @@ -255,7 +256,7 @@ bool StructTraits #include +#include "build/chromeos_buildflags.h" #include "printing/backend/mojom/print_backend.mojom-shared.h" #include "printing/backend/print_backend.h" #include "printing/mojom/print.mojom.h" @@ -63,7 +64,7 @@ struct StructTraits struct EnumTraits { @@ -114,7 +115,7 @@ struct StructTraits struct StructTraits #include +#include "build/chromeos_buildflags.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "printing/backend/mojom/print_backend.mojom.h" #include "printing/backend/print_backend.h" @@ -29,7 +30,7 @@ const printing::PrinterSemanticCapsAndDefaults::Paper kPaperLedger{ /*display_name=*/"Ledger", /*vendor_id=*/"89", /*size_um=*/gfx::Size(6600, 10200)}; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) const printing::AdvancedCapability kAdvancedCapability1( /*name=*/"advanced_cap_bool", /*display_name=*/"Advanced Capability #1 (bool)", @@ -55,7 +56,7 @@ const printing::AdvancedCapability kAdvancedCapability2( }); const printing::AdvancedCapabilities kAdvancedCapabilities{ kAdvancedCapability1, kAdvancedCapability2}; -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) static constexpr bool kCollateCapable = true; static constexpr bool kCollateDefault = true; @@ -83,7 +84,7 @@ static constexpr gfx::Size kDpi1200(1200, 1200); static constexpr gfx::Size kDpi1200x600(1200, 600); const std::vector kDpis{kDpi600, kDpi1200, kDpi1200x600}; static constexpr gfx::Size kDefaultDpi = kDpi600; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) static constexpr bool kPinSupported = true; #endif @@ -105,10 +106,10 @@ GenerateSamplePrinterSemanticCapsAndDefaults() { caps.default_paper = kPaperLetter; caps.dpis = kDpis; caps.default_dpi = kDefaultDpi; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) caps.pin_supported = kPinSupported; caps.advanced_capabilities = kAdvancedCapabilities; -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) return caps; } @@ -189,7 +190,7 @@ TEST(PrintBackendMojomTraitsTest, TestSerializeAndDeserializePaper) { } } -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) TEST(PrintBackendMojomTraitsTest, TestSerializeAndDeserializeAdvancedCapability) { for (const auto& advanced_capability : kAdvancedCapabilities) { @@ -200,7 +201,7 @@ TEST(PrintBackendMojomTraitsTest, EXPECT_EQ(advanced_capability, output); } } -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) TEST(PrintBackendMojomTraitsTest, TestSerializeAndDeserializePrinterSemanticCapsAndDefaults) { @@ -225,10 +226,10 @@ TEST(PrintBackendMojomTraitsTest, EXPECT_TRUE(kDefaultPaper == output.default_paper); EXPECT_EQ(kDpis, output.dpis); EXPECT_EQ(kDefaultDpi, output.default_dpi); -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) EXPECT_EQ(kPinSupported, output.pin_supported); EXPECT_EQ(kAdvancedCapabilities, output.advanced_capabilities); -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } TEST(PrintBackendMojomTraitsTest, @@ -257,14 +258,14 @@ TEST( const printing::PrinterSemanticCapsAndDefaults::Papers kEmptyUserDefinedPapers{}; const std::vector kEmptyDpis{}; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) const printing::AdvancedCapabilities kEmptyAdvancedCapabilities{}; #endif input.duplex_modes = kEmptyDuplexModes; input.user_defined_papers = kEmptyUserDefinedPapers; input.dpis = kEmptyDpis; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) input.advanced_capabilities = kEmptyAdvancedCapabilities; #endif @@ -274,7 +275,7 @@ TEST( EXPECT_EQ(kEmptyDuplexModes, output.duplex_modes); EXPECT_EQ(kEmptyUserDefinedPapers, output.user_defined_papers); EXPECT_EQ(kEmptyDpis, output.dpis); -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) EXPECT_EQ(kEmptyAdvancedCapabilities, output.advanced_capabilities); #endif } @@ -331,7 +332,7 @@ TEST( EXPECT_FALSE(mojo::test::SerializeAndDeserialize< printing::mojom::PrinterSemanticCapsAndDefaults>(input, output)); -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) // Use an advanced capability with same name but different other fields. printing::AdvancedCapability advancedCapability1Prime = kAdvancedCapability1; advancedCapability1Prime.type = printing::AdvancedCapability::Type::kInteger; diff --git a/printing/backend/print_backend.cc b/printing/backend/print_backend.cc index 36661ccd7aa77e..9e5820fa387cd5 100644 --- a/printing/backend/print_backend.cc +++ b/printing/backend/print_backend.cc @@ -45,7 +45,7 @@ bool PrinterBasicInfo::operator==(const PrinterBasicInfo& other) const { is_default == other.is_default && options == other.options; } -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) AdvancedCapabilityValue::AdvancedCapabilityValue() = default; @@ -89,7 +89,7 @@ bool AdvancedCapability::operator==(const AdvancedCapability& other) const { values == other.values; } -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) bool PrinterSemanticCapsAndDefaults::Paper::operator==( const PrinterSemanticCapsAndDefaults::Paper& other) const { diff --git a/printing/backend/print_backend.h b/printing/backend/print_backend.h index 4aeb42359d6ea3..e853381d2afc88 100644 --- a/printing/backend/print_backend.h +++ b/printing/backend/print_backend.h @@ -20,7 +20,7 @@ #include "printing/printing_export.h" #include "ui/gfx/geometry/size.h" -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) #include #endif @@ -61,7 +61,7 @@ struct PRINTING_EXPORT PrinterBasicInfo { using PrinterList = std::vector; -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) struct PRINTING_EXPORT AdvancedCapabilityValue { AdvancedCapabilityValue(); @@ -111,7 +111,7 @@ struct PRINTING_EXPORT AdvancedCapability { using AdvancedCapabilities = std::vector; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults { PrinterSemanticCapsAndDefaults(); @@ -149,10 +149,10 @@ struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults { std::vector dpis; gfx::Size default_dpi; -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) bool pin_supported = false; AdvancedCapabilities advanced_capabilities; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) }; struct PRINTING_EXPORT PrinterCapsAndDefaults { diff --git a/printing/backend/printing_restrictions.cc b/printing/backend/printing_restrictions.cc index 17a4c949d52e43..b23f89f7eda176 100644 --- a/printing/backend/printing_restrictions.cc +++ b/printing/backend/printing_restrictions.cc @@ -8,14 +8,14 @@ namespace printing { -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) const char kAllowedColorModes[] = "allowedColorModes"; const char kAllowedDuplexModes[] = "allowedDuplexModes"; const char kAllowedPinModes[] = "allowedPinModes"; const char kDefaultColorMode[] = "defaultColorMode"; const char kDefaultDuplexMode[] = "defaultDuplexMode"; const char kDefaultPinMode[] = "defaultPinMode"; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) const char kPaperSizeName[] = "name"; const char kPaperSizeNameCustomOption[] = "custom"; diff --git a/printing/backend/printing_restrictions.h b/printing/backend/printing_restrictions.h index 99d281e245de46..c1c206d341f61a 100644 --- a/printing/backend/printing_restrictions.h +++ b/printing/backend/printing_restrictions.h @@ -10,7 +10,7 @@ namespace printing { -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) // Allowed printing modes as a bitmask. // This is used in pref file and should never change. enum class ColorModeRestriction { @@ -46,7 +46,7 @@ PRINTING_EXPORT extern const char kAllowedPinModes[]; PRINTING_EXPORT extern const char kDefaultColorMode[]; PRINTING_EXPORT extern const char kDefaultDuplexMode[]; PRINTING_EXPORT extern const char kDefaultPinMode[]; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) // Allowed background graphics modes. // This is used in pref file and should never change. diff --git a/printing/buildflags/buildflags.gni b/printing/buildflags/buildflags.gni index 86febe492a51fb..058e7f77747eed 100644 --- a/printing/buildflags/buildflags.gni +++ b/printing/buildflags/buildflags.gni @@ -4,6 +4,7 @@ import("//build/config/chromecast_build.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") @@ -24,7 +25,7 @@ declare_args() { # For fuzzing, just restrict to chromeos and linux. use_cups = true } else { - use_cups = (is_chromeos_device || is_linux || is_mac) && !is_chromecast && - !is_fuchsia + use_cups = (is_chromeos_device || (is_linux || is_chromeos_lacros) || + is_mac) && !is_chromecast && !is_fuchsia } } diff --git a/printing/print_settings.cc b/printing/print_settings.cc index 7c43ddeafadc8e..c22c0502d79e7a 100644 --- a/printing/print_settings.cc +++ b/printing/print_settings.cc @@ -10,7 +10,7 @@ #include "build/chromeos_buildflags.h" #include "printing/units.h" -#if defined(USE_CUPS) && (defined(OS_MAC) || BUILDFLAG(IS_ASH)) +#if defined(USE_CUPS) && (defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH)) #include #endif @@ -183,7 +183,7 @@ void GetColorModelForModel(mojom::ColorModel color_model, // all ColorModel values are determinantly handled. } -#if defined(OS_MAC) || BUILDFLAG(IS_ASH) +#if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) std::string GetIppColorModelForModel(mojom::ColorModel color_model) { // Accept |kUnknownColorModel| for consistency with GetColorModelForModel(). if (color_model == mojom::ColorModel::kUnknownColorModel) @@ -198,7 +198,7 @@ std::string GetIppColorModelForModel(mojom::ColorModel color_model) { return is_color.value() ? CUPS_PRINT_COLOR_MODE_COLOR : CUPS_PRINT_COLOR_MODE_MONOCHROME; } -#endif // defined(OS_MAC) || BUILDFLAG(IS_ASH) +#endif // defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) #endif // defined(USE_CUPS) base::Optional IsColorModelSelected(mojom::ColorModel color_model) { @@ -281,11 +281,11 @@ void PrintSettings::Clear() { #if defined(OS_LINUX) || defined(OS_CHROMEOS) advanced_settings_.clear(); #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) send_user_info_ = false; username_.clear(); pin_value_.clear(); -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } void PrintSettings::SetPrinterPrintableArea( diff --git a/printing/print_settings.h b/printing/print_settings.h index f15f1f84fc7d0d..c3277c631ce1e6 100644 --- a/printing/print_settings.h +++ b/printing/print_settings.h @@ -44,7 +44,7 @@ PRINTING_EXPORT void GetColorModelForModel(mojom::ColorModel color_model, std::string* color_setting_name, std::string* color_value); -#if defined(OS_MAC) || BUILDFLAG(IS_ASH) +#if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) // Convert from |color_model| to a print-color-mode value from PWG 5100.13. PRINTING_EXPORT std::string GetIppColorModelForModel( mojom::ColorModel color_model); @@ -229,7 +229,7 @@ class PRINTING_EXPORT PrintSettings { } #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) void set_send_user_info(bool send_user_info) { send_user_info_ = send_user_info; } @@ -240,7 +240,7 @@ class PRINTING_EXPORT PrintSettings { void set_pin_value(const std::string& pin_value) { pin_value_ = pin_value; } const std::string& pin_value() const { return pin_value_; } -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) // Cookie generator. It is used to initialize PrintedDocument with its // associated PrintSettings, to be sure that each generated PrintedPage is @@ -326,7 +326,7 @@ class PRINTING_EXPORT PrintSettings { AdvancedSettings advanced_settings_; #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) // Whether to send user info. bool send_user_info_; diff --git a/printing/print_settings_conversion.cc b/printing/print_settings_conversion.cc index 686a2fa1ab4a33..15e52e7b153d49 100644 --- a/printing/print_settings_conversion.cc +++ b/printing/print_settings_conversion.cc @@ -211,16 +211,21 @@ std::unique_ptr PrintSettingsFromJobSettings( #endif } -#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && defined(USE_CUPS)) +// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is +// complete. +#if defined(OS_CHROMEOS) || \ + ((defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ + defined(USE_CUPS)) const base::Value* advanced_settings = job_settings.FindDictKey(kSettingAdvancedSettings); if (advanced_settings) { for (const auto& item : advanced_settings->DictItems()) settings->advanced_settings().emplace(item.first, item.second.Clone()); } -#endif // defined(OS_CHROMEOS) || (defined(OS_LINUX) && defined(USE_CUPS)) +#endif // defined(OS_CHROMEOS) || ((defined(OS_LINUX) || + // BUILDFLAG(IS_CHROMEOS_LACROS)) && defined(USE_CUPS)) -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) bool send_user_info = job_settings.FindBoolKey(kSettingSendUserInfo).value_or(false); settings->set_send_user_info(send_user_info); @@ -233,7 +238,7 @@ std::unique_ptr PrintSettingsFromJobSettings( const std::string* pin_value = job_settings.FindStringKey(kSettingPinValue); if (pin_value) settings->set_pin_value(*pin_value); -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) return settings; } diff --git a/printing/print_settings_conversion_unittest.cc b/printing/print_settings_conversion_unittest.cc index 2f410d2d4621fa..75a0b79453fbc4 100644 --- a/printing/print_settings_conversion_unittest.cc +++ b/printing/print_settings_conversion_unittest.cc @@ -61,7 +61,7 @@ TEST(PrintSettingsConversionTest, ConversionTest) { std::unique_ptr settings = PrintSettingsFromJobSettings(value.value()); ASSERT_TRUE(settings); -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) EXPECT_TRUE(settings->send_user_info()); EXPECT_EQ("username@domain.net", settings->username()); EXPECT_EQ("0000", settings->pin_value()); @@ -78,7 +78,7 @@ TEST(PrintSettingsConversionTest, ConversionTest) { EXPECT_FALSE(settings); } -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) TEST(PrintSettingsConversionTest, ConversionTest_DontSendUsername) { base::Optional value = base::JSONReader::Read(kPrinterSettings); ASSERT_TRUE(value.has_value()); diff --git a/printing/print_settings_unittest.cc b/printing/print_settings_unittest.cc index c66d82ea8f7aed..56c0c430a13c7d 100644 --- a/printing/print_settings_unittest.cc +++ b/printing/print_settings_unittest.cc @@ -56,7 +56,7 @@ TEST(PrintSettingsTest, GetColorModelForModel) { } } -#if defined(OS_MAC) || BUILDFLAG(IS_ASH) +#if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) TEST(PrintSettingsTest, GetIppColorModelForModel) { for (int model = static_cast(mojom::ColorModel::kUnknownColorModel); model <= static_cast(mojom::ColorModel::kColorModelLast); ++model) { @@ -64,7 +64,7 @@ TEST(PrintSettingsTest, GetIppColorModelForModel) { .empty()); } } -#endif // defined(OS_MAC) || BUILDFLAG(IS_ASH) +#endif // defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) #endif // defined(USE_CUPS) } // namespace printing diff --git a/printing/printed_document_linux.cc b/printing/printed_document_linux.cc index e3ef9ae649a5a8..c2e2a5d59e1f35 100644 --- a/printing/printed_document_linux.cc +++ b/printing/printed_document_linux.cc @@ -8,7 +8,7 @@ #include "build/chromeos_buildflags.h" #include "printing/printing_context_linux.h" -#if defined(OS_ANDROID) || BUILDFLAG(IS_ASH) +#if defined(OS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH) #error "This file is not used on Android / ChromeOS ash-chrome" #endif diff --git a/printing/printing_context.cc b/printing/printing_context.cc index 49e0e83868dc8f..92561ff7c6bce6 100644 --- a/printing/printing_context.cc +++ b/printing/printing_context.cc @@ -146,7 +146,7 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings( job_settings.FindIntKey(kSettingPreviewPageCount).value_or(0)); } -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) PrintingContext::Result PrintingContext::UpdatePrintSettingsFromPOD( std::unique_ptr job_settings) { ResetSettings(); diff --git a/printing/printing_context.h b/printing/printing_context.h index 896d1b26f49286..268e03d2b8d4f1 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h @@ -87,7 +87,7 @@ class PRINTING_EXPORT PrintingContext { // settings information. Result UpdatePrintSettings(base::Value job_settings); -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) // Updates Print Settings. Result UpdatePrintSettingsFromPOD( std::unique_ptr job_settings); diff --git a/printing/printing_features.cc b/printing/printing_features.cc index 7feeeba13f069b..637f7ff47090f4 100644 --- a/printing/printing_features.cc +++ b/printing/printing_features.cc @@ -9,11 +9,11 @@ namespace printing { namespace features { -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) // Enables Advanced PPD Attributes. const base::Feature kAdvancedPpdAttributes{"AdvancedPpdAttributes", base::FEATURE_ENABLED_BY_DEFAULT}; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) #if defined(OS_MAC) // Use the CUPS IPP printing backend instead of the original CUPS backend that diff --git a/printing/printing_features.h b/printing/printing_features.h index 7dda9ddd52c234..35faf4a98b566b 100644 --- a/printing/printing_features.h +++ b/printing/printing_features.h @@ -16,9 +16,9 @@ namespace features { // The following features are declared alphabetically. The features should be // documented with descriptions of their behaviors in the .cc file. -#if BUILDFLAG(IS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) PRINTING_EXPORT extern const base::Feature kAdvancedPpdAttributes; -#endif // BUILDFLAG(IS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) #if defined(OS_MAC) PRINTING_EXPORT extern const base::Feature kCupsIppPrintingBackend;