0

LaCrOS: Replace defined(OS_CHROMEOS) with BUILDFLAG(IS_CHROMEOS_ASH)

The change is mostly mechanical replacing defined(OS_CHROMEOS) with
BUILDFLAG(IS_CHROMEOS_ASH) and GN variable is_chromeos with
is_chromeos_ash with some special cases (For those cases please
refer to http://go/lacros-macros).

The patch is made in preparation to switching lacros build from
target_os=linux to target_os=chromeos. This will prevent lacros from
changing behaviour after the switch.

Bug: 1052397
Change-Id: Iad750ef52b3a42cc0339e8e6fdb682c4cf397b16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550844
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Wei Li <weili@chromium.org>
Commit-Queue: Yuta Hijikata <ythjkt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833996}
This commit is contained in:
Yuta Hijikata
2020-12-05 05:31:15 +00:00
committed by Chromium LUCI CQ
parent 9b5d9de133
commit 34c1b554ae
24 changed files with 100 additions and 86 deletions

@ -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 += [

@ -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

@ -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

@ -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);

@ -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

@ -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 = [

@ -7,6 +7,7 @@
#include <map>
#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 StructTraits<printing::mojom::PaperDataView,
data.ReadVendorId(&out->vendor_id) && data.ReadSizeUm(&out->size_um);
}
#if defined(OS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
// static
printing::mojom::AdvancedCapabilityType
EnumTraits<printing::mojom::AdvancedCapabilityType,
@ -176,7 +177,7 @@ bool StructTraits<printing::mojom::AdvancedCapabilityDataView,
data.ReadDefaultValue(&out->default_value) &&
data.ReadValues(&out->values);
}
#endif // defined(OS_CHROMEOS)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
// static
bool StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
@ -200,11 +201,11 @@ bool StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
return false;
}
#if defined(OS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
out->pin_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<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
return false;
}
#if defined(OS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
DuplicateChecker<printing::AdvancedCapability>
advanced_capabilities_dup_checker;
if (advanced_capabilities_dup_checker.HasDuplicates(
@ -255,7 +256,7 @@ bool StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
DLOG(ERROR) << "Duplicate advanced_capabilities detected.";
return false;
}
#endif // defined(OS_CHROMEOS)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
return true;
}

@ -8,6 +8,7 @@
#include <string>
#include <vector>
#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<printing::mojom::PaperDataView,
printing::PrinterSemanticCapsAndDefaults::Paper* out);
};
#if defined(OS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
template <>
struct EnumTraits<printing::mojom::AdvancedCapabilityType,
::printing::AdvancedCapability::Type> {
@ -114,7 +115,7 @@ struct StructTraits<printing::mojom::AdvancedCapabilityDataView,
static bool Read(printing::mojom::AdvancedCapabilityDataView data,
::printing::AdvancedCapability* out);
};
#endif // defined(OS_CHROMEOS)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
template <>
struct StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
@ -174,7 +175,7 @@ struct StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
return p.default_dpi;
}
#if defined(OS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
static bool pin_supported(const printing::PrinterSemanticCapsAndDefaults& p) {
return p.pin_supported;
}
@ -182,7 +183,7 @@ struct StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
const printing::PrinterSemanticCapsAndDefaults& p) {
return p.advanced_capabilities;
}
#endif // defined(OS_CHROMEOS)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
static bool Read(printing::mojom::PrinterSemanticCapsAndDefaultsDataView data,
printing::PrinterSemanticCapsAndDefaults* out);

@ -6,6 +6,7 @@
#include <string>
#include <vector>
#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<gfx::Size> 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<gfx::Size> 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;

@ -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 {

@ -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 <stdint.h>
#endif
@ -61,7 +61,7 @@ struct PRINTING_EXPORT PrinterBasicInfo {
using PrinterList = std::vector<PrinterBasicInfo>;
#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<AdvancedCapability>;
#endif // BUILDFLAG(IS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults {
PrinterSemanticCapsAndDefaults();
@ -149,10 +149,10 @@ struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults {
std::vector<gfx::Size> 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 {

@ -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";

@ -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.

@ -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
}
}

@ -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 <cups/cups.h>
#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<bool> 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(

@ -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_;

@ -211,16 +211,21 @@ std::unique_ptr<PrintSettings> 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<PrintSettings> 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;
}

@ -61,7 +61,7 @@ TEST(PrintSettingsConversionTest, ConversionTest) {
std::unique_ptr<PrintSettings> 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<base::Value> value = base::JSONReader::Read(kPrinterSettings);
ASSERT_TRUE(value.has_value());

@ -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<int>(mojom::ColorModel::kUnknownColorModel);
model <= static_cast<int>(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

@ -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

@ -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<PrintSettings> job_settings) {
ResetSettings();

@ -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<PrintSettings> job_settings);

@ -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

@ -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;