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