// chrome/services/printing/public/mojom/pdf_render_settings.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "chrome/services/printing/public/mojom/pdf_render_settings.mojom.h"
#include <stdint.h>
#include <utility>
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "chrome/services/printing/public/mojom/pdf_render_settings.mojom-params-data.h"
#include "chrome/services/printing/public/mojom/pdf_render_settings.mojom-shared-message-ids.h"

#include "chrome/services/printing/public/mojom/pdf_render_settings.mojom-import-headers.h"
#include "chrome/services/printing/public/mojom/pdf_render_settings.mojom-test-utils.h"


namespace printing::mojom {
PdfRenderSettings::PdfRenderSettings()
    : area(),
      offsets(),
      dpi(),
      autorotate(),
      use_color(),
      mode() {}

PdfRenderSettings::PdfRenderSettings(
    const ::gfx::Rect& area_in,
    const ::gfx::Point& offsets_in,
    const ::gfx::Size& dpi_in,
    bool autorotate_in,
    bool use_color_in,
    ::printing::PdfRenderSettings::Mode mode_in)
    : area(std::move(area_in)),
      offsets(std::move(offsets_in)),
      dpi(std::move(dpi_in)),
      autorotate(std::move(autorotate_in)),
      use_color(std::move(use_color_in)),
      mode(std::move(mode_in)) {}

PdfRenderSettings::~PdfRenderSettings() = default;

void PdfRenderSettings::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "area"), this->area,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Rect&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "offsets"), this->offsets,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Point&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "dpi"), this->dpi,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "autorotate"), this->autorotate,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "use_color"), this->use_color,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "mode"), this->mode,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::printing::PdfRenderSettings::Mode>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool PdfRenderSettings::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}


}  // printing::mojom


namespace mojo {


// static
bool StructTraits<::printing::mojom::PdfRenderSettings::DataView, ::printing::mojom::PdfRenderSettingsPtr>::Read(
    ::printing::mojom::PdfRenderSettings::DataView input,
    ::printing::mojom::PdfRenderSettingsPtr* output) {
  bool success = true;
  ::printing::mojom::PdfRenderSettingsPtr result(::printing::mojom::PdfRenderSettings::New());
  
      if (success && !input.ReadArea(&result->area))
        success = false;
      if (success && !input.ReadOffsets(&result->offsets))
        success = false;
      if (success && !input.ReadDpi(&result->dpi))
        success = false;
      if (success)
        result->autorotate = input.autorotate();
      if (success)
        result->use_color = input.use_color();
      if (success && !input.ReadMode(&result->mode))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo


// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.


namespace printing::mojom {




}  // printing::mojom


#if defined(__clang__)
#pragma clang diagnostic pop
#endif