// media/mojo/mojom/mediadrm_support.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit

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

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef MEDIA_MOJO_MOJOM_MEDIADRM_SUPPORT_MOJOM_DATA_VIEW_H_
#define MEDIA_MOJO_MOJOM_MEDIADRM_SUPPORT_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "media/mojo/mojom/mediadrm_support.mojom-shared-internal.h"
#include "mojo/public/mojom/base/version.mojom-shared.h"
#include "sandbox/policy/mojom/sandbox.mojom-shared.h"


namespace media::mojom {
class MediaDrmSupportResultDataView;



}  // media::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::media::mojom::MediaDrmSupportResultDataView> {
  using Data = ::media::mojom::internal::MediaDrmSupportResult_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace media::mojom {
// Interface base classes. They are used for type safety check.
class MediaDrmSupportInterfaceBase {};

using MediaDrmSupportPtrDataView =
    mojo::InterfacePtrDataView<MediaDrmSupportInterfaceBase>;
using MediaDrmSupportRequestDataView =
    mojo::InterfaceRequestDataView<MediaDrmSupportInterfaceBase>;
using MediaDrmSupportAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<MediaDrmSupportInterfaceBase>;
using MediaDrmSupportAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<MediaDrmSupportInterfaceBase>;


class MediaDrmSupportResultDataView {
 public:
  MediaDrmSupportResultDataView() = default;

  MediaDrmSupportResultDataView(
      internal::MediaDrmSupportResult_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  bool key_system_supports_video_mp4() const {
    return data_->key_system_supports_video_mp4;
  }
  bool key_system_supports_video_webm() const {
    return data_->key_system_supports_video_webm;
  }
  inline void GetKeySystemVersionDataView(
      ::mojo_base::mojom::VersionDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadKeySystemVersion(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::mojo_base::mojom::VersionDataView, UserType>(),
    "Attempting to read the optional `key_system_version` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadKeySystemVersion` instead "
    "of `ReadKeySystemVersion if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->key_system_version.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::VersionDataView>(
        pointer, output, message_);
  }
 private:
  internal::MediaDrmSupportResult_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // media::mojom

#endif  // MEDIA_MOJO_MOJOM_MEDIADRM_SUPPORT_MOJOM_DATA_VIEW_H_