//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/PClipboardContentAnalysisParent.h"
#include "mozilla/ClipboardContentAnalysisParent.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/ipc/BigBuffer.h"
#include "mozilla/widget/WidgetMessageUtils.h"
#include "nsIPrincipal.h"
#include "nsIReferrerInfo.h"

#include "mozilla/dom/PContentParent.h"

#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"

namespace mozilla {


auto PClipboardContentAnalysisParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PClipboardContentAnalysisParent::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

MOZ_IMPLICIT PClipboardContentAnalysisParent::PClipboardContentAnalysisParent() :
    mozilla::ipc::IToplevelProtocol("PClipboardContentAnalysisParent", kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PClipboardContentAnalysisParent);
}

PClipboardContentAnalysisParent::~PClipboardContentAnalysisParent()
{
    MOZ_COUNT_DTOR(PClipboardContentAnalysisParent);
}

auto PClipboardContentAnalysisParent::ActorAlloc() -> void
{
    MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PClipboardContentAnalysisParent'");
    AddRef();
}

auto PClipboardContentAnalysisParent::ActorDealloc() -> void
{
    Release();
}

auto PClipboardContentAnalysisParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
    return {};
}

auto PClipboardContentAnalysisParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
    switch (aProtocol) {
    default:
        return nullptr;
    }
}

auto PClipboardContentAnalysisParent::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    FatalError("unreached");
    return;
}

auto PClipboardContentAnalysisParent::OnMessageReceived(const Message& msg__) -> PClipboardContentAnalysisParent::Result
{
    switch (msg__.type()) {
    default:
        return MsgNotKnown;
    case SHMEM_CREATED_MESSAGE_TYPE:
        {
            if (!ShmemCreated(msg__)) {
                return MsgPayloadError;
            }
            return MsgProcessed;
        }
    case SHMEM_DESTROYED_MESSAGE_TYPE:
        {
            if (!ShmemDestroyed(msg__)) {
                return MsgPayloadError;
            }
            return MsgProcessed;
        }
    }
}

auto PClipboardContentAnalysisParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PClipboardContentAnalysisParent::Result
{
    switch (msg__.type()) {
    case PClipboardContentAnalysis::Msg_GetClipboard__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PClipboardContentAnalysis", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PClipboardContentAnalysisParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PClipboardContentAnalysis::Msg_GetClipboard", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aTypes = IPC::ReadParam<nsTArray<nsCString>>((&(reader__)));
            if (!maybe__aTypes) {
                FatalError("Error deserializing 'nsCString[]'");
                return MsgValueError;

            }
            auto& aTypes = *maybe__aTypes;
            // Sentinel = 'aTypes'
            if ((!(((&(reader__)))->ReadSentinel(140575351)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
                return MsgValueError;
            }
            auto maybe__aWhichClipboard = IPC::ReadParam<ClipboardType>((&(reader__)));
            if (!maybe__aWhichClipboard) {
                FatalError("Error deserializing 'ClipboardType'");
                return MsgValueError;

            }
            auto& aWhichClipboard = *maybe__aWhichClipboard;
            // Sentinel = 'aWhichClipboard'
            if ((!(((&(reader__)))->ReadSentinel(776996325)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ClipboardType'");
                return MsgValueError;
            }
            auto maybe__aRequestingWindowContextId = IPC::ReadParam<uint64_t>((&(reader__)));
            if (!maybe__aRequestingWindowContextId) {
                FatalError("Error deserializing 'uint64_t'");
                return MsgValueError;

            }
            auto& aRequestingWindowContextId = *maybe__aRequestingWindowContextId;
            // Sentinel = 'aRequestingWindowContextId'
            if ((!(((&(reader__)))->ReadSentinel(2397309587)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL;
            IPCTransferableDataOrError transferableDataOrError{};
            mozilla::ipc::IPCResult __ok = (static_cast<ClipboardContentAnalysisParent*>(this))->RecvGetClipboard(std::move(aTypes), std::move(aWhichClipboard), std::move(aRequestingWindowContextId), (&(transferableDataOrError)));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            reply__ = PClipboardContentAnalysis::Reply_GetClipboard(id__);
            IPC::MessageWriter writer__{
                    (*(reply__)),
                    this};

            IPC::WriteParam((&(writer__)), std::move(transferableDataOrError));
            // Sentinel = 'transferableDataOrError'
            ((&(writer__)))->WriteSentinel(1880557887);
            if (mozilla::ipc::LoggingEnabledFor("PClipboardContentAnalysis", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PClipboardContentAnalysisParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Sending reply ",
                    reply__->type(),
                    mozilla::ipc::MessageDirection::eSending);
            }
            return MsgProcessed;
        }
    case PClipboardContentAnalysis::Msg_GetAllClipboardDataSync__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PClipboardContentAnalysis", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PClipboardContentAnalysisParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PClipboardContentAnalysis::Msg_GetAllClipboardDataSync", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aTypes = IPC::ReadParam<nsTArray<nsCString>>((&(reader__)));
            if (!maybe__aTypes) {
                FatalError("Error deserializing 'nsCString[]'");
                return MsgValueError;

            }
            auto& aTypes = *maybe__aTypes;
            // Sentinel = 'aTypes'
            if ((!(((&(reader__)))->ReadSentinel(140575351)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
                return MsgValueError;
            }
            auto maybe__aWhichClipboard = IPC::ReadParam<ClipboardType>((&(reader__)));
            if (!maybe__aWhichClipboard) {
                FatalError("Error deserializing 'ClipboardType'");
                return MsgValueError;

            }
            auto& aWhichClipboard = *maybe__aWhichClipboard;
            // Sentinel = 'aWhichClipboard'
            if ((!(((&(reader__)))->ReadSentinel(776996325)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ClipboardType'");
                return MsgValueError;
            }
            auto maybe__aRequestingWindowContextId = IPC::ReadParam<uint64_t>((&(reader__)));
            if (!maybe__aRequestingWindowContextId) {
                FatalError("Error deserializing 'uint64_t'");
                return MsgValueError;

            }
            auto& aRequestingWindowContextId = *maybe__aRequestingWindowContextId;
            // Sentinel = 'aRequestingWindowContextId'
            if ((!(((&(reader__)))->ReadSentinel(2397309587)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL;
            IPCTransferableDataOrError transferableDataOrError{};
            mozilla::ipc::IPCResult __ok = (static_cast<ClipboardContentAnalysisParent*>(this))->RecvGetAllClipboardDataSync(std::move(aTypes), std::move(aWhichClipboard), std::move(aRequestingWindowContextId), (&(transferableDataOrError)));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            reply__ = PClipboardContentAnalysis::Reply_GetAllClipboardDataSync(id__);
            IPC::MessageWriter writer__{
                    (*(reply__)),
                    this};

            IPC::WriteParam((&(writer__)), std::move(transferableDataOrError));
            // Sentinel = 'transferableDataOrError'
            ((&(writer__)))->WriteSentinel(1880557887);
            if (mozilla::ipc::LoggingEnabledFor("PClipboardContentAnalysis", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PClipboardContentAnalysisParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Sending reply ",
                    reply__->type(),
                    mozilla::ipc::MessageDirection::eSending);
            }
            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}



} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::PClipboardContentAnalysisParent*>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
    // Sentinel = 'PClipboardContentAnalysis'
    (aWriter)->WriteSentinel(2119043584);
}

auto ParamTraits<::mozilla::PClipboardContentAnalysisParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
    if (!maybe__actor) {
        aReader->FatalError("Error deserializing managed PClipboardContentAnalysis actor");
        return {};

    }
    auto& actor = *maybe__actor;
    // Sentinel = 'PClipboardContentAnalysis'
    if ((!((aReader)->ReadSentinel(2119043584)))) {
        mozilla::ipc::SentinelReadError("Error deserializing managed PClipboardContentAnalysis actor");
        return {};
    }

    if (actor && actor->GetProtocolId() != PClipboardContentAnalysisMsgStart) {
        aReader->FatalError("Unexpected actor type (expected PClipboardContentAnalysis)");

        return {};
    }
    return static_cast<::mozilla::PClipboardContentAnalysisParent*>(actor);
}

} // namespace IPC
