// third_party/blink/public/mojom/frame/frame_owner_properties.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 "third_party/blink/public/mojom/frame/frame_owner_properties.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 "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-params-data.h"
#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace blink::mojom::blink {
FrameOwnerProperties::FrameOwnerProperties()
    : name(),
      scrollbar_mode(),
      margin_width(),
      margin_height(),
      allow_fullscreen(),
      allow_payment_request(),
      is_display_none(),
      color_scheme(::blink::mojom::blink::ColorScheme::kLight),
      preferred_color_scheme(::blink::mojom::blink::PreferredColorScheme::kLight),
      responsive_sizing(FrameResponsiveSizing::kNone) {}

FrameOwnerProperties::FrameOwnerProperties(
    const ::blink::String& name_in,
    ::blink::mojom::blink::ScrollbarMode scrollbar_mode_in,
    int32_t margin_width_in,
    int32_t margin_height_in,
    bool allow_fullscreen_in,
    bool allow_payment_request_in,
    bool is_display_none_in,
    ::blink::mojom::blink::ColorScheme color_scheme_in,
    ::blink::mojom::blink::PreferredColorScheme preferred_color_scheme_in,
    FrameResponsiveSizing responsive_sizing_in)
    : name(std::move(name_in)),
      scrollbar_mode(std::move(scrollbar_mode_in)),
      margin_width(std::move(margin_width_in)),
      margin_height(std::move(margin_height_in)),
      allow_fullscreen(std::move(allow_fullscreen_in)),
      allow_payment_request(std::move(allow_payment_request_in)),
      is_display_none(std::move(is_display_none_in)),
      color_scheme(std::move(color_scheme_in)),
      preferred_color_scheme(std::move(preferred_color_scheme_in)),
      responsive_sizing(std::move(responsive_sizing_in)) {}

FrameOwnerProperties::~FrameOwnerProperties() = default;
size_t FrameOwnerProperties::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->name);
  seed = mojo::internal::WTFHash(seed, this->scrollbar_mode);
  seed = mojo::internal::WTFHash(seed, this->margin_width);
  seed = mojo::internal::WTFHash(seed, this->margin_height);
  seed = mojo::internal::WTFHash(seed, this->allow_fullscreen);
  seed = mojo::internal::WTFHash(seed, this->allow_payment_request);
  seed = mojo::internal::WTFHash(seed, this->is_display_none);
  seed = mojo::internal::WTFHash(seed, this->color_scheme);
  seed = mojo::internal::WTFHash(seed, this->preferred_color_scheme);
  seed = mojo::internal::WTFHash(seed, this->responsive_sizing);
  return seed;
}

void FrameOwnerProperties::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "name"), this->name,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::String&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "scrollbar_mode"), this->scrollbar_mode,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::mojom::blink::ScrollbarMode>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "margin_width"), this->margin_width,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "margin_height"), this->margin_height,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "allow_fullscreen"), this->allow_fullscreen,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "allow_payment_request"), this->allow_payment_request,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "is_display_none"), this->is_display_none,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "color_scheme"), this->color_scheme,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::mojom::blink::ColorScheme>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "preferred_color_scheme"), this->preferred_color_scheme,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::mojom::blink::PreferredColorScheme>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "responsive_sizing"), this->responsive_sizing,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type FrameResponsiveSizing>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // blink::mojom::blink


namespace mojo {


// static
bool StructTraits<::blink::mojom::blink::FrameOwnerProperties::DataView, ::blink::mojom::blink::FrameOwnerPropertiesPtr>::Read(
    ::blink::mojom::blink::FrameOwnerProperties::DataView input,
    ::blink::mojom::blink::FrameOwnerPropertiesPtr* output) {
  bool success = true;
  ::blink::mojom::blink::FrameOwnerPropertiesPtr result(::blink::mojom::blink::FrameOwnerProperties::New());
  
      if (success && !input.ReadName(&result->name))
        success = false;
      if (success && !input.ReadScrollbarMode(&result->scrollbar_mode))
        success = false;
      if (success)
        result->margin_width = input.margin_width();
      if (success)
        result->margin_height = input.margin_height();
      if (success)
        result->allow_fullscreen = input.allow_fullscreen();
      if (success)
        result->allow_payment_request = input.allow_payment_request();
      if (success)
        result->is_display_none = input.is_display_none();
      if (success && !input.ReadColorScheme(&result->color_scheme))
        success = false;
      if (success && !input.ReadPreferredColorScheme(&result->preferred_color_scheme))
        success = false;
      if (success && !input.ReadResponsiveSizing(&result->responsive_sizing))
        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 blink::mojom::blink {




}  // blink::mojom::blink


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