chromium/third_party/blink/renderer/modules/printing/web_printing_type_converters.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/printing/web_printing_type_converters.h"

#include "third_party/blink/public/mojom/printing/web_printing.mojom-blink.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_unsignedlong_webprintingrange.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_print_color_mode.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_printer_state.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_media_collection.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.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_mime_media_type.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_multiple_document_handling.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_orientation_requested.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_range.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_resolution.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_resolution_units.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_printing_sides.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/resolution_units.h"

namespace {
// copies:
BlinkRange;
MojomRangePtr;

// sides:
V8Sides;
MojomSides;

// media-col:
BlinkMediaCollection;
BlinkMediaCollectionRequested;
V8MediaSizeDimension;
MojomMediaCollection;
MojomMediaCollectionRequested;
MojomMediaCollectionRequestedPtr;
MojomMediaSizeDimensionPtr;

// multiple-document-handling:
V8MultipleDocumentHandling;
MojomMultipleDocumentHandling;

// orientation-requested:
V8OrientationRequested;
MojomOrientationRequested;

// state:
V8JobState;
MojomJobState;

// print-color-mode:
V8ColorMode;
MojomColorMode;

// printer-state:
V8PrinterState;
MojomPrinterState;

// printer-state-reason:
V8PrinterStateReason;
MojomPrinterStateReason;
}  // namespace

namespace mojo {

template <>
struct TypeConverter<V8Sides, MojomSides> {};

template <>
struct TypeConverter<MojomSides, V8Sides> {};

template <>
struct TypeConverter<V8MultipleDocumentHandling,
                     MojomMultipleDocumentHandling> {};

template <>
struct TypeConverter<MojomMultipleDocumentHandling,
                     V8MultipleDocumentHandling> {};

template <>
struct TypeConverter<V8OrientationRequested, MojomOrientationRequested> {};

template <>
struct TypeConverter<MojomOrientationRequested, V8OrientationRequested> {};

template <>
struct TypeConverter<BlinkRange*, MojomRangePtr> {};

template <>
struct TypeConverter<V8MediaSizeDimension*, MojomMediaSizeDimensionPtr> {};

template <>
struct TypeConverter<BlinkMediaCollection*, MojomMediaCollection*> {};

template <>
struct TypeConverter<MojomMediaCollectionRequestedPtr,
                     BlinkMediaCollectionRequested*> {};

template <>
struct TypeConverter<gfx::Size, blink::WebPrintingResolution*> {};

template <>
struct TypeConverter<blink::WebPrintingResolution*, gfx::Size> {};

template <>
struct TypeConverter<V8ColorMode, MojomColorMode> {};

template <>
struct TypeConverter<MojomColorMode, V8ColorMode> {};

template <>
struct TypeConverter<V8PrinterState::Enum, MojomPrinterState> {};

template <>
struct TypeConverter<V8PrinterStateReason, MojomPrinterStateReason> {};

}  // namespace mojo

namespace blink {

namespace {

void ProcessCopies(const mojom::blink::WebPrinterAttributes& new_attributes,
                   WebPrinterAttributes* current_attributes) {}

void ProcessDocumentFormat(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessMediaCollection(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessMediaSource(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessMultipleDocumentHandling(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessOrientationRequested(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessPrinterResolution(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessPrintColorMode(
    const mojom::blink::WebPrinterAttributes& new_attributes,
    WebPrinterAttributes* current_attributes) {}

void ProcessSides(const mojom::blink::WebPrinterAttributes& new_attributes,
                  WebPrinterAttributes* current_attributes) {}

}  // namespace

}  // namespace blink

namespace mojo {

blink::WebPrinterAttributes*
TypeConverter<blink::WebPrinterAttributes*,
              blink::mojom::blink::WebPrinterAttributesPtr>::
    Convert(const blink::mojom::blink::WebPrinterAttributesPtr&
                printer_attributes) {}

blink::mojom::blink::WebPrintJobTemplateAttributesPtr
TypeConverter<blink::mojom::blink::WebPrintJobTemplateAttributesPtr,
              blink::WebPrintJobTemplateAttributes*>::
    Convert(const blink::WebPrintJobTemplateAttributes* pjt_attributes) {}

V8JobState::Enum TypeConverter<V8JobState::Enum, MojomJobState>::Convert(
    const MojomJobState& state) {}

}  // namespace mojo