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

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


namespace blink::mojom::blink {
DeviceEmulationParams::DeviceEmulationParams()
    : screen_type(),
      screen_size(),
      view_position(),
      view_size(),
      device_scale_factor(),
      scale(),
      viewport_offset(),
      viewport_scale(),
      screen_orientation_type(),
      screen_orientation_angle(),
      viewport_segments(),
      device_posture(),
      force_android_overlay_scrollbar() {}

DeviceEmulationParams::DeviceEmulationParams(
    EmulatedScreenType screen_type_in,
    const ::gfx::Size& screen_size_in,
    const std::optional<::gfx::Point>& view_position_in,
    const ::gfx::Size& view_size_in,
    float device_scale_factor_in,
    float scale_in,
    const ::gfx::PointF& viewport_offset_in,
    float viewport_scale_in,
    ::display::mojom::blink::ScreenOrientation screen_orientation_type_in,
    uint32_t screen_orientation_angle_in,
    ::blink::Vector<::gfx::Rect> viewport_segments_in,
    ::blink::mojom::blink::DevicePostureType device_posture_in,
    bool force_android_overlay_scrollbar_in)
    : screen_type(std::move(screen_type_in)),
      screen_size(std::move(screen_size_in)),
      view_position(std::move(view_position_in)),
      view_size(std::move(view_size_in)),
      device_scale_factor(std::move(device_scale_factor_in)),
      scale(std::move(scale_in)),
      viewport_offset(std::move(viewport_offset_in)),
      viewport_scale(std::move(viewport_scale_in)),
      screen_orientation_type(std::move(screen_orientation_type_in)),
      screen_orientation_angle(std::move(screen_orientation_angle_in)),
      viewport_segments(std::move(viewport_segments_in)),
      device_posture(std::move(device_posture_in)),
      force_android_overlay_scrollbar(std::move(force_android_overlay_scrollbar_in)) {}

DeviceEmulationParams::~DeviceEmulationParams() = default;

void DeviceEmulationParams::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "screen_type"), this->screen_type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type EmulatedScreenType>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "screen_size"), this->screen_size,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "view_position"), this->view_position,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::optional<::gfx::Point>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "view_size"), this->view_size,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "device_scale_factor"), this->device_scale_factor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "scale"), this->scale,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "viewport_offset"), this->viewport_offset,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "viewport_scale"), this->viewport_scale,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "screen_orientation_type"), this->screen_orientation_type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::display::mojom::blink::ScreenOrientation>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "screen_orientation_angle"), this->screen_orientation_angle,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "viewport_segments"), this->viewport_segments,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::Vector<::gfx::Rect>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "device_posture"), this->device_posture,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::mojom::blink::DevicePostureType>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "force_android_overlay_scrollbar"), this->force_android_overlay_scrollbar,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool DeviceEmulationParams::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::DeviceEmulationParams::DataView, ::blink::mojom::blink::DeviceEmulationParamsPtr>::Read(
    ::blink::mojom::blink::DeviceEmulationParams::DataView input,
    ::blink::mojom::blink::DeviceEmulationParamsPtr* output) {
  bool success = true;
  ::blink::mojom::blink::DeviceEmulationParamsPtr result(::blink::mojom::blink::DeviceEmulationParams::New());
  
      if (success && !input.ReadScreenType(&result->screen_type))
        success = false;
      if (success && !input.ReadScreenSize(&result->screen_size))
        success = false;
      if (success && !input.ReadViewPosition(&result->view_position))
        success = false;
      if (success && !input.ReadViewSize(&result->view_size))
        success = false;
      if (success)
        result->device_scale_factor = input.device_scale_factor();
      if (success)
        result->scale = input.scale();
      if (success && !input.ReadViewportOffset(&result->viewport_offset))
        success = false;
      if (success)
        result->viewport_scale = input.viewport_scale();
      if (success && !input.ReadScreenOrientationType(&result->screen_orientation_type))
        success = false;
      if (success)
        result->screen_orientation_angle = input.screen_orientation_angle();
      if (success && !input.ReadViewportSegments(&result->viewport_segments))
        success = false;
      if (success && !input.ReadDevicePosture(&result->device_posture))
        success = false;
      if (success)
        result->force_android_overlay_scrollbar = input.force_android_overlay_scrollbar();
  *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