Commit 578cd722 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Migrate to OS_MAC and OS_APPLE in printing

Bug: 1105907
Change-Id: I28cd4d958b4767b052c2821ec1032beb09579b6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2324899
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792755}
parent d2b033e6
......@@ -87,7 +87,7 @@ bool CupsPrinter::ToPrinterInfo(PrinterBasicInfo* printer_info) const {
const std::string info = GetInfo();
const std::string make_and_model = GetMakeAndModel();
#if defined(OS_MACOSX)
#if defined(OS_MAC)
// On Mac, "printer-info" option specifies the human-readable printer name,
// while "printer-make-and-model" specifies the printer description.
printer_info->display_name = info;
......@@ -96,7 +96,7 @@ bool CupsPrinter::ToPrinterInfo(PrinterBasicInfo* printer_info) const {
// On other platforms, "printer-info" specifies the printer description.
printer_info->display_name = printer->name;
printer_info->printer_description = info;
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
const char* state = cupsGetOption(kCUPSOptPrinterState, printer->num_options,
printer->options);
......
......@@ -24,12 +24,12 @@
#include "printing/backend/print_backend_consts.h"
#include "url/gurl.h"
#if defined(OS_MACOSX)
#if defined(OS_MAC)
#include "printing/backend/cups_connection.h"
#include "printing/backend/cups_ipp_utils.h"
#include "printing/backend/print_backend_cups_ipp.h"
#include "printing/printing_features.h"
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
namespace printing {
......@@ -85,7 +85,7 @@ bool PrintBackendCUPS::PrinterBasicInfoFromCUPS(
printer.options[opt_index].value;
}
#if defined(OS_MACOSX)
#if defined(OS_MAC)
// On Mac, "printer-info" option specifies the printer name and
// "printer-make-and-model" specifies the printer description.
if (info)
......@@ -223,13 +223,13 @@ scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl(
const base::DictionaryValue* print_backend_settings,
const std::string& locale,
bool for_cloud_print) {
#if defined(OS_MACOSX)
#if defined(OS_MAC)
if (!for_cloud_print &&
base::FeatureList::IsEnabled(features::kCupsIppPrintingBackend)) {
return base::MakeRefCounted<PrintBackendCupsIpp>(
CreateConnection(print_backend_settings), locale);
}
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
std::string print_server_url_str, cups_blocking;
int encryption = HTTP_ENCRYPT_NEVER;
if (print_backend_settings) {
......
......@@ -50,7 +50,7 @@ TEST(PrintBackendCupsTest, PrinterBasicInfoFromCUPS) {
int num_options = 0;
cups_option_t* options = nullptr;
#if defined(OS_MACOSX)
#if defined(OS_MAC)
num_options =
cupsAddOption(kCUPSOptPrinterInfo, "info", num_options, &options);
num_options = cupsAddOption(kCUPSOptPrinterMakeAndModel, "description",
......@@ -68,7 +68,7 @@ TEST(PrintBackendCupsTest, PrinterBasicInfoFromCUPS) {
cupsFreeDests(/*num_dests=*/1, printer);
EXPECT_EQ(kName, printer_info.printer_name);
#if defined(OS_MACOSX)
#if defined(OS_MAC)
EXPECT_EQ("info", printer_info.display_name);
#else
EXPECT_EQ(kName, printer_info.display_name);
......
......@@ -18,7 +18,7 @@
#if defined(OS_WIN)
#include <windows.h>
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
#include <ApplicationServices/ApplicationServices.h>
#include <CoreFoundation/CoreFoundation.h>
#include "base/mac/scoped_cftyperef.h"
......@@ -48,7 +48,7 @@ class PRINTING_EXPORT MetafilePlayer {
// details.
virtual bool SafePlayback(printing::NativeDrawingContext hdc) const = 0;
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
// Renders the given page into |rect| in the given context.
// Pages use a 1-based index. |autorotate| determines whether the source PDF
// should be autorotated to fit on the destination page. |fit_to_page|
......
......@@ -30,7 +30,7 @@
#include "third_party/skia/src/utils/SkMultiPictureDocument.h"
#include "ui/gfx/skia_util.h"
#if defined(OS_MACOSX)
#if defined(OS_MAC)
#include "printing/pdf_metafile_cg_mac.h"
#endif
......@@ -87,7 +87,7 @@ struct MetafileSkiaData {
SkSize size;
mojom::SkiaDocumentType type;
#if defined(OS_MACOSX)
#if defined(OS_MAC)
PdfMetafileCg pdf_cg;
#endif
};
......@@ -294,7 +294,7 @@ bool MetafileSkia::SafePlayback(printing::NativeDrawingContext hdc) const {
return false;
}
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
/* TODO(caryclark): The set up of PluginInstance::PrintPDFOutput may result in
rasterized output. Even if that flow uses PdfMetafileCg::RenderPage,
the drawing of the PDF into the canvas may result in a rasterized output.
......
......@@ -64,7 +64,7 @@ class PRINTING_EXPORT MetafileSkia : public Metafile {
bool Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const override;
bool SafePlayback(printing::NativeDrawingContext hdc) const override;
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
bool RenderPage(unsigned int page_number,
printing::NativeDrawingContext context,
const CGRect& rect,
......
......@@ -9,7 +9,7 @@
#if defined(OS_WIN)
#include <windows.h>
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
typedef struct CGContext* CGContextRef;
#endif
......@@ -17,7 +17,7 @@ namespace printing {
#if defined(OS_WIN)
typedef HDC NativeDrawingContext;
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
typedef CGContextRef NativeDrawingContext;
#else
typedef void* NativeDrawingContext;
......
......@@ -10,7 +10,7 @@
#include "printing/print_job_constants.h"
#include "printing/units.h"
#if defined(USE_CUPS) && (defined(OS_MACOSX) || defined(OS_CHROMEOS))
#if defined(USE_CUPS) && (defined(OS_MAC) || defined(OS_CHROMEOS))
#include <cups/cups.h>
#endif
......@@ -40,7 +40,7 @@ const std::string& GetAgent() {
void GetColorModelForMode(int color_mode,
std::string* color_setting_name,
std::string* color_value) {
#if defined(OS_MACOSX)
#if defined(OS_MAC)
constexpr char kCUPSColorMode[] = "ColorMode";
constexpr char kCUPSColorModel[] = "ColorModel";
constexpr char kCUPSPrintoutMode[] = "PrintoutMode";
......@@ -60,7 +60,7 @@ void GetColorModelForMode(int color_mode,
constexpr char kCUPSEpsonInk[] = "cups-Ink";
constexpr char kCUPSSharpARCMode[] = "cups-ARCMode";
constexpr char kCUPSXeroxXRXColor[] = "cups-XRXColor";
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
*color_setting_name = kCUPSColorModel;
......@@ -188,7 +188,7 @@ void GetColorModelForMode(int color_mode,
// all ColorModel values are determinantly handled.
}
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
#if defined(OS_MAC) || defined(OS_CHROMEOS)
std::string GetIppColorModelForMode(int color_mode) {
// Accept |UNKNOWN_COLOR_MODEL| for consistency with GetColorModelForMode().
if (color_mode == UNKNOWN_COLOR_MODEL)
......@@ -203,7 +203,7 @@ std::string GetIppColorModelForMode(int color_mode) {
return is_color.value() ? CUPS_PRINT_COLOR_MODE_COLOR
: CUPS_PRINT_COLOR_MODE_MONOCHROME;
}
#endif // defined(OS_MACOSX) || defined(OS_CHROMEOS)
#endif // defined(OS_MAC) || defined(OS_CHROMEOS)
#endif // defined(USE_CUPS)
base::Optional<bool> IsColorModelSelected(int color_mode) {
......
......@@ -38,7 +38,7 @@ PRINTING_EXPORT void GetColorModelForMode(int color_mode,
std::string* color_setting_name,
std::string* color_value);
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
#if defined(OS_MAC) || defined(OS_CHROMEOS)
// Convert from |color_mode| to a print-color-mode value from PWG 5100.13.
PRINTING_EXPORT std::string GetIppColorModelForMode(int color_mode);
#endif
......@@ -141,11 +141,11 @@ class PRINTING_EXPORT PrintSettings {
bool supports_alpha_blend() const { return supports_alpha_blend_; }
int device_units_per_inch() const {
#if defined(OS_MACOSX)
#if defined(OS_MAC)
return 72;
#else // defined(OS_MACOSX)
#else // defined(OS_MAC)
return dpi();
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
}
void set_ranges(const PageRanges& ranges) { ranges_ = ranges; }
......
......@@ -45,7 +45,7 @@ TEST(PrintSettingsDeathTest, GetColorModelForModeEdges) {
&color_setting_name, &color_value));
}
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
#if defined(OS_MAC) || defined(OS_CHROMEOS)
TEST(PrintSettingsTest, GetIppColorModelForMode) {
for (int model = UNKNOWN_COLOR_MODEL; model <= COLOR_MODEL_LAST; ++model)
EXPECT_FALSE(GetIppColorModelForMode(model).empty());
......@@ -56,7 +56,7 @@ TEST(PrintSettingsDeathTest, GetIppColorModelForModeEdges) {
EXPECT_DCHECK_DEATH(GetIppColorModelForMode(UNKNOWN_COLOR_MODEL - 1));
EXPECT_DCHECK_DEATH(GetIppColorModelForMode(COLOR_MODEL_LAST + 1));
}
#endif // defined(OS_MACOSX) || defined(OS_CHROMEOS)
#endif // defined(OS_MAC) || defined(OS_CHROMEOS)
#endif // defined(USE_CUPS)
} // namespace printing
......@@ -13,7 +13,7 @@ const base::Feature kAdvancedPpdAttributes{"AdvancedPpdAttributes",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
// Use the CUPS IPP printing backend instead of the original CUPS backend that
// calls the deprecated PPD API.
const base::Feature kCupsIppPrintingBackend{"CupsIppPrintingBackend",
......@@ -21,7 +21,7 @@ const base::Feature kCupsIppPrintingBackend{"CupsIppPrintingBackend",
const base::Feature kEnableCustomMacPaperSizes{
"EnableCustomMacPaperSizes", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_WIN)
// When using GDI printing, avoid rasterization if possible.
......
......@@ -19,10 +19,10 @@ namespace features {
PRINTING_EXPORT extern const base::Feature kAdvancedPpdAttributes;
#endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
PRINTING_EXPORT extern const base::Feature kCupsIppPrintingBackend;
PRINTING_EXPORT extern const base::Feature kEnableCustomMacPaperSizes;
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_WIN)
PRINTING_EXPORT extern const base::Feature kPrintWithReducedRasterization;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment