// third_party/blink/public/mojom/content_extraction/script_tools.mojom-blink.h 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.

#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_BLINK_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_BLINK_H_

#include <stdint.h>

#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

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

#include "third_party/blink/public/mojom/content_extraction/script_tools.mojom-features.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/content_extraction/script_tools.mojom-shared.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/content_extraction/script_tools.mojom-blink-forward.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/tokens/tokens.mojom-blink.h"
#include "url/mojom/origin.mojom-blink.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-blink.h"

#include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h"
#include "mojo/public/cpp/bindings/lib/wtf_hash_util.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"


#include "third_party/blink/renderer/platform/platform_export.h"
#if !BLINK_MOJO_IMPL && !INSIDE_BLINK
#error "File must only be imported inside blink"
#endif




namespace blink::mojom::blink {

class ScriptToolHostProxy;

template <typename ImplRefTraits>
class ScriptToolHostStub;

class ScriptToolHostRequestValidator;


class PLATFORM_EXPORT ScriptToolHost
    : public ScriptToolHostInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.ScriptToolHost";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = ScriptToolHostInterfaceBase;
  using Proxy_ = ScriptToolHostProxy;

  template <typename ImplRefTraits>
  using Stub_ = ScriptToolHostStub<ImplRefTraits>;

  using RequestValidator_ = ScriptToolHostRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kPauseExecutionMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct PauseExecution_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ScriptToolHost() = default;

  virtual void PauseExecution() = 0;
};

class ModelContextHostProxy;

template <typename ImplRefTraits>
class ModelContextHostStub;

class ModelContextHostRequestValidator;
class ModelContextHostResponseValidator;


class PLATFORM_EXPORT ModelContextHost
    : public ModelContextHostInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.ModelContextHost";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = ModelContextHostInterfaceBase;
  using Proxy_ = ModelContextHostProxy;

  template <typename ImplRefTraits>
  using Stub_ = ModelContextHostStub<ImplRefTraits>;

  using RequestValidator_ = ModelContextHostRequestValidator;
  using ResponseValidator_ = ModelContextHostResponseValidator;
  enum MethodMinVersions : uint32_t {
    kBindModelContextMinVersion = 0,
    kRegisterScriptToolMinVersion = 0,
    kUnregisterScriptToolMinVersion = 0,
    kGetScriptToolsMinVersion = 0,
    kExecuteRemoteScriptToolMinVersion = 0,
    kCancelRemoteScriptToolMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct BindModelContext_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct RegisterScriptTool_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct UnregisterScriptTool_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct GetScriptTools_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct ExecuteRemoteScriptTool_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct CancelRemoteScriptTool_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ModelContextHost() = default;

  virtual void BindModelContext(::mojo::PendingRemote<ModelContext> model_context) = 0;

  using RegisterScriptToolCallback = base::OnceCallback<void()>;
  using RegisterScriptToolMojoCallback = base::OnceCallback<void()>;

  virtual void RegisterScriptTool(ScriptToolPtr tool, RegisterScriptToolCallback callback) = 0;

  virtual void UnregisterScriptTool(const ::blink::String& name) = 0;

  using GetScriptToolsCallback = base::OnceCallback<void(::blink::Vector<ScriptToolPtr>)>;
  using GetScriptToolsMojoCallback = base::OnceCallback<void(::blink::Vector<ScriptToolPtr>)>;

  virtual void GetScriptTools(const ::blink::Vector<::scoped_refptr<const ::blink::SecurityOrigin>>& from_origins, GetScriptToolsCallback callback) = 0;

  using ExecuteRemoteScriptToolCallback = base::OnceCallback<void(const ::blink::String&, bool)>;
  using ExecuteRemoteScriptToolMojoCallback = base::OnceCallback<void(const ::blink::String&, bool)>;

  virtual void ExecuteRemoteScriptTool(const ::base::UnguessableToken& invocation_id, const ::blink::FrameToken& tool_owner_frame_token, const ::scoped_refptr<const ::blink::SecurityOrigin>& expected_target_origin, const ::blink::String& name, const ::blink::String& input_arguments, ExecuteRemoteScriptToolCallback callback) = 0;

  virtual void CancelRemoteScriptTool(const ::base::UnguessableToken& invocation_id) = 0;
};

class ModelContextProxy;

template <typename ImplRefTraits>
class ModelContextStub;

class ModelContextRequestValidator;
class ModelContextResponseValidator;


class PLATFORM_EXPORT ModelContext
    : public ModelContextInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.ModelContext";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = ModelContextInterfaceBase;
  using Proxy_ = ModelContextProxy;

  template <typename ImplRefTraits>
  using Stub_ = ModelContextStub<ImplRefTraits>;

  using RequestValidator_ = ModelContextRequestValidator;
  using ResponseValidator_ = ModelContextResponseValidator;
  enum MethodMinVersions : uint32_t {
    kNotifyToolChangeMinVersion = 0,
    kExecuteScriptToolMinVersion = 0,
    kCancelScriptToolMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct NotifyToolChange_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct ExecuteScriptTool_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct CancelScriptTool_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ModelContext() = default;

  virtual void NotifyToolChange() = 0;

  using ExecuteScriptToolCallback = base::OnceCallback<void(const ::blink::String&, bool)>;
  using ExecuteScriptToolMojoCallback = base::OnceCallback<void(const ::blink::String&, bool)>;

  virtual void ExecuteScriptTool(const ::base::UnguessableToken& invocation_id, const ::blink::String& name, const ::blink::String& input_arguments, ExecuteScriptToolCallback callback) = 0;

  virtual void CancelScriptTool(const ::base::UnguessableToken& invocation_id) = 0;
};



class PLATFORM_EXPORT ScriptToolHostProxy
    : public ScriptToolHost {
 public:
  using InterfaceType = ScriptToolHost;

  explicit ScriptToolHostProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void PauseExecution() final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT ModelContextHostProxy
    : public ModelContextHost {
 public:
  using InterfaceType = ModelContextHost;

  explicit ModelContextHostProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void BindModelContext(::mojo::PendingRemote<ModelContext> model_context) final;
  
  void RegisterScriptTool(ScriptToolPtr tool, RegisterScriptToolCallback callback) final;
  
  void UnregisterScriptTool(const ::blink::String& name) final;
  
  void GetScriptTools(const ::blink::Vector<::scoped_refptr<const ::blink::SecurityOrigin>>& from_origins, GetScriptToolsCallback callback) final;
  
  void ExecuteRemoteScriptTool(const ::base::UnguessableToken& invocation_id, const ::blink::FrameToken& tool_owner_frame_token, const ::scoped_refptr<const ::blink::SecurityOrigin>& expected_target_origin, const ::blink::String& name, const ::blink::String& input_arguments, ExecuteRemoteScriptToolCallback callback) final;
  
  void CancelRemoteScriptTool(const ::base::UnguessableToken& invocation_id) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT ModelContextProxy
    : public ModelContext {
 public:
  using InterfaceType = ModelContext;

  explicit ModelContextProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void NotifyToolChange() final;
  
  void ExecuteScriptTool(const ::base::UnguessableToken& invocation_id, const ::blink::String& name, const ::blink::String& input_arguments, ExecuteScriptToolCallback callback) final;
  
  void CancelScriptTool(const ::base::UnguessableToken& invocation_id) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};
class PLATFORM_EXPORT ScriptToolHostStubDispatch {
 public:
  static bool Accept(ScriptToolHost* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      ScriptToolHost* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<ScriptToolHost>>
class ScriptToolHostStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  ScriptToolHostStub() = default;
  ~ScriptToolHostStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return ScriptToolHostStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return ScriptToolHostStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT ModelContextHostStubDispatch {
 public:
  static bool Accept(ModelContextHost* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      ModelContextHost* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<ModelContextHost>>
class ModelContextHostStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  ModelContextHostStub() = default;
  ~ModelContextHostStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return ModelContextHostStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return ModelContextHostStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT ModelContextStubDispatch {
 public:
  static bool Accept(ModelContext* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      ModelContext* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<ModelContext>>
class ModelContextStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  ModelContextStub() = default;
  ~ModelContextStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return ModelContextStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return ModelContextStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT ScriptToolHostRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT ModelContextHostRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT ModelContextRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT ModelContextHostResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT ModelContextResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};





class PLATFORM_EXPORT ScriptToolAnnotations {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<ScriptToolAnnotations, T>::value>;
  using DataView = ScriptToolAnnotationsDataView;
  using Data_ = internal::ScriptToolAnnotations_Data;

  template <typename... Args>
  static ScriptToolAnnotationsPtr New(Args&&... args) {
    return ScriptToolAnnotationsPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static ScriptToolAnnotationsPtr From(const U& u) {
    return mojo::TypeConverter<ScriptToolAnnotationsPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, ScriptToolAnnotations>::Convert(*this);
  }


  ScriptToolAnnotations();

  ScriptToolAnnotations(
      bool read_only,
      bool untrusted_content,
      bool consequential);


  ~ScriptToolAnnotations();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = ScriptToolAnnotationsPtr>
  ScriptToolAnnotationsPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }
  size_t Hash(size_t seed) const;

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        ScriptToolAnnotations::DataView, ::blink::Vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        ScriptToolAnnotations::DataView, ::blink::Vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        ScriptToolAnnotations::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::ScriptToolAnnotations_UnserializedMessageContext<
            UserType, ScriptToolAnnotations::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<ScriptToolAnnotations::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return ScriptToolAnnotations::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::ScriptToolAnnotations_UnserializedMessageContext<
            UserType, ScriptToolAnnotations::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<ScriptToolAnnotations::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  bool read_only;
  
  bool untrusted_content;
  
  bool consequential;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, ScriptToolAnnotations::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}









class PLATFORM_EXPORT ScriptTool {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<ScriptTool, T>::value>;
  using DataView = ScriptToolDataView;
  using Data_ = internal::ScriptTool_Data;

  template <typename... Args>
  static ScriptToolPtr New(Args&&... args) {
    return ScriptToolPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static ScriptToolPtr From(const U& u) {
    return mojo::TypeConverter<ScriptToolPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, ScriptTool>::Convert(*this);
  }


  ScriptTool();

  ScriptTool(
      const ::blink::String& name,
      const ::blink::String& title,
      const ::blink::String& description,
      const ::blink::String& input_schema,
      ScriptToolAnnotationsPtr annotations,
      ::blink::Vector<::scoped_refptr<const ::blink::SecurityOrigin>> exposed_origins,
      const ::blink::FrameToken& tool_owner_frame_token,
      const ::scoped_refptr<const ::blink::SecurityOrigin>& origin);

ScriptTool(const ScriptTool&) = delete;
ScriptTool& operator=(const ScriptTool&) = delete;

  ~ScriptTool();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = ScriptToolPtr>
  ScriptToolPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        ScriptTool::DataView, ::blink::Vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        ScriptTool::DataView, ::blink::Vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        ScriptTool::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::ScriptTool_UnserializedMessageContext<
            UserType, ScriptTool::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<ScriptTool::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return ScriptTool::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::ScriptTool_UnserializedMessageContext<
            UserType, ScriptTool::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<ScriptTool::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  ::blink::String name;
  
  ::blink::String title;
  
  ::blink::String description;
  
  ::blink::String input_schema;
  
  ScriptToolAnnotationsPtr annotations;
  
  ::blink::Vector<::scoped_refptr<const ::blink::SecurityOrigin>> exposed_origins;
  
  ::blink::FrameToken tool_owner_frame_token;
  
  ::scoped_refptr<const ::blink::SecurityOrigin> origin;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, ScriptTool::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}

template <typename StructPtrType>
ScriptToolAnnotationsPtr ScriptToolAnnotations::Clone() const {
  return New(
      mojo::Clone(read_only),
      mojo::Clone(untrusted_content),
      mojo::Clone(consequential)
  );
}

template <typename T, ScriptToolAnnotations::EnableIfSame<T>*>
bool ScriptToolAnnotations::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->read_only, other_struct.read_only))
    return false;
  if (!mojo::Equals(this->untrusted_content, other_struct.untrusted_content))
    return false;
  if (!mojo::Equals(this->consequential, other_struct.consequential))
    return false;
  return true;
}

template <typename T, ScriptToolAnnotations::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.read_only < rhs.read_only)
    return true;
  if (rhs.read_only < lhs.read_only)
    return false;
  if (lhs.untrusted_content < rhs.untrusted_content)
    return true;
  if (rhs.untrusted_content < lhs.untrusted_content)
    return false;
  if (lhs.consequential < rhs.consequential)
    return true;
  if (rhs.consequential < lhs.consequential)
    return false;
  return false;
}
template <typename StructPtrType>
ScriptToolPtr ScriptTool::Clone() const {
  return New(
      mojo::Clone(name),
      mojo::Clone(title),
      mojo::Clone(description),
      mojo::Clone(input_schema),
      mojo::Clone(annotations),
      mojo::Clone(exposed_origins),
      mojo::Clone(tool_owner_frame_token),
      mojo::Clone(origin)
  );
}

template <typename T, ScriptTool::EnableIfSame<T>*>
bool ScriptTool::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->name, other_struct.name))
    return false;
  if (!mojo::Equals(this->title, other_struct.title))
    return false;
  if (!mojo::Equals(this->description, other_struct.description))
    return false;
  if (!mojo::Equals(this->input_schema, other_struct.input_schema))
    return false;
  if (!mojo::Equals(this->annotations, other_struct.annotations))
    return false;
  if (!mojo::Equals(this->exposed_origins, other_struct.exposed_origins))
    return false;
  if (!mojo::Equals(this->tool_owner_frame_token, other_struct.tool_owner_frame_token))
    return false;
  if (!mojo::Equals(this->origin, other_struct.origin))
    return false;
  return true;
}

template <typename T, ScriptTool::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.name < rhs.name)
    return true;
  if (rhs.name < lhs.name)
    return false;
  if (lhs.title < rhs.title)
    return true;
  if (rhs.title < lhs.title)
    return false;
  if (lhs.description < rhs.description)
    return true;
  if (rhs.description < lhs.description)
    return false;
  if (lhs.input_schema < rhs.input_schema)
    return true;
  if (rhs.input_schema < lhs.input_schema)
    return false;
  if (lhs.annotations < rhs.annotations)
    return true;
  if (rhs.annotations < lhs.annotations)
    return false;
  if (lhs.exposed_origins < rhs.exposed_origins)
    return true;
  if (rhs.exposed_origins < lhs.exposed_origins)
    return false;
  if (lhs.tool_owner_frame_token < rhs.tool_owner_frame_token)
    return true;
  if (rhs.tool_owner_frame_token < lhs.tool_owner_frame_token)
    return false;
  if (lhs.origin < rhs.origin)
    return true;
  if (rhs.origin < lhs.origin)
    return false;
  return false;
}


}  // blink::mojom::blink

namespace mojo {


template <>
struct PLATFORM_EXPORT StructTraits<::blink::mojom::blink::ScriptToolAnnotations::DataView,
                                         ::blink::mojom::blink::ScriptToolAnnotationsPtr> {
  static bool IsNull(const ::blink::mojom::blink::ScriptToolAnnotationsPtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::ScriptToolAnnotationsPtr* output) { output->reset(); }

  static decltype(::blink::mojom::blink::ScriptToolAnnotations::read_only) read_only(
      const ::blink::mojom::blink::ScriptToolAnnotationsPtr& input) {
    return input->read_only;
  }

  static decltype(::blink::mojom::blink::ScriptToolAnnotations::untrusted_content) untrusted_content(
      const ::blink::mojom::blink::ScriptToolAnnotationsPtr& input) {
    return input->untrusted_content;
  }

  static decltype(::blink::mojom::blink::ScriptToolAnnotations::consequential) consequential(
      const ::blink::mojom::blink::ScriptToolAnnotationsPtr& input) {
    return input->consequential;
  }

  static bool Read(::blink::mojom::blink::ScriptToolAnnotations::DataView input, ::blink::mojom::blink::ScriptToolAnnotationsPtr* output);
};


template <>
struct PLATFORM_EXPORT StructTraits<::blink::mojom::blink::ScriptTool::DataView,
                                         ::blink::mojom::blink::ScriptToolPtr> {
  static bool IsNull(const ::blink::mojom::blink::ScriptToolPtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::ScriptToolPtr* output) { output->reset(); }

  static const decltype(::blink::mojom::blink::ScriptTool::name)& name(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->name;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::title)& title(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->title;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::description)& description(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->description;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::input_schema)& input_schema(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->input_schema;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::annotations)& annotations(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->annotations;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::exposed_origins)& exposed_origins(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->exposed_origins;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::tool_owner_frame_token)& tool_owner_frame_token(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->tool_owner_frame_token;
  }

  static const decltype(::blink::mojom::blink::ScriptTool::origin)& origin(
      const ::blink::mojom::blink::ScriptToolPtr& input) {
    return input->origin;
  }

  static bool Read(::blink::mojom::blink::ScriptTool::DataView input, ::blink::mojom::blink::ScriptToolPtr* output);
};

}  // namespace mojo

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_BLINK_H_