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


#include "mozilla/PClipboardReadRequestParent.h"
#include "mozilla/AntiTrackingIPCUtils.h"
#include "mozilla/ClipboardReadRequestParent.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteLazyInputStream.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/URLClassifierIPCUtils.h"
#include "mozilla/dom/CSPMessageUtils.h"
#include "mozilla/dom/DocShellMessageUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/NavigationAPIIPCUtils.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/PolicyContainerMessageUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/SessionHistoryEntry.h"
#include "mozilla/dom/TabMessageUtils.h"
#include "mozilla/dom/notification/IPCUtils.h"
#include "mozilla/ipc/BigBuffer.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/ipc/IPCStreamUtils.h"
#include "mozilla/ipc/SerializedStructuredCloneBuffer.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/net/CacheInfoIPCTypes.h"
#include "mozilla/net/ClassOfService.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "nsDOMNavigationTiming.h"
#include "nsDocShellLoadState.h"
#include "nsHttp.h"
#include "nsHttpResponseHead.h"
#include "nsIPolicyContainer.h"
#include "nsIPrincipal.h"
#include "nsIPropertyBag2.h"
#include "nsIReferrerInfo.h"
#include "nsIURI.h"
#include "nsIVariant.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 PClipboardReadRequestParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

MOZ_IMPLICIT PClipboardReadRequestParent::PClipboardReadRequestParent() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PClipboardReadRequestParent);
}

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

auto PClipboardReadRequestParent::ActorAlloc() -> void
{
    AddRef();
}

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

auto PClipboardReadRequestParent::OtherPid() const -> ::base::ProcessId
{
    ::base::ProcessId pid =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
    MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
    return pid;
}

auto PClipboardReadRequestParent::OtherChildID() const -> ::GeckoChildID
{
    ::GeckoChildID childID =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
    MOZ_RELEASE_ASSERT(childID != -1);
    return childID;
}

auto PClipboardReadRequestParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
    return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}

auto PClipboardReadRequestParent::Manager() const -> PContentParent*
{
    return static_cast<PContentParent*>(IProtocol::Manager());
}

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

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

auto PClipboardReadRequestParent::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
    mAsyncCallbacks.RejectPendingResponses(aReason);
}

auto PClipboardReadRequestParent::Send__delete__(PClipboardReadRequestParent* actor) -> bool
{
    if (!actor || !actor->CanSend()) {
        NS_WARNING("Attempt to __delete__ missing or closed actor");
        return false;
    }
    UniquePtr<IPC::Message> msg__ = PClipboardReadRequest::Msg___delete__((actor)->Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            actor};


    if (mozilla::ipc::LoggingEnabledFor("PClipboardReadRequest", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PClipboardReadRequestParent",
            actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PClipboardReadRequest::Msg___delete__", OTHER);

    bool sendok__ = (actor)->ChannelSend(std::move(msg__));

    actor->ActorDisconnected(Deletion);
    return sendok__;
}

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

auto PClipboardReadRequestParent::OnMessageReceived(const Message& msg__) -> PClipboardReadRequestParent::Result
{
    switch (msg__.type()) {
    case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            return MsgProcessed;
        }
    case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            this->ActorDisconnected(ManagedEndpointDropped);
            return MsgProcessed;
        }
    case PClipboardReadRequest::Msg_GetData__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PClipboardReadRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PClipboardReadRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PClipboardReadRequest::Msg_GetData", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aFlavors = *maybe__aFlavors;
            // Sentinel = 'aFlavors'
            if ((!(((&(reader__)))->ReadSentinel(232981311)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PClipboardReadRequest::Reply_GetData(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            GetDataResolver resolver = [resolver__ = std::move(resolver__)](IPCTransferableDataOrError&& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), std::move(aParam));
                    // Sentinel = 'aTransferableData'
                    ((&(writer__)))->WriteSentinel(1019283125);

                    if (mozilla::ipc::LoggingEnabledFor("PClipboardReadRequest", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PClipboardReadRequestParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<ClipboardReadRequestParent*>(this))->RecvGetData(std::move(aFlavors), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PClipboardReadRequest::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    case PClipboardReadRequest::Msg___delete____ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PClipboardReadRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PClipboardReadRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PClipboardReadRequest::Msg___delete__", OTHER);

            mozilla::ipc::IPCResult __ok = (static_cast<ClipboardReadRequestParent*>(this))->Recv__delete__();
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }


            this->ActorDisconnected(Deletion);

            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

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

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aFlavors = *maybe__aFlavors;
            // Sentinel = 'aFlavors'
            if ((!(((&(reader__)))->ReadSentinel(232981311)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            IPCTransferableDataOrError aTransferableData{};
            mozilla::ipc::IPCResult __ok = (static_cast<ClipboardReadRequestParent*>(this))->RecvGetDataSync(std::move(aFlavors), (&(aTransferableData)));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            reply__ = PClipboardReadRequest::Reply_GetDataSync(id__);
            IPC::MessageWriter writer__{
                    (*(reply__)),
                    this};

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



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

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

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

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

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

} // namespace IPC
