// chrome/common/chrome_render_frame.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit

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

#ifndef CHROME_COMMON_CHROME_RENDER_FRAME_MOJOM_SHARED_H_
#define CHROME_COMMON_CHROME_RENDER_FRAME_MOJOM_SHARED_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "chrome/common/chrome_render_frame.mojom-shared-internal.h"
#include "chrome/common/actor.mojom-shared.h"
#include "components/actor/public/mojom/actor_types.mojom-shared.h"
#include "components/lens/lens_metadata.mojom-shared.h"
#include "components/page_content_annotations/content/mojom/page_stability.mojom-shared.h"
#include "mojo/public/mojom/base/string16.mojom-shared.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-shared.h"
#include "skia/public/mojom/bitmap.mojom-shared.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"
#include "url/mojom/url.mojom-shared.h"
#include "mojo/public/cpp/bindings/lib/interface_serialization.h"
#include "mojo/public/cpp/system/data_pipe.h"



#include "chrome/common/chrome_render_frame.mojom-data-view.h"  // IWYU pragma: export




namespace std {

template <>
struct hash<::chrome::mojom::ImageFormat>
    : public mojo::internal::EnumHashImpl<::chrome::mojom::ImageFormat> {};

}  // namespace std

namespace mojo {


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::chrome::mojom::ImageFormat, MaybeConstUserType> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = EnumTraits<::chrome::mojom::ImageFormat, UserType>;

  static void Serialize(UserType input, int32_t* output) {
    *output = static_cast<int32_t>(Traits::ToMojom(input));
  }

  static bool Deserialize(int32_t input, UserType* output) {
    auto known_value = ::mojo::internal::ToKnownEnumValueHelper(
        static_cast<::chrome::mojom::ImageFormat>(input));
    if constexpr (requires {
                    {
                      Traits::FromMojom(known_value)
                    } -> std::same_as<UserType>;
                  }) {
      static_assert(std::same_as<::chrome::mojom::ImageFormat, UserType> ||
                        HasInfallibleConversion(::chrome::mojom::ImageFormat()),
                    "::chrome::mojom::ImageFormat does not have an infallible conversion, "
                    "use an optional return type.");
      *output = Traits::FromMojom(known_value);
      return true;
    } else {
      static_assert(
          requires {
            {
              Traits::FromMojom(known_value)
            } -> std::same_as<std::optional<UserType>>;
          }, "FromMojom must return by value or optional.");
      std::optional<UserType> from_mojom = Traits::FromMojom(known_value);
      if (from_mojom) {
        *output = *from_mojom;
      }
      return from_mojom.has_value();
    }
  }
};

}  // namespace internal

}  // namespace mojo


namespace chrome::mojom {


}  // chrome::mojom

// Declare TraceFormatTraits for enums, which should be defined in ::perfetto
// namespace.

namespace perfetto {

template <>
struct  TraceFormatTraits<::chrome::mojom::ImageFormat> {
 static void WriteIntoTrace(perfetto::TracedValue context, ::chrome::mojom::ImageFormat value);
};

} // namespace perfetto

#endif  // CHROME_COMMON_CHROME_RENDER_FRAME_MOJOM_SHARED_H_