0

Cleanup //printing component usage

Switch away from the deprecated pattern for the printing component, per
https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md#chrome_s-deprecated-pattern-for-exports.

Bug: b/179305160
Change-Id: I7e5512b2a487cf5f8a119bacb4ef7588fc5f47af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2848953
Reviewed-by: Alan Screen <awscreen@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Alan Screen <awscreen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#876669}
This commit is contained in:
Alan Screen
2021-04-27 18:11:24 +00:00
committed by Chromium LUCI CQ
parent 97f15dda0e
commit 9347cae7fc
45 changed files with 317 additions and 340 deletions

@@ -32,12 +32,6 @@ declare_args() {
use_cups_ipp = use_cups && !(is_linux || is_chromeos_lacros) use_cups_ipp = use_cups && !(is_linux || is_chromeos_lacros)
} }
# Several targets want to include this header file. We separate it out
# here so multiple targets can depend on it.
source_set("printing_export") {
sources = [ "printing_export.h" ]
}
if (use_cups_ipp && is_chromeos_ash) { if (use_cups_ipp && is_chromeos_ash) {
ipp_handler_map_path = "$target_gen_dir/backend/ipp_handler_map.cc" ipp_handler_map_path = "$target_gen_dir/backend/ipp_handler_map.cc"
@@ -55,8 +49,7 @@ if (is_linux || is_chromeos) {
"sandbox/print_backend_sandbox_hook_linux.h", "sandbox/print_backend_sandbox_hook_linux.h",
] ]
deps = [ deps = [
":printing_export", "//base",
"//base:base",
"//sandbox/linux:sandbox_services", "//sandbox/linux:sandbox_services",
"//sandbox/policy", "//sandbox/policy",
"//services/network:network_sandbox_hook", "//services/network:network_sandbox_hook",
@@ -111,11 +104,10 @@ component("printing") {
configs += [ "//build/config/compiler:noshadowing" ] configs += [ "//build/config/compiler:noshadowing" ]
cflags = [] cflags = []
defines = [ "PRINTING_IMPLEMENTATION" ] defines = [ "IS_PRINTING_IMPL" ]
public_deps = [ "//printing/buildflags" ] public_deps = [ "//printing/buildflags" ]
deps = [ deps = [
":printing_export",
"//base", "//base",
"//base:i18n", "//base:i18n",
"//base/third_party/dynamic_annotations", "//base/third_party/dynamic_annotations",

@@ -11,18 +11,18 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/component_export.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "printing/backend/cups_deleters.h" #include "printing/backend/cups_deleters.h"
#include "printing/backend/cups_jobs.h" #include "printing/backend/cups_jobs.h"
#include "printing/backend/cups_printer.h" #include "printing/backend/cups_printer.h"
#include "printing/printer_status.h" #include "printing/printer_status.h"
#include "printing/printing_export.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace printing { namespace printing {
// Represents the status of a printer queue. // Represents the status of a printer queue.
struct PRINTING_EXPORT QueueStatus { struct COMPONENT_EXPORT(PRINTING) QueueStatus {
QueueStatus(); QueueStatus();
QueueStatus(const QueueStatus& other); QueueStatus(const QueueStatus& other);
~QueueStatus(); ~QueueStatus();
@@ -32,7 +32,7 @@ struct PRINTING_EXPORT QueueStatus {
}; };
// Represents a connection to a CUPS server. // Represents a connection to a CUPS server.
class PRINTING_EXPORT CupsConnection { class COMPONENT_EXPORT(PRINTING) CupsConnection {
public: public:
virtual ~CupsConnection() = default; virtual ~CupsConnection() = default;

@@ -8,23 +8,23 @@
#include <cups/cups.h> #include <cups/cups.h>
#include <memory> #include <memory>
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
struct PRINTING_EXPORT HttpDeleter { struct COMPONENT_EXPORT(PRINTING) HttpDeleter {
void operator()(http_t* http) const; void operator()(http_t* http) const;
}; };
struct PRINTING_EXPORT DestinationDeleter { struct COMPONENT_EXPORT(PRINTING) DestinationDeleter {
void operator()(cups_dest_t* dest) const; void operator()(cups_dest_t* dest) const;
}; };
struct PRINTING_EXPORT DestInfoDeleter { struct COMPONENT_EXPORT(PRINTING) DestInfoDeleter {
void operator()(cups_dinfo_t* info) const; void operator()(cups_dinfo_t* info) const;
}; };
struct PRINTING_EXPORT OptionDeleter { struct COMPONENT_EXPORT(PRINTING) OptionDeleter {
void operator()(cups_option_t* option) const; void operator()(cups_option_t* option) const;
}; };

@@ -7,8 +7,8 @@
#include <cups/cups.h> #include <cups/cups.h>
#include "base/component_export.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "printing/printing_export.h"
class GURL; class GURL;
@@ -19,7 +19,7 @@ struct PrinterSemanticCapsAndDefaults;
// Helper wrapper around http_t structure, with connection and cleanup // Helper wrapper around http_t structure, with connection and cleanup
// functionality. // functionality.
class PRINTING_EXPORT HttpConnectionCUPS { class COMPONENT_EXPORT(PRINTING) HttpConnectionCUPS {
public: public:
HttpConnectionCUPS(const GURL& print_server_url, HttpConnectionCUPS(const GURL& print_server_url,
http_encryption_t encryption, http_encryption_t encryption,
@@ -34,11 +34,11 @@ class PRINTING_EXPORT HttpConnectionCUPS {
// Helper function to parse and convert PPD capabilitites to // Helper function to parse and convert PPD capabilitites to
// semantic options. // semantic options.
PRINTING_EXPORT bool ParsePpdCapabilities( COMPONENT_EXPORT(PRINTING)
cups_dest_t* dest, bool ParsePpdCapabilities(cups_dest_t* dest,
base::StringPiece locale, base::StringPiece locale,
base::StringPiece printer_capabilities, base::StringPiece printer_capabilities,
PrinterSemanticCapsAndDefaults* printer_info); PrinterSemanticCapsAndDefaults* printer_info);
} // namespace printing } // namespace printing

@@ -5,35 +5,35 @@
#ifndef PRINTING_BACKEND_CUPS_IPP_CONSTANTS_H_ #ifndef PRINTING_BACKEND_CUPS_IPP_CONSTANTS_H_
#define PRINTING_BACKEND_CUPS_IPP_CONSTANTS_H_ #define PRINTING_BACKEND_CUPS_IPP_CONSTANTS_H_
#include "base/component_export.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
#include "printing/printing_export.h"
namespace printing { namespace printing {
// property names // property names
PRINTING_EXPORT extern const char kIppCollate[]; COMPONENT_EXPORT(PRINTING) extern const char kIppCollate[];
PRINTING_EXPORT extern const char kIppCopies[]; COMPONENT_EXPORT(PRINTING) extern const char kIppCopies[];
PRINTING_EXPORT extern const char kIppColor[]; COMPONENT_EXPORT(PRINTING) extern const char kIppColor[];
PRINTING_EXPORT extern const char kIppMedia[]; COMPONENT_EXPORT(PRINTING) extern const char kIppMedia[];
PRINTING_EXPORT extern const char kIppDuplex[]; COMPONENT_EXPORT(PRINTING) extern const char kIppDuplex[];
PRINTING_EXPORT extern const char kIppRequestingUserName[]; COMPONENT_EXPORT(PRINTING) extern const char kIppRequestingUserName[];
PRINTING_EXPORT extern const char kIppResolution[]; COMPONENT_EXPORT(PRINTING) extern const char kIppResolution[];
PRINTING_EXPORT extern const char kIppPin[]; COMPONENT_EXPORT(PRINTING) extern const char kIppPin[];
PRINTING_EXPORT extern const char kIppPinEncryption[]; COMPONENT_EXPORT(PRINTING) extern const char kIppPinEncryption[];
// collation values // collation values
PRINTING_EXPORT extern const char kCollated[]; COMPONENT_EXPORT(PRINTING) extern const char kCollated[];
PRINTING_EXPORT extern const char kUncollated[]; COMPONENT_EXPORT(PRINTING) extern const char kUncollated[];
#if BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
PRINTING_EXPORT extern const char kIppDocumentAttributes[]; COMPONENT_EXPORT(PRINTING) extern const char kIppDocumentAttributes[];
PRINTING_EXPORT extern const char kIppJobAttributes[]; COMPONENT_EXPORT(PRINTING) extern const char kIppJobAttributes[];
PRINTING_EXPORT extern const char kPinEncryptionNone[]; COMPONENT_EXPORT(PRINTING) extern const char kPinEncryptionNone[];
PRINTING_EXPORT extern const char kOptionFalse[]; COMPONENT_EXPORT(PRINTING) extern const char kOptionFalse[];
PRINTING_EXPORT extern const char kOptionTrue[]; COMPONENT_EXPORT(PRINTING) extern const char kOptionTrue[];
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)

@@ -9,9 +9,9 @@
#include <memory> #include <memory>
#include "base/component_export.h"
#include "printing/backend/cups_printer.h" #include "printing/backend/cups_printer.h"
#include "printing/backend/print_backend.h" #include "printing/backend/print_backend.h"
#include "printing/printing_export.h"
namespace printing { namespace printing {
@@ -24,12 +24,12 @@ PrinterSemanticCapsAndDefaults::Paper DefaultPaper(
// Populates the `printer_info` object with attributes retrieved using IPP from // Populates the `printer_info` object with attributes retrieved using IPP from
// `printer`. // `printer`.
PRINTING_EXPORT void CapsAndDefaultsFromPrinter( COMPONENT_EXPORT(PRINTING)
const CupsOptionProvider& printer, void CapsAndDefaultsFromPrinter(const CupsOptionProvider& printer,
PrinterSemanticCapsAndDefaults* printer_info); PrinterSemanticCapsAndDefaults* printer_info);
// Wraps `ipp` in unique_ptr with appropriate deleter // Wraps `ipp` in unique_ptr with appropriate deleter
PRINTING_EXPORT ScopedIppPtr WrapIpp(ipp_t* ipp); COMPONENT_EXPORT(PRINTING) ScopedIppPtr WrapIpp(ipp_t* ipp);
} // namespace printing } // namespace printing

@@ -13,9 +13,9 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "base/component_export.h"
#include "base/version.h" #include "base/version.h"
#include "printing/printer_query_result.h" #include "printing/printer_query_result.h"
#include "printing/printing_export.h"
// This file contains a collection of functions used to query IPP printers or // This file contains a collection of functions used to query IPP printers or
// print servers and the related code to parse these responses. All Get* // print servers and the related code to parse these responses. All Get*
@@ -26,7 +26,7 @@ namespace printing {
struct PrinterStatus; struct PrinterStatus;
// Represents a print job sent to the queue. // Represents a print job sent to the queue.
struct PRINTING_EXPORT CupsJob { struct COMPONENT_EXPORT(PRINTING) CupsJob {
// Corresponds to job-state from RFC2911. // Corresponds to job-state from RFC2911.
enum JobState { enum JobState {
UNKNOWN, UNKNOWN,
@@ -58,8 +58,7 @@ struct PRINTING_EXPORT CupsJob {
int processing_started = 0; int processing_started = 0;
}; };
struct COMPONENT_EXPORT(PRINTING) PrinterInfo {
struct PRINTING_EXPORT PrinterInfo {
PrinterInfo(); PrinterInfo();
PrinterInfo(const PrinterInfo& info); PrinterInfo(const PrinterInfo& info);
@@ -88,7 +87,8 @@ enum JobCompletionState {
// Returns the uri for printer with `id` as served by CUPS. Assumes that `id` is // Returns the uri for printer with `id` as served by CUPS. Assumes that `id` is
// a valid CUPS printer name and performs no error checking or escaping. // a valid CUPS printer name and performs no error checking or escaping.
std::string PRINTING_EXPORT PrinterUriFromName(const std::string& id); std::string COMPONENT_EXPORT(PRINTING)
PrinterUriFromName(const std::string& id);
// Extracts structured job information from the `response` for `printer_id`. // Extracts structured job information from the `response` for `printer_id`.
// Extracted jobs are added to `jobs`. // Extracted jobs are added to `jobs`.
@@ -102,13 +102,13 @@ void ParsePrinterStatus(ipp_t* response, PrinterStatus* printer_status);
// Queries the printer at `address` on `port` with a Get-Printer-Attributes // Queries the printer at `address` on `port` with a Get-Printer-Attributes
// request to populate `printer_info`. If `encrypted` is true, request is made // request to populate `printer_info`. If `encrypted` is true, request is made
// using ipps, otherwise, ipp is used. Returns false if the request failed. // using ipps, otherwise, ipp is used. Returns false if the request failed.
PrinterQueryResult PRINTING_EXPORT PrinterQueryResult COMPONENT_EXPORT(PRINTING)
GetPrinterInfo(const std::string& address, GetPrinterInfo(const std::string& address,
int port, int port,
const std::string& resource, const std::string& resource,
bool encrypted, bool encrypted,
PrinterInfo* printer_info, PrinterInfo* printer_info,
PrinterStatus* printer_status); PrinterStatus* printer_status);
// Attempts to retrieve printer status using connection `http` for `printer_id`. // Attempts to retrieve printer status using connection `http` for `printer_id`.
// Returns true if succcssful and updates the fields in `printer_status` as // Returns true if succcssful and updates the fields in `printer_status` as

@@ -11,8 +11,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/component_export.h"
#include "printing/backend/cups_deleters.h" #include "printing/backend/cups_deleters.h"
#include "printing/printing_export.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace printing { namespace printing {
@@ -20,7 +20,7 @@ namespace printing {
struct PrinterBasicInfo; struct PrinterBasicInfo;
// Provides information regarding cups options. // Provides information regarding cups options.
class PRINTING_EXPORT CupsOptionProvider { class COMPONENT_EXPORT(PRINTING) CupsOptionProvider {
public: public:
virtual ~CupsOptionProvider() = default; virtual ~CupsOptionProvider() = default;
@@ -48,7 +48,7 @@ class PRINTING_EXPORT CupsOptionProvider {
// Retrieves information from CUPS printer objects as requested. This class // Retrieves information from CUPS printer objects as requested. This class
// is only valid as long as the CupsConnection which created it exists as they // is only valid as long as the CupsConnection which created it exists as they
// share an http connection which the CupsConnection closes on destruction. // share an http connection which the CupsConnection closes on destruction.
class PRINTING_EXPORT CupsPrinter : public CupsOptionProvider { class COMPONENT_EXPORT(PRINTING) CupsPrinter : public CupsOptionProvider {
public: public:
// Represents the margins that CUPS reports for some given media. // Represents the margins that CUPS reports for some given media.
// Its members are valued in PWG units (100ths of mm). // Its members are valued in PWG units (100ths of mm).

@@ -11,12 +11,12 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/component_export.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
#include "printing/mojom/print.mojom.h" #include "printing/mojom/print.mojom.h"
#include "printing/printing_export.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
namespace base { namespace base {
@@ -28,7 +28,7 @@ namespace printing {
using PrinterBasicInfoOptions = std::map<std::string, std::string>; using PrinterBasicInfoOptions = std::map<std::string, std::string>;
struct PRINTING_EXPORT PrinterBasicInfo { struct COMPONENT_EXPORT(PRINTING) PrinterBasicInfo {
PrinterBasicInfo(); PrinterBasicInfo();
PrinterBasicInfo(const std::string& printer_name, PrinterBasicInfo(const std::string& printer_name,
const std::string& display_name, const std::string& display_name,
@@ -58,7 +58,7 @@ using PrinterList = std::vector<PrinterBasicInfo>;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
struct PRINTING_EXPORT AdvancedCapabilityValue { struct COMPONENT_EXPORT(PRINTING) AdvancedCapabilityValue {
AdvancedCapabilityValue(); AdvancedCapabilityValue();
AdvancedCapabilityValue(const std::string& name, AdvancedCapabilityValue(const std::string& name,
const std::string& display_name); const std::string& display_name);
@@ -74,7 +74,7 @@ struct PRINTING_EXPORT AdvancedCapabilityValue {
std::string display_name; std::string display_name;
}; };
struct PRINTING_EXPORT AdvancedCapability { struct COMPONENT_EXPORT(PRINTING) AdvancedCapability {
enum class Type : uint8_t { kBoolean, kFloat, kInteger, kString }; enum class Type : uint8_t { kBoolean, kFloat, kInteger, kString };
AdvancedCapability(); AdvancedCapability();
@@ -109,7 +109,7 @@ using AdvancedCapabilities = std::vector<AdvancedCapability>;
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults { struct COMPONENT_EXPORT(PRINTING) PrinterSemanticCapsAndDefaults {
PrinterSemanticCapsAndDefaults(); PrinterSemanticCapsAndDefaults();
PrinterSemanticCapsAndDefaults(const PrinterSemanticCapsAndDefaults& other); PrinterSemanticCapsAndDefaults(const PrinterSemanticCapsAndDefaults& other);
~PrinterSemanticCapsAndDefaults(); ~PrinterSemanticCapsAndDefaults();
@@ -130,7 +130,7 @@ struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults {
mojom::ColorModel color_model = mojom::ColorModel::kUnknownColorModel; mojom::ColorModel color_model = mojom::ColorModel::kUnknownColorModel;
mojom::ColorModel bw_model = mojom::ColorModel::kUnknownColorModel; mojom::ColorModel bw_model = mojom::ColorModel::kUnknownColorModel;
struct PRINTING_EXPORT Paper { struct COMPONENT_EXPORT(PRINTING) Paper {
std::string display_name; std::string display_name;
std::string vendor_id; std::string vendor_id;
gfx::Size size_um; gfx::Size size_um;
@@ -151,7 +151,7 @@ struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults {
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
}; };
struct PRINTING_EXPORT PrinterCapsAndDefaults { struct COMPONENT_EXPORT(PRINTING) PrinterCapsAndDefaults {
PrinterCapsAndDefaults(); PrinterCapsAndDefaults();
PrinterCapsAndDefaults(const PrinterCapsAndDefaults& other); PrinterCapsAndDefaults(const PrinterCapsAndDefaults& other);
~PrinterCapsAndDefaults(); ~PrinterCapsAndDefaults();
@@ -169,7 +169,7 @@ struct PRINTING_EXPORT PrinterCapsAndDefaults {
// print system specific. For example, CUPS is available on both Linux and Mac, // print system specific. For example, CUPS is available on both Linux and Mac,
// but not available on ChromeOS, etc. This design allows us to add more // but not available on ChromeOS, etc. This design allows us to add more
// functionality on some platforms, while reusing core (CUPS) functions. // functionality on some platforms, while reusing core (CUPS) functions.
class PRINTING_EXPORT PrintBackend class COMPONENT_EXPORT(PRINTING) PrintBackend
: public base::RefCountedThreadSafe<PrintBackend> { : public base::RefCountedThreadSafe<PrintBackend> {
public: public:
// Enumerates the list of installed local and network printers. // Enumerates the list of installed local and network printers.

@@ -5,24 +5,24 @@
#ifndef PRINTING_BACKEND_PRINT_BACKEND_CONSTS_H_ #ifndef PRINTING_BACKEND_PRINT_BACKEND_CONSTS_H_
#define PRINTING_BACKEND_PRINT_BACKEND_CONSTS_H_ #define PRINTING_BACKEND_PRINT_BACKEND_CONSTS_H_
#include "printing/printing_export.h" #include "base/component_export.h"
PRINTING_EXPORT extern const char kCUPSBlocking[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSBlocking[];
PRINTING_EXPORT extern const char kCUPSEncryption[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSEncryption[];
PRINTING_EXPORT extern const char kCUPSEnterprisePrinter[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSEnterprisePrinter[];
PRINTING_EXPORT extern const char kCUPSPrintServerURL[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSPrintServerURL[];
PRINTING_EXPORT extern const char kDriverInfoTagName[]; COMPONENT_EXPORT(PRINTING) extern const char kDriverInfoTagName[];
PRINTING_EXPORT extern const char kDriverNameTagName[]; COMPONENT_EXPORT(PRINTING) extern const char kDriverNameTagName[];
PRINTING_EXPORT extern const char kLocationTagName[]; COMPONENT_EXPORT(PRINTING) extern const char kLocationTagName[];
PRINTING_EXPORT extern const char kValueFalse[]; COMPONENT_EXPORT(PRINTING) extern const char kValueFalse[];
PRINTING_EXPORT extern const char kValueTrue[]; COMPONENT_EXPORT(PRINTING) extern const char kValueTrue[];
// CUPS destination option names. // CUPS destination option names.
PRINTING_EXPORT extern const char kCUPSOptDeviceUri[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSOptDeviceUri[];
PRINTING_EXPORT extern const char kCUPSOptPrinterInfo[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSOptPrinterInfo[];
PRINTING_EXPORT extern const char kCUPSOptPrinterLocation[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSOptPrinterLocation[];
PRINTING_EXPORT extern const char kCUPSOptPrinterMakeAndModel[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSOptPrinterMakeAndModel[];
PRINTING_EXPORT extern const char kCUPSOptPrinterState[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSOptPrinterState[];
PRINTING_EXPORT extern const char kCUPSOptPrinterType[]; COMPONENT_EXPORT(PRINTING) extern const char kCUPSOptPrinterType[];
#endif // PRINTING_BACKEND_PRINT_BACKEND_CONSTS_H_ #endif // PRINTING_BACKEND_PRINT_BACKEND_CONSTS_H_

@@ -10,9 +10,9 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/component_export.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "printing/backend/print_backend.h" #include "printing/backend/print_backend.h"
#include "printing/printing_export.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace printing { namespace printing {
@@ -25,11 +25,11 @@ class PrintBackendCUPS : public PrintBackend {
const std::string& locale); const std::string& locale);
// These static functions are exposed here for use in the tests. // These static functions are exposed here for use in the tests.
PRINTING_EXPORT static bool PrinterBasicInfoFromCUPS( COMPONENT_EXPORT(PRINTING)
const cups_dest_t& printer, static bool PrinterBasicInfoFromCUPS(const cups_dest_t& printer,
PrinterBasicInfo* printer_info); PrinterBasicInfo* printer_info);
PRINTING_EXPORT static std::string PrinterDriverInfoFromCUPS( COMPONENT_EXPORT(PRINTING)
const cups_dest_t& printer); static std::string PrinterDriverInfoFromCUPS(const cups_dest_t& printer);
private: private:
struct DestinationDeleter { struct DestinationDeleter {

@@ -5,14 +5,14 @@
#ifndef PRINTING_BACKEND_PRINT_BACKEND_UTILS_H_ #ifndef PRINTING_BACKEND_PRINT_BACKEND_UTILS_H_
#define PRINTING_BACKEND_PRINT_BACKEND_UTILS_H_ #define PRINTING_BACKEND_PRINT_BACKEND_UTILS_H_
#include "base/component_export.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "printing/backend/print_backend.h" #include "printing/backend/print_backend.h"
#include "printing/printing_export.h"
namespace printing { namespace printing {
PRINTING_EXPORT PrinterSemanticCapsAndDefaults::Paper ParsePaper( COMPONENT_EXPORT(PRINTING)
base::StringPiece value); PrinterSemanticCapsAndDefaults::Paper ParsePaper(base::StringPiece value);
} // namespace printing } // namespace printing

@@ -11,14 +11,14 @@
#include <memory> #include <memory>
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
namespace internal { namespace internal {
PRINTING_EXPORT uint8_t* GetDriverInfo(HANDLE printer, int level); COMPONENT_EXPORT(PRINTING) uint8_t* GetDriverInfo(HANDLE printer, int level);
PRINTING_EXPORT uint8_t* GetPrinterInfo(HANDLE printer, int level); COMPONENT_EXPORT(PRINTING) uint8_t* GetPrinterInfo(HANDLE printer, int level);
// This class is designed to work with PRINTER_INFO_X structures // This class is designed to work with PRINTER_INFO_X structures
// and calls GetPrinter internally with correctly allocated buffer. // and calls GetPrinter internally with correctly allocated buffer.

@@ -5,8 +5,8 @@
#ifndef PRINTING_BACKEND_PRINTING_RESTRICTIONS_H_ #ifndef PRINTING_BACKEND_PRINTING_RESTRICTIONS_H_
#define PRINTING_BACKEND_PRINTING_RESTRICTIONS_H_ #define PRINTING_BACKEND_PRINTING_RESTRICTIONS_H_
#include "base/component_export.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
#include "printing/printing_export.h"
namespace printing { namespace printing {
@@ -40,12 +40,12 @@ enum class PinModeRestriction {
// Dictionary key for printing policies. // Dictionary key for printing policies.
// Must coincide with the name of field in `print_preview.Policies` in // Must coincide with the name of field in `print_preview.Policies` in
// chrome/browser/resources/print_preview/data/destination.js // chrome/browser/resources/print_preview/data/destination.js
PRINTING_EXPORT extern const char kAllowedColorModes[]; COMPONENT_EXPORT(PRINTING) extern const char kAllowedColorModes[];
PRINTING_EXPORT extern const char kAllowedDuplexModes[]; COMPONENT_EXPORT(PRINTING) extern const char kAllowedDuplexModes[];
PRINTING_EXPORT extern const char kAllowedPinModes[]; COMPONENT_EXPORT(PRINTING) extern const char kAllowedPinModes[];
PRINTING_EXPORT extern const char kDefaultColorMode[]; COMPONENT_EXPORT(PRINTING) extern const char kDefaultColorMode[];
PRINTING_EXPORT extern const char kDefaultDuplexMode[]; COMPONENT_EXPORT(PRINTING) extern const char kDefaultDuplexMode[];
PRINTING_EXPORT extern const char kDefaultPinMode[]; COMPONENT_EXPORT(PRINTING) extern const char kDefaultPinMode[];
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Allowed background graphics modes. // Allowed background graphics modes.
@@ -57,11 +57,11 @@ enum class BackgroundGraphicsModeRestriction {
}; };
// Dictionary keys to be used with `kPrintingPaperSizeDefault` policy. // Dictionary keys to be used with `kPrintingPaperSizeDefault` policy.
PRINTING_EXPORT extern const char kPaperSizeName[]; COMPONENT_EXPORT(PRINTING) extern const char kPaperSizeName[];
PRINTING_EXPORT extern const char kPaperSizeNameCustomOption[]; COMPONENT_EXPORT(PRINTING) extern const char kPaperSizeNameCustomOption[];
PRINTING_EXPORT extern const char kPaperSizeCustomSize[]; COMPONENT_EXPORT(PRINTING) extern const char kPaperSizeCustomSize[];
PRINTING_EXPORT extern const char kPaperSizeWidth[]; COMPONENT_EXPORT(PRINTING) extern const char kPaperSizeWidth[];
PRINTING_EXPORT extern const char kPaperSizeHeight[]; COMPONENT_EXPORT(PRINTING) extern const char kPaperSizeHeight[];
} // namespace printing } // namespace printing

@@ -19,16 +19,16 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/component_export.h"
#include "base/memory/free_deleter.h" #include "base/memory/free_deleter.h"
#include "base/win/scoped_handle.h" #include "base/win/scoped_handle.h"
#include "printing/printing_export.h"
// These are helper functions for dealing with Windows Printing. // These are helper functions for dealing with Windows Printing.
namespace printing { namespace printing {
struct PRINTING_EXPORT PrinterBasicInfo; struct COMPONENT_EXPORT(PRINTING) PrinterBasicInfo;
class PRINTING_EXPORT PrinterHandleTraits { class COMPONENT_EXPORT(PRINTING) PrinterHandleTraits {
public: public:
PrinterHandleTraits() = delete; PrinterHandleTraits() = delete;
PrinterHandleTraits(const PrinterHandleTraits&) = delete; PrinterHandleTraits(const PrinterHandleTraits&) = delete;
@@ -43,14 +43,14 @@ class PRINTING_EXPORT PrinterHandleTraits {
static HANDLE NullHandle() { return nullptr; } static HANDLE NullHandle() { return nullptr; }
}; };
class PRINTING_EXPORT ScopedPrinterHandle class COMPONENT_EXPORT(PRINTING) ScopedPrinterHandle
: public base::win::GenericScopedHandle<PrinterHandleTraits, : public base::win::GenericScopedHandle<PrinterHandleTraits,
base::win::DummyVerifierTraits> { base::win::DummyVerifierTraits> {
public: public:
bool OpenPrinterWithName(const wchar_t* printer); bool OpenPrinterWithName(const wchar_t* printer);
}; };
class PRINTING_EXPORT PrinterChangeHandleTraits { class COMPONENT_EXPORT(PRINTING) PrinterChangeHandleTraits {
public: public:
PrinterChangeHandleTraits() = delete; PrinterChangeHandleTraits() = delete;
PrinterChangeHandleTraits(const PrinterChangeHandleTraits&) = delete; PrinterChangeHandleTraits(const PrinterChangeHandleTraits&) = delete;
@@ -75,7 +75,7 @@ using ScopedPrinterChangeHandle =
// this would mean having to add that to every binary that links with // this would mean having to add that to every binary that links with
// printing.lib (which is a LOT of binaries). So choosing the GetProcAddress // printing.lib (which is a LOT of binaries). So choosing the GetProcAddress
// route instead). // route instead).
class PRINTING_EXPORT XPSModule { class COMPONENT_EXPORT(PRINTING) XPSModule {
public: public:
// All the other methods can ONLY be called after a successful call to Init. // All the other methods can ONLY be called after a successful call to Init.
// Init can be called many times and by multiple threads. // Init can be called many times and by multiple threads.
@@ -115,7 +115,7 @@ class PRINTING_EXPORT XPSModule {
}; };
// See comments in cc file explaining why we need this. // See comments in cc file explaining why we need this.
class PRINTING_EXPORT ScopedXPSInitializer { class COMPONENT_EXPORT(PRINTING) ScopedXPSInitializer {
public: public:
ScopedXPSInitializer(); ScopedXPSInitializer();
ScopedXPSInitializer(const ScopedXPSInitializer&) = delete; ScopedXPSInitializer(const ScopedXPSInitializer&) = delete;
@@ -131,7 +131,7 @@ class PRINTING_EXPORT ScopedXPSInitializer {
// Wrapper class to wrap the XPS Print APIs (these are different from the PTxxx // Wrapper class to wrap the XPS Print APIs (these are different from the PTxxx
// which deal with the XML Print Schema). This is needed because these // which deal with the XML Print Schema). This is needed because these
// APIs are only available on Windows 7 and higher. // APIs are only available on Windows 7 and higher.
class PRINTING_EXPORT XPSPrintModule { class COMPONENT_EXPORT(PRINTING) XPSPrintModule {
public: public:
// All the other methods can ONLY be called after a successful call to Init. // All the other methods can ONLY be called after a successful call to Init.
// Init can be called many times and by multiple threads. // Init can be called many times and by multiple threads.
@@ -153,34 +153,38 @@ class PRINTING_EXPORT XPSPrintModule {
}; };
// Sets the function that gets friendly names for network printers. // Sets the function that gets friendly names for network printers.
PRINTING_EXPORT void SetGetDisplayNameFunction( COMPONENT_EXPORT(PRINTING)
void SetGetDisplayNameFunction(
std::string (*get_display_name_func)(const std::string& printer_name)); std::string (*get_display_name_func)(const std::string& printer_name));
PRINTING_EXPORT bool InitBasicPrinterInfo(HANDLE printer, COMPONENT_EXPORT(PRINTING)
PrinterBasicInfo* printer_info); bool InitBasicPrinterInfo(HANDLE printer, PrinterBasicInfo* printer_info);
PRINTING_EXPORT std::string GetDriverInfo(HANDLE printer); COMPONENT_EXPORT(PRINTING) std::string GetDriverInfo(HANDLE printer);
PRINTING_EXPORT std::unique_ptr<DEVMODE, base::FreeDeleter> XpsTicketToDevMode( COMPONENT_EXPORT(PRINTING)
std::unique_ptr<DEVMODE, base::FreeDeleter> XpsTicketToDevMode(
const std::wstring& printer_name, const std::wstring& printer_name,
const std::string& print_ticket); const std::string& print_ticket);
PRINTING_EXPORT bool IsDevModeWithColor(const DEVMODE* devmode); COMPONENT_EXPORT(PRINTING) bool IsDevModeWithColor(const DEVMODE* devmode);
// Creates default DEVMODE and sets color option. Some devices need special // Creates default DEVMODE and sets color option. Some devices need special
// workaround for color. // workaround for color.
PRINTING_EXPORT std::unique_ptr<DEVMODE, base::FreeDeleter> COMPONENT_EXPORT(PRINTING)
CreateDevModeWithColor(HANDLE printer, std::unique_ptr<DEVMODE, base::FreeDeleter> CreateDevModeWithColor(
const std::wstring& printer_name, HANDLE printer,
bool color); const std::wstring& printer_name,
bool color);
// Creates new DEVMODE. If `in` is not NULL copy settings from there. // Creates new DEVMODE. If `in` is not NULL copy settings from there.
PRINTING_EXPORT std::unique_ptr<DEVMODE, base::FreeDeleter> CreateDevMode( COMPONENT_EXPORT(PRINTING)
HANDLE printer, std::unique_ptr<DEVMODE, base::FreeDeleter> CreateDevMode(HANDLE printer,
DEVMODE* in); DEVMODE* in);
// Prompts for new DEVMODE. If `in` is not NULL copy settings from there. // Prompts for new DEVMODE. If `in` is not NULL copy settings from there.
PRINTING_EXPORT std::unique_ptr<DEVMODE, base::FreeDeleter> PromptDevMode( COMPONENT_EXPORT(PRINTING)
std::unique_ptr<DEVMODE, base::FreeDeleter> PromptDevMode(
HANDLE printer, HANDLE printer,
const std::wstring& printer_name, const std::wstring& printer_name,
DEVMODE* in, DEVMODE* in,

@@ -28,7 +28,7 @@ class Size;
namespace printing { namespace printing {
// Simple wrapper class that manage an EMF data stream and its virtual HDC. // Simple wrapper class that manage an EMF data stream and its virtual HDC.
class PRINTING_EXPORT Emf : public Metafile { class COMPONENT_EXPORT(PRINTING) Emf : public Metafile {
public: public:
class Record; class Record;
class Enumerator; class Enumerator;
@@ -110,7 +110,7 @@ struct Emf::EnumerationContext {
// One EMF record. It keeps pointers to the EMF buffer held by Emf::emf_. // One EMF record. It keeps pointers to the EMF buffer held by Emf::emf_.
// The entries become invalid once Emf::CloseEmf() is called. // The entries become invalid once Emf::CloseEmf() is called.
class PRINTING_EXPORT Emf::Record { class COMPONENT_EXPORT(PRINTING) Emf::Record {
public: public:
// Plays the record. // Plays the record.
bool Play(EnumerationContext* context) const; bool Play(EnumerationContext* context) const;
@@ -134,7 +134,7 @@ class PRINTING_EXPORT Emf::Record {
// Retrieves individual records out of a Emf buffer. The main use is to skip // Retrieves individual records out of a Emf buffer. The main use is to skip
// over records that are unsupported on a specific printer or to play back // over records that are unsupported on a specific printer or to play back
// only a part of an EMF buffer. // only a part of an EMF buffer.
class PRINTING_EXPORT Emf::Enumerator { class COMPONENT_EXPORT(PRINTING) Emf::Enumerator {
public: public:
// Iterator type used for iterating the records. // Iterator type used for iterating the records.
typedef std::vector<Record>::const_iterator const_iterator; typedef std::vector<Record>::const_iterator const_iterator;
@@ -169,7 +169,6 @@ class PRINTING_EXPORT Emf::Enumerator {
std::vector<Record> items_; std::vector<Record> items_;
EnumerationContext context_; EnumerationContext context_;
}; };
} // namespace printing } // namespace printing

@@ -9,11 +9,11 @@
#include <vector> #include <vector>
#include "base/component_export.h"
#include "base/containers/span.h" #include "base/containers/span.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "printing/mojom/print.mojom-forward.h" #include "printing/mojom/print.mojom-forward.h"
#include "printing/native_drawing_context.h" #include "printing/native_drawing_context.h"
#include "printing/printing_export.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include <windows.h> #include <windows.h>
@@ -35,7 +35,7 @@ class Size;
namespace printing { namespace printing {
// This class plays metafiles from data stream (usually PDF or EMF). // This class plays metafiles from data stream (usually PDF or EMF).
class PRINTING_EXPORT MetafilePlayer { class COMPONENT_EXPORT(PRINTING) MetafilePlayer {
public: public:
MetafilePlayer(); MetafilePlayer();
MetafilePlayer(const MetafilePlayer&) = delete; MetafilePlayer(const MetafilePlayer&) = delete;
@@ -81,7 +81,7 @@ class PRINTING_EXPORT MetafilePlayer {
// This class creates a graphics context that renders into a data stream // This class creates a graphics context that renders into a data stream
// (usually PDF or EMF). // (usually PDF or EMF).
class PRINTING_EXPORT Metafile : public MetafilePlayer { class COMPONENT_EXPORT(PRINTING) Metafile : public MetafilePlayer {
public: public:
Metafile(); Metafile();
Metafile(const Metafile&) = delete; Metafile(const Metafile&) = delete;

@@ -31,7 +31,7 @@ namespace printing {
struct MetafileSkiaData; struct MetafileSkiaData;
// This class uses Skia graphics library to generate a PDF or MSKP document. // This class uses Skia graphics library to generate a PDF or MSKP document.
class PRINTING_EXPORT MetafileSkia : public Metafile { class COMPONENT_EXPORT(PRINTING) MetafileSkia : public Metafile {
public: public:
// Default constructor, for mojom::SkiaDocumentType::kPDF type only. // Default constructor, for mojom::SkiaDocumentType::kPDF type only.
// TODO(weili): we should split up this use case into a different class, see // TODO(weili): we should split up this use case into a different class, see

@@ -5,11 +5,11 @@
#ifndef PRINTING_NUP_PARAMETERS_H_ #ifndef PRINTING_NUP_PARAMETERS_H_
#define PRINTING_NUP_PARAMETERS_H_ #define PRINTING_NUP_PARAMETERS_H_
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
class PRINTING_EXPORT NupParameters { class COMPONENT_EXPORT(PRINTING) NupParameters {
public: public:
NupParameters(); NupParameters();

@@ -15,7 +15,7 @@ class PrintSettings;
// Represents a page series following the array of page ranges defined in a // Represents a page series following the array of page ranges defined in a
// PrintSettings. // PrintSettings.
class PRINTING_EXPORT PageNumber { class COMPONENT_EXPORT(PRINTING) PageNumber {
public: public:
// Initializes the page to the first page in the settings's range or 0. // Initializes the page to the first page in the settings's range or 0.
PageNumber(const PrintSettings& settings, uint32_t document_page_count); PageNumber(const PrintSettings& settings, uint32_t document_page_count);

@@ -9,7 +9,7 @@
#include <vector> #include <vector>
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
@@ -18,7 +18,7 @@ struct PageRange;
using PageRanges = std::vector<PageRange>; using PageRanges = std::vector<PageRange>;
// Print range is inclusive. To select one page, set from == to. // Print range is inclusive. To select one page, set from == to.
struct PRINTING_EXPORT PageRange { struct COMPONENT_EXPORT(PRINTING) PageRange {
uint32_t from; uint32_t from;
uint32_t to; uint32_t to;

@@ -5,13 +5,13 @@
#ifndef PRINTING_PAGE_SETUP_H_ #ifndef PRINTING_PAGE_SETUP_H_
#define PRINTING_PAGE_SETUP_H_ #define PRINTING_PAGE_SETUP_H_
#include "printing/printing_export.h" #include "base/component_export.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
namespace printing { namespace printing {
// Margins for a page setup. // Margins for a page setup.
class PRINTING_EXPORT PageMargins { class COMPONENT_EXPORT(PRINTING) PageMargins {
public: public:
PageMargins(); PageMargins();
@@ -33,7 +33,7 @@ class PRINTING_EXPORT PageMargins {
// Settings that define the size and printable areas of a page. Unit is // Settings that define the size and printable areas of a page. Unit is
// unspecified. // unspecified.
class PRINTING_EXPORT PageSetup { class COMPONENT_EXPORT(PRINTING) PageSetup {
public: public:
PageSetup(); PageSetup();
PageSetup(const PageSetup& other); PageSetup(const PageSetup& other);

@@ -15,7 +15,7 @@
namespace printing { namespace printing {
// This class creates a graphics context that renders into a PDF data stream. // This class creates a graphics context that renders into a PDF data stream.
class PRINTING_EXPORT PdfMetafileCg : public Metafile { class COMPONENT_EXPORT(PRINTING) PdfMetafileCg : public Metafile {
public: public:
PdfMetafileCg(); PdfMetafileCg();
PdfMetafileCg(const PdfMetafileCg&) = delete; PdfMetafileCg(const PdfMetafileCg&) = delete;

@@ -7,109 +7,109 @@
#include <stdint.h> #include <stdint.h>
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
PRINTING_EXPORT extern const char kIsFirstRequest[]; COMPONENT_EXPORT(PRINTING) extern const char kIsFirstRequest[];
PRINTING_EXPORT extern const char kPreviewRequestID[]; COMPONENT_EXPORT(PRINTING) extern const char kPreviewRequestID[];
PRINTING_EXPORT extern const char kPreviewUIID[]; COMPONENT_EXPORT(PRINTING) extern const char kPreviewUIID[];
PRINTING_EXPORT extern const char kSettingCapabilities[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingCapabilities[];
PRINTING_EXPORT extern const char kSettingCloudPrintId[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingCloudPrintId[];
PRINTING_EXPORT extern const char kSettingCollate[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingCollate[];
PRINTING_EXPORT extern const char kSettingColor[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingColor[];
PRINTING_EXPORT extern const char kSettingSetColorAsDefault[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingSetColorAsDefault[];
PRINTING_EXPORT extern const char kSettingContentHeight[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingContentHeight[];
PRINTING_EXPORT extern const char kSettingContentWidth[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingContentWidth[];
PRINTING_EXPORT extern const char kSettingCopies[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingCopies[];
PRINTING_EXPORT extern const char kSettingDeviceName[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingDeviceName[];
PRINTING_EXPORT extern const char kSettingDisableScaling[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingDisableScaling[];
PRINTING_EXPORT extern const char kSettingDpiDefault[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingDpiDefault[];
PRINTING_EXPORT extern const char kSettingDpiHorizontal[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingDpiHorizontal[];
PRINTING_EXPORT extern const char kSettingDpiVertical[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingDpiVertical[];
PRINTING_EXPORT extern const char kSettingDuplexMode[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingDuplexMode[];
PRINTING_EXPORT extern const char kSettingFitToPageScaling[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingFitToPageScaling[];
PRINTING_EXPORT extern const char kSettingHeaderFooterEnabled[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingHeaderFooterEnabled[];
PRINTING_EXPORT extern const float kSettingHeaderFooterInterstice; COMPONENT_EXPORT(PRINTING) extern const float kSettingHeaderFooterInterstice;
PRINTING_EXPORT extern const char kSettingHeaderFooterDate[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingHeaderFooterDate[];
PRINTING_EXPORT extern const char kSettingHeaderFooterTitle[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingHeaderFooterTitle[];
PRINTING_EXPORT extern const char kSettingHeaderFooterURL[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingHeaderFooterURL[];
PRINTING_EXPORT extern const char kSettingLandscape[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingLandscape[];
PRINTING_EXPORT extern const char kSettingMediaSize[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMediaSize[];
PRINTING_EXPORT extern const char kSettingMediaSizeHeightMicrons[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMediaSizeHeightMicrons[];
PRINTING_EXPORT extern const char kSettingMediaSizeWidthMicrons[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMediaSizeWidthMicrons[];
PRINTING_EXPORT extern const char kSettingMediaSizeVendorId[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMediaSizeVendorId[];
PRINTING_EXPORT extern const char kSettingMediaSizeIsDefault[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMediaSizeIsDefault[];
PRINTING_EXPORT extern const char kSettingMarginBottom[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMarginBottom[];
PRINTING_EXPORT extern const char kSettingMarginLeft[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMarginLeft[];
PRINTING_EXPORT extern const char kSettingMarginRight[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMarginRight[];
PRINTING_EXPORT extern const char kSettingMarginTop[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMarginTop[];
PRINTING_EXPORT extern const char kSettingMarginsCustom[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMarginsCustom[];
PRINTING_EXPORT extern const char kSettingMarginsType[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingMarginsType[];
PRINTING_EXPORT extern const char kSettingPreviewPageCount[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPreviewPageCount[];
PRINTING_EXPORT extern const char kSettingPageRange[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPageRange[];
PRINTING_EXPORT extern const char kSettingPageRangeFrom[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPageRangeFrom[];
PRINTING_EXPORT extern const char kSettingPageRangeTo[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPageRangeTo[];
PRINTING_EXPORT extern const char kSettingPageWidth[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPageWidth[];
PRINTING_EXPORT extern const char kSettingPageHeight[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPageHeight[];
PRINTING_EXPORT extern const char kSettingPagesPerSheet[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPagesPerSheet[];
PRINTING_EXPORT extern const char kSettingPinValue[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPinValue[];
PRINTING_EXPORT extern const char kSettingPolicies[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPolicies[];
PRINTING_EXPORT extern const char kSettingPreviewIsFromArc[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPreviewIsFromArc[];
PRINTING_EXPORT extern const char kSettingPreviewIsPdf[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPreviewIsPdf[];
PRINTING_EXPORT extern const char kSettingPreviewModifiable[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPreviewModifiable[];
PRINTING_EXPORT extern const char kSettingPrintToGoogleDrive[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrintToGoogleDrive[];
PRINTING_EXPORT extern const char kSettingPrintableAreaHeight[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrintableAreaHeight[];
PRINTING_EXPORT extern const char kSettingPrintableAreaWidth[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrintableAreaWidth[];
PRINTING_EXPORT extern const char kSettingPrintableAreaX[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrintableAreaX[];
PRINTING_EXPORT extern const char kSettingPrintableAreaY[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrintableAreaY[];
PRINTING_EXPORT extern const char kSettingPrinterDescription[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrinterDescription[];
PRINTING_EXPORT extern const char kSettingPrinterName[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrinterName[];
PRINTING_EXPORT extern const char kSettingPrinterOptions[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrinterOptions[];
PRINTING_EXPORT extern const char kSettingPrinterType[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingPrinterType[];
PRINTING_EXPORT extern const char kSettingRasterizePdf[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingRasterizePdf[];
PRINTING_EXPORT extern const char kSettingScaleFactor[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingScaleFactor[];
PRINTING_EXPORT extern const char kSettingScalingType[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingScalingType[];
PRINTING_EXPORT extern const char kSettingTicket[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingTicket[];
PRINTING_EXPORT extern const char kSettingSendUserInfo[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingSendUserInfo[];
PRINTING_EXPORT extern const char kSettingShouldPrintBackgrounds[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingShouldPrintBackgrounds[];
PRINTING_EXPORT extern const char kSettingShouldPrintSelectionOnly[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingShouldPrintSelectionOnly[];
PRINTING_EXPORT extern const char kSettingShowSystemDialog[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingShowSystemDialog[];
PRINTING_EXPORT extern const char kSettingUsername[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingUsername[];
PRINTING_EXPORT extern const char kSettingAdvancedSettings[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingAdvancedSettings[];
PRINTING_EXPORT extern const int FIRST_PAGE_INDEX; COMPONENT_EXPORT(PRINTING) extern const int FIRST_PAGE_INDEX;
PRINTING_EXPORT extern const int COMPLETE_PREVIEW_DOCUMENT_INDEX; COMPONENT_EXPORT(PRINTING) extern const int COMPLETE_PREVIEW_DOCUMENT_INDEX;
PRINTING_EXPORT extern const char kSettingOpenPDFInPreview[]; COMPONENT_EXPORT(PRINTING) extern const char kSettingOpenPDFInPreview[];
PRINTING_EXPORT extern const uint32_t kInvalidPageIndex; COMPONENT_EXPORT(PRINTING) extern const uint32_t kInvalidPageIndex;
PRINTING_EXPORT extern const uint32_t kMaxPageCount; COMPONENT_EXPORT(PRINTING) extern const uint32_t kMaxPageCount;
#if defined(USE_CUPS) #if defined(USE_CUPS)
// Printer color models // Printer color models
PRINTING_EXPORT extern const char kBlack[]; COMPONENT_EXPORT(PRINTING) extern const char kBlack[];
PRINTING_EXPORT extern const char kCMYK[]; COMPONENT_EXPORT(PRINTING) extern const char kCMYK[];
PRINTING_EXPORT extern const char kKCMY[]; COMPONENT_EXPORT(PRINTING) extern const char kKCMY[];
PRINTING_EXPORT extern const char kCMY_K[]; COMPONENT_EXPORT(PRINTING) extern const char kCMY_K[];
PRINTING_EXPORT extern const char kCMY[]; COMPONENT_EXPORT(PRINTING) extern const char kCMY[];
PRINTING_EXPORT extern const char kColor[]; COMPONENT_EXPORT(PRINTING) extern const char kColor[];
PRINTING_EXPORT extern const char kEpsonColor[]; COMPONENT_EXPORT(PRINTING) extern const char kEpsonColor[];
PRINTING_EXPORT extern const char kEpsonMono[]; COMPONENT_EXPORT(PRINTING) extern const char kEpsonMono[];
PRINTING_EXPORT extern const char kFullColor[]; COMPONENT_EXPORT(PRINTING) extern const char kFullColor[];
PRINTING_EXPORT extern const char kGray[]; COMPONENT_EXPORT(PRINTING) extern const char kGray[];
PRINTING_EXPORT extern const char kGrayscale[]; COMPONENT_EXPORT(PRINTING) extern const char kGrayscale[];
PRINTING_EXPORT extern const char kGreyscale[]; COMPONENT_EXPORT(PRINTING) extern const char kGreyscale[];
PRINTING_EXPORT extern const char kMono[]; COMPONENT_EXPORT(PRINTING) extern const char kMono[];
PRINTING_EXPORT extern const char kMonochrome[]; COMPONENT_EXPORT(PRINTING) extern const char kMonochrome[];
PRINTING_EXPORT extern const char kNormal[]; COMPONENT_EXPORT(PRINTING) extern const char kNormal[];
PRINTING_EXPORT extern const char kNormalGray[]; COMPONENT_EXPORT(PRINTING) extern const char kNormalGray[];
PRINTING_EXPORT extern const char kRGB[]; COMPONENT_EXPORT(PRINTING) extern const char kRGB[];
PRINTING_EXPORT extern const char kRGBA[]; COMPONENT_EXPORT(PRINTING) extern const char kRGBA[];
PRINTING_EXPORT extern const char kRGB16[]; COMPONENT_EXPORT(PRINTING) extern const char kRGB16[];
PRINTING_EXPORT extern const char kSharpCMColor[]; COMPONENT_EXPORT(PRINTING) extern const char kSharpCMColor[];
PRINTING_EXPORT extern const char kSharpCMBW[]; COMPONENT_EXPORT(PRINTING) extern const char kSharpCMBW[];
PRINTING_EXPORT extern const char kXeroxAutomatic[]; COMPONENT_EXPORT(PRINTING) extern const char kXeroxAutomatic[];
PRINTING_EXPORT extern const char kXeroxBW[]; COMPONENT_EXPORT(PRINTING) extern const char kXeroxBW[];
#endif #endif
// Specifies the horizontal alignment of the headers and footers. // Specifies the horizontal alignment of the headers and footers.

@@ -8,6 +8,7 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include "base/component_export.h"
#include "base/optional.h" #include "base/optional.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
@@ -15,7 +16,6 @@
#include "printing/page_range.h" #include "printing/page_range.h"
#include "printing/page_setup.h" #include "printing/page_setup.h"
#include "printing/print_job_constants.h" #include "printing/print_job_constants.h"
#include "printing/printing_export.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
@@ -29,33 +29,35 @@ namespace printing {
// Convert from `color_mode` into a `color_model`. An invalid `color_mode` // Convert from `color_mode` into a `color_model`. An invalid `color_mode`
// will give a result of `mojom::ColorModel::kUnknownColorModel`. // will give a result of `mojom::ColorModel::kUnknownColorModel`.
PRINTING_EXPORT mojom::ColorModel ColorModeToColorModel(int color_mode); COMPONENT_EXPORT(PRINTING)
mojom::ColorModel ColorModeToColorModel(int color_mode);
// Returns true if `color_model` is color and false if it is B&W. Callers // Returns true if `color_model` is color and false if it is B&W. Callers
// are not supposed to pass in `mojom::ColorModel::kUnknownColorModel`, but // are not supposed to pass in `mojom::ColorModel::kUnknownColorModel`, but
// if they do then the result will be base::nullopt. // if they do then the result will be base::nullopt.
PRINTING_EXPORT base::Optional<bool> IsColorModelSelected( COMPONENT_EXPORT(PRINTING)
mojom::ColorModel color_model); base::Optional<bool> IsColorModelSelected(mojom::ColorModel color_model);
#if defined(USE_CUPS) #if defined(USE_CUPS)
// Get the color model setting name and value for the `color_model`. // Get the color model setting name and value for the `color_model`.
PRINTING_EXPORT void GetColorModelForModel(mojom::ColorModel color_model, COMPONENT_EXPORT(PRINTING)
std::string* color_setting_name, void GetColorModelForModel(mojom::ColorModel color_model,
std::string* color_value); std::string* color_setting_name,
std::string* color_value);
#if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) #if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH)
// Convert from `color_model` to a print-color-mode value from PWG 5100.13. // Convert from `color_model` to a print-color-mode value from PWG 5100.13.
PRINTING_EXPORT std::string GetIppColorModelForModel( COMPONENT_EXPORT(PRINTING)
mojom::ColorModel color_model); std::string GetIppColorModelForModel(mojom::ColorModel color_model);
#endif #endif
#endif // defined(USE_CUPS) #endif // defined(USE_CUPS)
// Inform the printing system that it may embed this user-agent string // Inform the printing system that it may embed this user-agent string
// in its output's metadata. // in its output's metadata.
PRINTING_EXPORT void SetAgent(const std::string& user_agent); COMPONENT_EXPORT(PRINTING) void SetAgent(const std::string& user_agent);
PRINTING_EXPORT const std::string& GetAgent(); COMPONENT_EXPORT(PRINTING) const std::string& GetAgent();
class PRINTING_EXPORT PrintSettings { class COMPONENT_EXPORT(PRINTING) PrintSettings {
public: public:
#if defined(OS_WIN) #if defined(OS_WIN)
enum PrinterType { enum PrinterType {

@@ -7,8 +7,8 @@
#include <memory> #include <memory>
#include "base/component_export.h"
#include "printing/page_range.h" #include "printing/page_range.h"
#include "printing/printing_export.h"
namespace base { namespace base {
class DictionaryValue; class DictionaryValue;
@@ -19,11 +19,12 @@ namespace printing {
class PrintSettings; class PrintSettings;
PRINTING_EXPORT PageRanges COMPONENT_EXPORT(PRINTING)
GetPageRangesFromJobSettings(const base::Value& job_settings); PageRanges GetPageRangesFromJobSettings(const base::Value& job_settings);
// Returns nullptr on failure. // Returns nullptr on failure.
PRINTING_EXPORT std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings( COMPONENT_EXPORT(PRINTING)
std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
const base::Value& job_settings); const base::Value& job_settings);
// Use for debug only, because output is not completely consistent with format // Use for debug only, because output is not completely consistent with format

@@ -14,7 +14,7 @@ namespace printing {
class PrintSettings; class PrintSettings;
// Initializes a PrintSettings object from the provided device context. // Initializes a PrintSettings object from the provided device context.
class PRINTING_EXPORT PrintSettingsInitializerMac { class COMPONENT_EXPORT(PRINTING) PrintSettingsInitializerMac {
public: public:
PrintSettingsInitializerMac() = delete; PrintSettingsInitializerMac() = delete;
PrintSettingsInitializerMac(const PrintSettingsInitializerMac&) = delete; PrintSettingsInitializerMac(const PrintSettingsInitializerMac&) = delete;

@@ -17,7 +17,7 @@ namespace printing {
class PrintSettings; class PrintSettings;
// Initializes a PrintSettings object from the provided device context. // Initializes a PrintSettings object from the provided device context.
class PRINTING_EXPORT PrintSettingsInitializerWin { class COMPONENT_EXPORT(PRINTING) PrintSettingsInitializerWin {
public: public:
PrintSettingsInitializerWin() = delete; PrintSettingsInitializerWin() = delete;
PrintSettingsInitializerWin(const PrintSettingsInitializerWin&) = delete; PrintSettingsInitializerWin(const PrintSettingsInitializerWin&) = delete;

@@ -32,7 +32,7 @@ class PrintingContext;
// will have write access. Sensible functions are protected by a lock. // will have write access. Sensible functions are protected by a lock.
// Warning: Once a page is loaded, it cannot be replaced. Pages may be discarded // Warning: Once a page is loaded, it cannot be replaced. Pages may be discarded
// under low memory conditions. // under low memory conditions.
class PRINTING_EXPORT PrintedDocument class COMPONENT_EXPORT(PRINTING) PrintedDocument
: public base::RefCountedThreadSafe<PrintedDocument> { : public base::RefCountedThreadSafe<PrintedDocument> {
public: public:
// The cookie shall be unique and has a specific relationship with its // The cookie shall be unique and has a specific relationship with its

@@ -20,7 +20,7 @@ namespace printing {
// Note: May be accessed from many threads at the same time. This is an non // Note: May be accessed from many threads at the same time. This is an non
// issue since this object is immutable. The reason is that a page may be // issue since this object is immutable. The reason is that a page may be
// printed and be displayed at the same time. // printed and be displayed at the same time.
class PRINTING_EXPORT PrintedPage class COMPONENT_EXPORT(PRINTING) PrintedPage
: public base::RefCountedThreadSafe<PrintedPage> { : public base::RefCountedThreadSafe<PrintedPage> {
public: public:
PrintedPage(uint32_t page_number, PrintedPage(uint32_t page_number,

@@ -5,7 +5,7 @@
#ifndef PRINTING_PRINTER_QUERY_RESULT_H_ #ifndef PRINTING_PRINTER_QUERY_RESULT_H_
#define PRINTING_PRINTER_QUERY_RESULT_H_ #define PRINTING_PRINTER_QUERY_RESULT_H_
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
@@ -13,7 +13,7 @@ namespace printing {
// This enum is used to record UMA histogram values and should not be // This enum is used to record UMA histogram values and should not be
// reordered. Please keep in sync with PrinterStatusQueryResult in // reordered. Please keep in sync with PrinterStatusQueryResult in
// src/tools/metrics/histograms/enums.xml. // src/tools/metrics/histograms/enums.xml.
enum class PRINTING_EXPORT PrinterQueryResult { enum class COMPONENT_EXPORT(PRINTING) PrinterQueryResult {
kUnknownFailure = 0, // catchall error kUnknownFailure = 0, // catchall error
kSuccess = 1, // successful kSuccess = 1, // successful
kUnreachable = 2, // failed to reach the host kUnreachable = 2, // failed to reach the host

@@ -10,13 +10,13 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
// Represents the status of a printer containing the properties printer-state, // Represents the status of a printer containing the properties printer-state,
// printer-state-reasons, and printer-state-message. // printer-state-reasons, and printer-state-message.
struct PRINTING_EXPORT PrinterStatus { struct COMPONENT_EXPORT(PRINTING) PrinterStatus {
struct PrinterReason { struct PrinterReason {
// This enum is used to record UMA histogram values and should not be // This enum is used to record UMA histogram values and should not be
// reordered. Please keep in sync with PrinterStatusReasons in // reordered. Please keep in sync with PrinterStatusReasons in

@@ -23,7 +23,7 @@ namespace printing {
// user selected printing context. This includes the OS-dependent UI to ask the // user selected printing context. This includes the OS-dependent UI to ask the
// user about the print settings. Concrete implementations directly talk to the // user about the print settings. Concrete implementations directly talk to the
// printer and manage the document and page breaks. // printer and manage the document and page breaks.
class PRINTING_EXPORT PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContext {
public: public:
// Printing context delegate. // Printing context delegate.
class Delegate { class Delegate {

@@ -21,7 +21,8 @@ class MetafilePlayer;
// Android subclass of PrintingContext. This class communicates with the // Android subclass of PrintingContext. This class communicates with the
// Java side through JNI. // Java side through JNI.
class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContextAndroid
: public PrintingContext {
public: public:
explicit PrintingContextAndroid(Delegate* delegate); explicit PrintingContextAndroid(Delegate* delegate);
PrintingContextAndroid(const PrintingContextAndroid&) = delete; PrintingContextAndroid(const PrintingContextAndroid&) = delete;

@@ -17,7 +17,8 @@
namespace printing { namespace printing {
class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContextChromeos
: public PrintingContext {
public: public:
static std::unique_ptr<PrintingContextChromeos> CreateForTesting( static std::unique_ptr<PrintingContextChromeos> CreateForTesting(
Delegate* delegate, Delegate* delegate,
@@ -65,7 +66,8 @@ class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
// This has the side effect of recording UMA for advanced attributes usage, // This has the side effect of recording UMA for advanced attributes usage,
// so only call once per job. // so only call once per job.
PRINTING_EXPORT std::vector<ScopedCupsOption> SettingsToCupsOptions( COMPONENT_EXPORT(PRINTING)
std::vector<ScopedCupsOption> SettingsToCupsOptions(
const PrintSettings& settings); const PrintSettings& settings);
} // namespace printing } // namespace printing

@@ -16,7 +16,7 @@ class MetafilePlayer;
class PrintDialogGtkInterface; class PrintDialogGtkInterface;
// PrintingContext with optional native UI for print dialog and pdf_paper_size. // PrintingContext with optional native UI for print dialog and pdf_paper_size.
class PRINTING_EXPORT PrintingContextLinux : public PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContextLinux : public PrintingContext {
public: public:
explicit PrintingContextLinux(Delegate* delegate); explicit PrintingContextLinux(Delegate* delegate);
PrintingContextLinux(const PrintingContextLinux&) = delete; PrintingContextLinux(const PrintingContextLinux&) = delete;

@@ -17,7 +17,7 @@
namespace printing { namespace printing {
class PRINTING_EXPORT PrintingContextMac : public PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContextMac : public PrintingContext {
public: public:
explicit PrintingContextMac(Delegate* delegate); explicit PrintingContextMac(Delegate* delegate);
PrintingContextMac(const PrintingContextMac&) = delete; PrintingContextMac(const PrintingContextMac&) = delete;

@@ -7,11 +7,13 @@
#include <string> #include <string>
#include "base/component_export.h"
#include "printing/printing_context.h" #include "printing/printing_context.h"
namespace printing { namespace printing {
class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContextNoSystemDialog
: public PrintingContext {
public: public:
explicit PrintingContextNoSystemDialog(Delegate* delegate); explicit PrintingContextNoSystemDialog(Delegate* delegate);
PrintingContextNoSystemDialog(const PrintingContextNoSystemDialog&) = delete; PrintingContextNoSystemDialog(const PrintingContextNoSystemDialog&) = delete;

@@ -16,7 +16,7 @@
namespace printing { namespace printing {
class PRINTING_EXPORT PrintingContextSystemDialogWin class COMPONENT_EXPORT(PRINTING) PrintingContextSystemDialogWin
: public PrintingContextWin { : public PrintingContextWin {
public: public:
explicit PrintingContextSystemDialogWin(Delegate* delegate); explicit PrintingContextSystemDialogWin(Delegate* delegate);

@@ -16,7 +16,7 @@ namespace printing {
class MetafileSkia; class MetafileSkia;
class PrintSettings; class PrintSettings;
class PRINTING_EXPORT PrintingContextWin : public PrintingContext { class COMPONENT_EXPORT(PRINTING) PrintingContextWin : public PrintingContext {
public: public:
explicit PrintingContextWin(Delegate* delegate); explicit PrintingContextWin(Delegate* delegate);
PrintingContextWin(const PrintingContextWin&) = delete; PrintingContextWin(const PrintingContextWin&) = delete;

@@ -1,29 +0,0 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PRINTING_PRINTING_EXPORT_H_
#define PRINTING_PRINTING_EXPORT_H_
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(PRINTING_IMPLEMENTATION)
#define PRINTING_EXPORT __declspec(dllexport)
#else
#define PRINTING_EXPORT __declspec(dllimport)
#endif // defined(PRINTING_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(PRINTING_IMPLEMENTATION)
#define PRINTING_EXPORT __attribute__((visibility("default")))
#else
#define PRINTING_EXPORT
#endif
#endif
#else // defined(COMPONENT_BUILD)
#define PRINTING_EXPORT
#endif
#endif // PRINTING_PRINTING_EXPORT_H_

@@ -5,10 +5,10 @@
#ifndef PRINTING_PRINTING_FEATURES_H_ #ifndef PRINTING_PRINTING_FEATURES_H_
#define PRINTING_PRINTING_FEATURES_H_ #define PRINTING_PRINTING_FEATURES_H_
#include "base/component_export.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
#include "printing/printing_export.h"
namespace printing { namespace printing {
namespace features { namespace features {
@@ -17,26 +17,27 @@ namespace features {
// documented with descriptions of their behaviors in the .cc file. // documented with descriptions of their behaviors in the .cc file.
#if defined(OS_MAC) #if defined(OS_MAC)
PRINTING_EXPORT extern const base::Feature kCupsIppPrintingBackend; COMPONENT_EXPORT(PRINTING) extern const base::Feature kCupsIppPrintingBackend;
#endif // defined(OS_MAC) #endif // defined(OS_MAC)
#if defined(OS_WIN) #if defined(OS_WIN)
PRINTING_EXPORT extern const base::Feature kPrintWithReducedRasterization; COMPONENT_EXPORT(PRINTING)
PRINTING_EXPORT extern const base::Feature kUseXpsForPrinting; extern const base::Feature kPrintWithReducedRasterization;
PRINTING_EXPORT extern const base::Feature kUseXpsForPrintingFromPdf; COMPONENT_EXPORT(PRINTING) extern const base::Feature kUseXpsForPrinting;
COMPONENT_EXPORT(PRINTING) extern const base::Feature kUseXpsForPrintingFromPdf;
// Helper function to determine if there is any print path which could require // Helper function to determine if there is any print path which could require
// the use of XPS print capabilities. // the use of XPS print capabilities.
PRINTING_EXPORT bool IsXpsPrintCapabilityRequired(); COMPONENT_EXPORT(PRINTING) bool IsXpsPrintCapabilityRequired();
// Helper function to determine if printing of a document from a particular // Helper function to determine if printing of a document from a particular
// source should be done using XPS printing API instead of with GDI. // source should be done using XPS printing API instead of with GDI.
PRINTING_EXPORT bool ShouldPrintUsingXps(bool source_is_pdf); COMPONENT_EXPORT(PRINTING) bool ShouldPrintUsingXps(bool source_is_pdf);
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
defined(OS_CHROMEOS) defined(OS_CHROMEOS)
PRINTING_EXPORT extern const base::Feature kEnableOopPrintDrivers; COMPONENT_EXPORT(PRINTING) extern const base::Feature kEnableOopPrintDrivers;
#endif // defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || #endif // defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) ||
// defined(OS_CHROMEOS) // defined(OS_CHROMEOS)

@@ -9,8 +9,8 @@
#include <string> #include <string>
#include "base/component_export.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "printing/printing_export.h"
namespace gfx { namespace gfx {
class Size; class Size;
@@ -19,32 +19,34 @@ class Size;
namespace printing { namespace printing {
// Simplify title to resolve issue with some drivers. // Simplify title to resolve issue with some drivers.
PRINTING_EXPORT std::u16string SimplifyDocumentTitle( COMPONENT_EXPORT(PRINTING)
const std::u16string& title); std::u16string SimplifyDocumentTitle(const std::u16string& title);
PRINTING_EXPORT std::u16string SimplifyDocumentTitleWithLength( COMPONENT_EXPORT(PRINTING)
const std::u16string& title, std::u16string SimplifyDocumentTitleWithLength(const std::u16string& title,
size_t length); size_t length);
PRINTING_EXPORT std::u16string FormatDocumentTitleWithOwner( COMPONENT_EXPORT(PRINTING)
const std::u16string& owner, std::u16string FormatDocumentTitleWithOwner(const std::u16string& owner,
const std::u16string& title); const std::u16string& title);
PRINTING_EXPORT std::u16string FormatDocumentTitleWithOwnerAndLength( COMPONENT_EXPORT(PRINTING)
std::u16string FormatDocumentTitleWithOwnerAndLength(
const std::u16string& owner, const std::u16string& owner,
const std::u16string& title, const std::u16string& title,
size_t length); size_t length);
// Returns the paper size (microns) most common in the locale to the nearest // Returns the paper size (microns) most common in the locale to the nearest
// millimeter. Defaults to ISO A4 for an empty or invalid locale. // millimeter. Defaults to ISO A4 for an empty or invalid locale.
PRINTING_EXPORT gfx::Size GetDefaultPaperSizeFromLocaleMicrons( COMPONENT_EXPORT(PRINTING)
base::StringPiece locale); gfx::Size GetDefaultPaperSizeFromLocaleMicrons(base::StringPiece locale);
// Returns true if both dimensions of the sizes have a delta less than or equal // Returns true if both dimensions of the sizes have a delta less than or equal
// to the epsilon value. // to the epsilon value.
PRINTING_EXPORT bool SizesEqualWithinEpsilon(const gfx::Size& lhs, COMPONENT_EXPORT(PRINTING)
const gfx::Size& rhs, bool SizesEqualWithinEpsilon(const gfx::Size& lhs,
int epsilon); const gfx::Size& rhs,
int epsilon);
} // namespace printing } // namespace printing

@@ -5,15 +5,15 @@
#ifndef PRINTING_SANDBOX_PRINT_BACKEND_SANDBOX_HOOK_LINUX_H_ #ifndef PRINTING_SANDBOX_PRINT_BACKEND_SANDBOX_HOOK_LINUX_H_
#define PRINTING_SANDBOX_PRINT_BACKEND_SANDBOX_HOOK_LINUX_H_ #define PRINTING_SANDBOX_PRINT_BACKEND_SANDBOX_HOOK_LINUX_H_
#include "printing/printing_export.h" #include "base/component_export.h"
#include "sandbox/policy/linux/sandbox_linux.h" #include "sandbox/policy/linux/sandbox_linux.h"
namespace printing { namespace printing {
// Setup allowed commands and filesystem permissions for print backend service // Setup allowed commands and filesystem permissions for print backend service
// sandboxed process. // sandboxed process.
PRINTING_EXPORT bool PrintBackendPreSandboxHook( COMPONENT_EXPORT(PRINTING)
sandbox::policy::SandboxLinux::Options options); bool PrintBackendPreSandboxHook(sandbox::policy::SandboxLinux::Options options);
} // namespace printing } // namespace printing

@@ -5,7 +5,7 @@
#ifndef PRINTING_UNITS_H_ #ifndef PRINTING_UNITS_H_
#define PRINTING_UNITS_H_ #define PRINTING_UNITS_H_
#include "printing/printing_export.h" #include "base/component_export.h"
namespace printing { namespace printing {
@@ -44,21 +44,21 @@ constexpr float kA3WidthInch = 11.69f;
constexpr float kA3HeightInch = 16.54f; constexpr float kA3HeightInch = 16.54f;
// Converts from one unit system to another using integer arithmetics. // Converts from one unit system to another using integer arithmetics.
PRINTING_EXPORT int ConvertUnit(double value, int old_unit, int new_unit); COMPONENT_EXPORT(PRINTING)
int ConvertUnit(double value, int old_unit, int new_unit);
// Converts from one unit system to another using doubles. // Converts from one unit system to another using doubles.
PRINTING_EXPORT double ConvertUnitDouble(double value, COMPONENT_EXPORT(PRINTING)
double old_unit, double ConvertUnitDouble(double value, double old_unit, double new_unit);
double new_unit);
// Converts from 1 pixel to 1 point using integers. // Converts from 1 pixel to 1 point using integers.
PRINTING_EXPORT int ConvertPixelsToPoint(int pixels); COMPONENT_EXPORT(PRINTING) int ConvertPixelsToPoint(int pixels);
// Converts from 1 pixel to 1 point using doubles. // Converts from 1 pixel to 1 point using doubles.
PRINTING_EXPORT double ConvertPixelsToPointDouble(double pixels); COMPONENT_EXPORT(PRINTING) double ConvertPixelsToPointDouble(double pixels);
// Converts from 1 point to 1 pixel using doubles. // Converts from 1 point to 1 pixel using doubles.
PRINTING_EXPORT double ConvertPointsToPixelDouble(double points); COMPONENT_EXPORT(PRINTING) double ConvertPointsToPixelDouble(double points);
} // namespace printing } // namespace printing