#ifndef PRINTING_BACKEND_PRINT_BACKEND_WIN_H_
#define PRINTING_BACKEND_PRINT_BACKEND_WIN_H_
#include <stddef.h>
#include <optional>
#include <string>
#include <vector>
#include "base/component_export.h"
#include "base/functional/callback.h"
#include "printing/backend/print_backend.h"
#include "ui/gfx/geometry/rect.h"
namespace printing {
class COMPONENT_EXPORT(PRINT_BACKEND) PrintBackendWin : public PrintBackend {
public:
PrintBackendWin();
mojom::ResultCode EnumeratePrinters(PrinterList& printer_list) override;
mojom::ResultCode GetDefaultPrinterName(
std::string& default_printer) override;
mojom::ResultCode GetPrinterBasicInfo(
const std::string& printer_name,
PrinterBasicInfo* printer_info) override;
mojom::ResultCode GetPrinterSemanticCapsAndDefaults(
const std::string& printer_name,
PrinterSemanticCapsAndDefaults* printer_info) override;
mojom::ResultCode GetPrinterCapsAndDefaults(
const std::string& printer_name,
PrinterCapsAndDefaults* printer_info) override;
std::optional<gfx::Rect> GetPaperPrintableArea(
const std::string& printer_name,
const std::string& paper_vendor_id,
const gfx::Size& paper_size_um) override;
std::vector<std::string> GetPrinterDriverInfo(
const std::string& printer_name) override;
bool IsValidPrinter(const std::string& printer_name) override;
void SetPrintableAreaLoadedCallbackForTesting(
base::RepeatingClosure callback);
protected:
struct DriverPaperPrintableArea {
DriverPaperPrintableArea(const std::string& name,
const std::vector<std::string>& driver,
const std::string& id,
const gfx::Rect& area_um);
DriverPaperPrintableArea(const DriverPaperPrintableArea& other);
~DriverPaperPrintableArea();
std::string printer_name;
std::vector<std::string> driver_info;
std::string vendor_id;
gfx::Rect printable_area_um;
};
~PrintBackendWin() override;
private:
std::optional<DriverPaperPrintableArea> last_default_paper_printable_area_;
base::RepeatingClosure printable_area_loaded_callback_for_test_;
};
}
#endif