| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // 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_PRESENTATION_PRESENTATION_MOJOM_SHARED_INTERNAL_H_ |
| #define THIRD_PARTY_BLINK_PUBLIC_MOJOM_PRESENTATION_PRESENTATION_MOJOM_SHARED_INTERNAL_H_ |
| |
| #include "mojo/public/cpp/bindings/lib/array_internal.h" |
| #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| #include "mojo/public/cpp/bindings/lib/map_data_internal.h" |
| #include "mojo/public/cpp/bindings/lib/buffer.h" |
| #include "url/mojom/url.mojom-shared-internal.h" |
| #include "mojo/public/cpp/bindings/lib/native_enum_data.h" |
| #include "mojo/public/interfaces/bindings/native_struct.mojom-shared-internal.h" |
| #include "base/component_export.h" |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| namespace mojo { |
| namespace internal { |
| class ValidationContext; |
| } |
| } |
| namespace blink { |
| namespace mojom { |
| namespace internal { |
| class PresentationInfo_Data; |
| class PresentationError_Data; |
| class PresentationConnectionResult_Data; |
| class PresentationConnectionMessage_Data; |
| |
| struct ScreenAvailability_Data { |
| public: |
| static bool constexpr kIsExtensible = false; |
| |
| static bool IsKnownValue(int32_t value) { |
| switch (value) { |
| case 0: |
| case 1: |
| case 2: |
| case 3: |
| case 4: |
| return true; |
| } |
| return false; |
| } |
| |
| static bool Validate(int32_t value, |
| mojo::internal::ValidationContext* validation_context) { |
| if (kIsExtensible || IsKnownValue(value)) |
| return true; |
| |
| ReportValidationError(validation_context, |
| mojo::internal::VALIDATION_ERROR_UNKNOWN_ENUM_VALUE); |
| return false; |
| } |
| }; |
| |
| struct PresentationConnectionState_Data { |
| public: |
| static bool constexpr kIsExtensible = false; |
| |
| static bool IsKnownValue(int32_t value) { |
| switch (value) { |
| case 0: |
| case 1: |
| case 2: |
| case 3: |
| return true; |
| } |
| return false; |
| } |
| |
| static bool Validate(int32_t value, |
| mojo::internal::ValidationContext* validation_context) { |
| if (kIsExtensible || IsKnownValue(value)) |
| return true; |
| |
| ReportValidationError(validation_context, |
| mojo::internal::VALIDATION_ERROR_UNKNOWN_ENUM_VALUE); |
| return false; |
| } |
| }; |
| |
| struct PresentationConnectionCloseReason_Data { |
| public: |
| static bool constexpr kIsExtensible = false; |
| |
| static bool IsKnownValue(int32_t value) { |
| switch (value) { |
| case 0: |
| case 1: |
| case 2: |
| return true; |
| } |
| return false; |
| } |
| |
| static bool Validate(int32_t value, |
| mojo::internal::ValidationContext* validation_context) { |
| if (kIsExtensible || IsKnownValue(value)) |
| return true; |
| |
| ReportValidationError(validation_context, |
| mojo::internal::VALIDATION_ERROR_UNKNOWN_ENUM_VALUE); |
| return false; |
| } |
| }; |
| |
| struct PresentationErrorType_Data { |
| public: |
| static bool constexpr kIsExtensible = false; |
| |
| static bool IsKnownValue(int32_t value) { |
| switch (value) { |
| case 0: |
| case 1: |
| case 2: |
| case 3: |
| case 4: |
| return true; |
| } |
| return false; |
| } |
| |
| static bool Validate(int32_t value, |
| mojo::internal::ValidationContext* validation_context) { |
| if (kIsExtensible || IsKnownValue(value)) |
| return true; |
| |
| ReportValidationError(validation_context, |
| mojo::internal::VALIDATION_ERROR_UNKNOWN_ENUM_VALUE); |
| return false; |
| } |
| }; |
| |
| #pragma pack(push, 1) |
| |
| |
| class COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) PresentationConnectionMessage_Data { |
| public: |
| // Used to identify Mojom Union Data Classes. |
| typedef void MojomUnionDataType; |
| |
| PresentationConnectionMessage_Data() {} |
| // Do nothing in the destructor since it won't be called when it is a |
| // non-inlined union. |
| ~PresentationConnectionMessage_Data() {} |
| |
| class BufferWriter { |
| public: |
| BufferWriter() = default; |
| |
| void Allocate(mojo::internal::Buffer* serialization_buffer) { |
| serialization_buffer_ = serialization_buffer; |
| index_ = serialization_buffer_->Allocate(sizeof(PresentationConnectionMessage_Data)); |
| new (data()) PresentationConnectionMessage_Data(); |
| } |
| |
| void AllocateInline(mojo::internal::Buffer* serialization_buffer, |
| void* ptr) { |
| const char* start = static_cast<const char*>( |
| serialization_buffer->data()); |
| const char* slot = static_cast<const char*>(ptr); |
| DCHECK_GT(slot, start); |
| serialization_buffer_ = serialization_buffer; |
| index_ = slot - start; |
| new (data()) PresentationConnectionMessage_Data(); |
| } |
| |
| bool is_null() const { return !serialization_buffer_; } |
| PresentationConnectionMessage_Data* data() { |
| DCHECK(!is_null()); |
| return serialization_buffer_->Get<PresentationConnectionMessage_Data>(index_); |
| } |
| PresentationConnectionMessage_Data* operator->() { return data(); } |
| |
| private: |
| mojo::internal::Buffer* serialization_buffer_ = nullptr; |
| size_t index_ = 0; |
| }; |
| |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context, |
| bool inlined); |
| |
| bool is_null() const { return size == 0; } |
| |
| void set_null() { |
| size = 0U; |
| tag = static_cast<PresentationConnectionMessage_Tag>(0); |
| data.unknown = 0U; |
| } |
| |
| enum class PresentationConnectionMessage_Tag : uint32_t { |
| |
| |
| // @generated_from: blink.mojom.PresentationConnectionMessage.message |
| MESSAGE, |
| |
| // @generated_from: blink.mojom.PresentationConnectionMessage.data |
| DATA, |
| }; |
| |
| // A note on layout: |
| // "Each non-static data member is allocated as if it were the sole member of |
| // a struct." - Section 9.5.2 ISO/IEC 14882:2011 (The C++ Spec) |
| union MOJO_ALIGNAS(8) Union_ { |
| Union_() : unknown(0) {} |
| mojo::internal::Pointer<mojo::internal::String_Data> f_message; |
| mojo::internal::Pointer<mojo::internal::Array_Data<uint8_t>> f_data; |
| uint64_t unknown; |
| }; |
| |
| uint32_t size; |
| PresentationConnectionMessage_Tag tag; |
| Union_ data; |
| }; |
| static_assert(sizeof(PresentationConnectionMessage_Data) == mojo::internal::kUnionDataSize, |
| "Bad sizeof(PresentationConnectionMessage_Data)"); |
| class COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) PresentationInfo_Data { |
| public: |
| class BufferWriter { |
| public: |
| BufferWriter() = default; |
| |
| void Allocate(mojo::internal::Buffer* serialization_buffer) { |
| serialization_buffer_ = serialization_buffer; |
| index_ = serialization_buffer_->Allocate(sizeof(PresentationInfo_Data)); |
| new (data()) PresentationInfo_Data(); |
| } |
| |
| bool is_null() const { return !serialization_buffer_; } |
| PresentationInfo_Data* data() { |
| DCHECK(!is_null()); |
| return serialization_buffer_->Get<PresentationInfo_Data>(index_); |
| } |
| PresentationInfo_Data* operator->() { return data(); } |
| |
| private: |
| mojo::internal::Buffer* serialization_buffer_ = nullptr; |
| size_t index_ = 0; |
| |
| DISALLOW_COPY_AND_ASSIGN(BufferWriter); |
| }; |
| |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| |
| mojo::internal::StructHeader header_; |
| mojo::internal::Pointer<::url::mojom::internal::Url_Data> url; |
| mojo::internal::Pointer<mojo::internal::String_Data> id; |
| |
| private: |
| PresentationInfo_Data(); |
| ~PresentationInfo_Data() = delete; |
| }; |
| static_assert(sizeof(PresentationInfo_Data) == 24, |
| "Bad sizeof(PresentationInfo_Data)"); |
| // Used by PresentationInfo::WrapAsMessage to lazily serialize the struct. |
| template <typename UserType, typename DataView> |
| struct PresentationInfo_UnserializedMessageContext |
| : public mojo::internal::UnserializedMessageContext { |
| public: |
| static const mojo::internal::UnserializedMessageContext::Tag kMessageTag; |
| |
| PresentationInfo_UnserializedMessageContext( |
| uint32_t message_name, |
| uint32_t message_flags, |
| UserType input) |
| : mojo::internal::UnserializedMessageContext(&kMessageTag, message_name, message_flags) |
| , user_data_(std::move(input)) {} |
| ~PresentationInfo_UnserializedMessageContext() override = default; |
| |
| UserType TakeData() { |
| return std::move(user_data_); |
| } |
| |
| private: |
| // mojo::internal::UnserializedMessageContext: |
| void Serialize(mojo::internal::SerializationContext* context, |
| mojo::internal::Buffer* buffer) override { |
| PresentationInfo_Data::BufferWriter writer; |
| mojo::internal::Serialize<DataView>(user_data_, buffer, &writer, context); |
| } |
| |
| UserType user_data_; |
| }; |
| |
| template <typename UserType, typename DataView> |
| const mojo::internal::UnserializedMessageContext::Tag |
| PresentationInfo_UnserializedMessageContext<UserType, DataView>::kMessageTag = {}; |
| class COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) PresentationError_Data { |
| public: |
| class BufferWriter { |
| public: |
| BufferWriter() = default; |
| |
| void Allocate(mojo::internal::Buffer* serialization_buffer) { |
| serialization_buffer_ = serialization_buffer; |
| index_ = serialization_buffer_->Allocate(sizeof(PresentationError_Data)); |
| new (data()) PresentationError_Data(); |
| } |
| |
| bool is_null() const { return !serialization_buffer_; } |
| PresentationError_Data* data() { |
| DCHECK(!is_null()); |
| return serialization_buffer_->Get<PresentationError_Data>(index_); |
| } |
| PresentationError_Data* operator->() { return data(); } |
| |
| private: |
| mojo::internal::Buffer* serialization_buffer_ = nullptr; |
| size_t index_ = 0; |
| |
| DISALLOW_COPY_AND_ASSIGN(BufferWriter); |
| }; |
| |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| |
| mojo::internal::StructHeader header_; |
| int32_t error_type; |
| uint8_t pad0_[4]; |
| mojo::internal::Pointer<mojo::internal::String_Data> message; |
| |
| private: |
| PresentationError_Data(); |
| ~PresentationError_Data() = delete; |
| }; |
| static_assert(sizeof(PresentationError_Data) == 24, |
| "Bad sizeof(PresentationError_Data)"); |
| // Used by PresentationError::WrapAsMessage to lazily serialize the struct. |
| template <typename UserType, typename DataView> |
| struct PresentationError_UnserializedMessageContext |
| : public mojo::internal::UnserializedMessageContext { |
| public: |
| static const mojo::internal::UnserializedMessageContext::Tag kMessageTag; |
| |
| PresentationError_UnserializedMessageContext( |
| uint32_t message_name, |
| uint32_t message_flags, |
| UserType input) |
| : mojo::internal::UnserializedMessageContext(&kMessageTag, message_name, message_flags) |
| , user_data_(std::move(input)) {} |
| ~PresentationError_UnserializedMessageContext() override = default; |
| |
| UserType TakeData() { |
| return std::move(user_data_); |
| } |
| |
| private: |
| // mojo::internal::UnserializedMessageContext: |
| void Serialize(mojo::internal::SerializationContext* context, |
| mojo::internal::Buffer* buffer) override { |
| PresentationError_Data::BufferWriter writer; |
| mojo::internal::Serialize<DataView>(user_data_, buffer, &writer, context); |
| } |
| |
| UserType user_data_; |
| }; |
| |
| template <typename UserType, typename DataView> |
| const mojo::internal::UnserializedMessageContext::Tag |
| PresentationError_UnserializedMessageContext<UserType, DataView>::kMessageTag = {}; |
| class COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) PresentationConnectionResult_Data { |
| public: |
| class BufferWriter { |
| public: |
| BufferWriter() = default; |
| |
| void Allocate(mojo::internal::Buffer* serialization_buffer) { |
| serialization_buffer_ = serialization_buffer; |
| index_ = serialization_buffer_->Allocate(sizeof(PresentationConnectionResult_Data)); |
| new (data()) PresentationConnectionResult_Data(); |
| } |
| |
| bool is_null() const { return !serialization_buffer_; } |
| PresentationConnectionResult_Data* data() { |
| DCHECK(!is_null()); |
| return serialization_buffer_->Get<PresentationConnectionResult_Data>(index_); |
| } |
| PresentationConnectionResult_Data* operator->() { return data(); } |
| |
| private: |
| mojo::internal::Buffer* serialization_buffer_ = nullptr; |
| size_t index_ = 0; |
| |
| DISALLOW_COPY_AND_ASSIGN(BufferWriter); |
| }; |
| |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| |
| mojo::internal::StructHeader header_; |
| mojo::internal::Pointer<internal::PresentationInfo_Data> presentation_info; |
| mojo::internal::Interface_Data connection_ptr; |
| mojo::internal::Handle_Data connection_request; |
| uint8_t padfinal_[4]; |
| |
| private: |
| PresentationConnectionResult_Data(); |
| ~PresentationConnectionResult_Data() = delete; |
| }; |
| static_assert(sizeof(PresentationConnectionResult_Data) == 32, |
| "Bad sizeof(PresentationConnectionResult_Data)"); |
| // Used by PresentationConnectionResult::WrapAsMessage to lazily serialize the struct. |
| template <typename UserType, typename DataView> |
| struct PresentationConnectionResult_UnserializedMessageContext |
| : public mojo::internal::UnserializedMessageContext { |
| public: |
| static const mojo::internal::UnserializedMessageContext::Tag kMessageTag; |
| |
| PresentationConnectionResult_UnserializedMessageContext( |
| uint32_t message_name, |
| uint32_t message_flags, |
| UserType input) |
| : mojo::internal::UnserializedMessageContext(&kMessageTag, message_name, message_flags) |
| , user_data_(std::move(input)) {} |
| ~PresentationConnectionResult_UnserializedMessageContext() override = default; |
| |
| UserType TakeData() { |
| return std::move(user_data_); |
| } |
| |
| private: |
| // mojo::internal::UnserializedMessageContext: |
| void Serialize(mojo::internal::SerializationContext* context, |
| mojo::internal::Buffer* buffer) override { |
| PresentationConnectionResult_Data::BufferWriter writer; |
| mojo::internal::Serialize<DataView>(user_data_, buffer, &writer, context); |
| } |
| |
| UserType user_data_; |
| }; |
| |
| template <typename UserType, typename DataView> |
| const mojo::internal::UnserializedMessageContext::Tag |
| PresentationConnectionResult_UnserializedMessageContext<UserType, DataView>::kMessageTag = {}; |
| |
| #pragma pack(pop) |
| |
| } // namespace internal |
| } // namespace mojom |
| } // namespace blink |
| |
| #endif // THIRD_PARTY_BLINK_PUBLIC_MOJOM_PRESENTATION_PRESENTATION_MOJOM_SHARED_INTERNAL_H_
|
|
|
| /* Metadata comment
|
| eyJtZXRhIjogW3siZW5kIjogNTYxNCwgImJlZ2luIjogNTYwNywgImVkZ2UiOiAiJS9reXRoZS9l
|
| ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw
|
| dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui
|
| OiAibW9qb20iLCAic2lnbmF0dXJlIjogImJsaW5rLm1vam9tLlByZXNlbnRhdGlvbkNvbm5lY3Rp
|
| b25NZXNzYWdlLm1lc3NhZ2UifX0sIHsiZW5kIjogNTY5NiwgImJlZ2luIjogNTY5MiwgImVkZ2Ui
|
| OiAiJS9reXRoZS9lZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZu
|
| YW1lIjogeyJjb3JwdXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMi
|
| LCAibGFuZ3VhZ2UiOiAibW9qb20iLCAic2lnbmF0dXJlIjogImJsaW5rLm1vam9tLlByZXNlbnRh
|
| dGlvbkNvbm5lY3Rpb25NZXNzYWdlLmRhdGEifX1dLCAidHlwZSI6ICJreXRoZTAifQ==
|
| */ |