// printing/mojom/print.mojom-blink.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 "printing/mojom/print.mojom-blink.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 "printing/mojom/print.mojom-params-data.h"
#include "printing/mojom/print.mojom-shared-message-ids.h"

#include "printing/mojom/print.mojom-blink-import-headers.h"
#include "printing/mojom/print.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace printing::mojom::blink {
PageSizeMargins::PageSizeMargins()
    : content_width(),
      content_height(),
      margin_top(),
      margin_right(),
      margin_bottom(),
      margin_left() {}

PageSizeMargins::PageSizeMargins(
    double content_width_in,
    double content_height_in,
    double margin_top_in,
    double margin_right_in,
    double margin_bottom_in,
    double margin_left_in)
    : content_width(std::move(content_width_in)),
      content_height(std::move(content_height_in)),
      margin_top(std::move(margin_top_in)),
      margin_right(std::move(margin_right_in)),
      margin_bottom(std::move(margin_bottom_in)),
      margin_left(std::move(margin_left_in)) {}

PageSizeMargins::~PageSizeMargins() = default;
size_t PageSizeMargins::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->content_width);
  seed = mojo::internal::WTFHash(seed, this->content_height);
  seed = mojo::internal::WTFHash(seed, this->margin_top);
  seed = mojo::internal::WTFHash(seed, this->margin_right);
  seed = mojo::internal::WTFHash(seed, this->margin_bottom);
  seed = mojo::internal::WTFHash(seed, this->margin_left);
  return seed;
}

void PageSizeMargins::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "content_width"), this->content_width,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "content_height"), this->content_height,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "margin_top"), this->margin_top,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "margin_right"), this->margin_right,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "margin_bottom"), this->margin_bottom,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "margin_left"), this->margin_left,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool PageSizeMargins::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
PageRange::PageRange()
    : from(),
      to() {}

PageRange::PageRange(
    uint32_t from_in,
    uint32_t to_in)
    : from(std::move(from_in)),
      to(std::move(to_in)) {}

PageRange::~PageRange() = default;
size_t PageRange::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->from);
  seed = mojo::internal::WTFHash(seed, this->to);
  return seed;
}

void PageRange::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "from"), this->from,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "to"), this->to,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // printing::mojom::blink


namespace mojo {


// static
bool StructTraits<::printing::mojom::blink::PageSizeMargins::DataView, ::printing::mojom::blink::PageSizeMarginsPtr>::Read(
    ::printing::mojom::blink::PageSizeMargins::DataView input,
    ::printing::mojom::blink::PageSizeMarginsPtr* output) {
  bool success = true;
  ::printing::mojom::blink::PageSizeMarginsPtr result(::printing::mojom::blink::PageSizeMargins::New());
  
      if (success)
        result->content_width = input.content_width();
      if (success)
        result->content_height = input.content_height();
      if (success)
        result->margin_top = input.margin_top();
      if (success)
        result->margin_right = input.margin_right();
      if (success)
        result->margin_bottom = input.margin_bottom();
      if (success)
        result->margin_left = input.margin_left();
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::printing::mojom::blink::PageRange::DataView, ::printing::mojom::blink::PageRangePtr>::Read(
    ::printing::mojom::blink::PageRange::DataView input,
    ::printing::mojom::blink::PageRangePtr* output) {
  bool success = true;
  ::printing::mojom::blink::PageRangePtr result(::printing::mojom::blink::PageRange::New());
  
      if (success)
        result->from = input.from();
      if (success)
        result->to = input.to();
  *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::blink {




}  // printing::mojom::blink


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