#include "third_party/blink/renderer/modules/printing/web_printer.h"
#include <limits>
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_print_document_description.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_print_job_template_attributes.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printer_attributes.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_media_collection_requested.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_media_size_requested.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_resolution.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/fileapi/blob.h"
#include "third_party/blink/renderer/modules/printing/web_print_job.h"
#include "third_party/blink/renderer/modules/printing/web_printing_type_converters.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
namespace blink {
namespace {
constexpr char kUserPermissionDeniedError[] = …;
constexpr char kPrinterUnreachableError[] = …;
bool IsPositiveInt32(uint32_t value) { … }
bool ValidatePrintJobTemplateAttributes(
const WebPrintJobTemplateAttributes* pjt_attributes,
ExceptionState& exception_state) { … }
}
WebPrinter::WebPrinter(ExecutionContext* execution_context,
mojom::blink::WebPrinterInfoPtr printer_info)
: … { … }
WebPrinter::~WebPrinter() = default;
void WebPrinter::Trace(Visitor* visitor) const { … }
ScriptPromise<WebPrinterAttributes> WebPrinter::fetchAttributes(
ScriptState* script_state,
ExceptionState& exception_state) { … }
ScriptPromise<WebPrintJob> WebPrinter::printJob(
ScriptState* script_state,
const String& job_name,
const WebPrintDocumentDescription* document,
const WebPrintJobTemplateAttributes* pjt_attributes,
ExceptionState& exception_state) { … }
void WebPrinter::OnFetchAttributes(
ScriptPromiseResolver<WebPrinterAttributes>*,
mojom::blink::WebPrinterFetchResultPtr result) { … }
void WebPrinter::OnPrint(ScriptPromiseResolver<WebPrintJob>* resolver,
mojom::blink::WebPrintResultPtr result) { … }
}