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


#include "mozilla/extensions/PExtensionsChild.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteLazyInputStream.h"
#include "mozilla/URLClassifierIPCUtils.h"
#include "mozilla/dom/CSPMessageUtils.h"
#include "mozilla/dom/DocShellMessageUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.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/extensions/ExtensionsChild.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/NeckoMessageUtils.h"
#include "nsIPolicyContainer.h"
#include "nsIPrincipal.h"
#include "nsIReferrerInfo.h"
#include "nsIURI.h"
#include "nsIVariant.h"

#include "mozilla/dom/PContentChild.h"
#include "mozilla/dom/PInProcessChild.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 {
namespace extensions {


MOZ_IMPLICIT PExtensionsChild::PExtensionsChild() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PExtensionsChild);
}

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

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

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

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

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

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


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

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

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

auto PExtensionsChild::SendDocumentChange(
        const MaybeDiscardedBrowsingContext& bc,
        const FrameTransitionData& transitionData,
        nsIURI* location) -> bool
{
    UniquePtr<IPC::Message> msg__ = PExtensions::Msg_DocumentChange(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), bc);
    // Sentinel = 'bc'
    ((&(writer__)))->WriteSentinel(19464390);
    IPC::WriteParam((&(writer__)), transitionData);
    // Sentinel = 'transitionData'
    ((&(writer__)))->WriteSentinel(744490438);
    IPC::WriteParam((&(writer__)), location);
    // Sentinel = 'location'
    ((&(writer__)))->WriteSentinel(251593562);


    if (mozilla::ipc::LoggingEnabledFor("PExtensions", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PExtensionsChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PExtensions::Msg_DocumentChange", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PExtensionsChild::SendHistoryChange(
        const MaybeDiscardedBrowsingContext& bc,
        const FrameTransitionData& transitionData,
        nsIURI* location,
        const bool& isHistoryStateUpdated,
        const bool& isReferenceFragmentUpdated) -> bool
{
    UniquePtr<IPC::Message> msg__ = PExtensions::Msg_HistoryChange(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), bc);
    // Sentinel = 'bc'
    ((&(writer__)))->WriteSentinel(19464390);
    IPC::WriteParam((&(writer__)), transitionData);
    // Sentinel = 'transitionData'
    ((&(writer__)))->WriteSentinel(744490438);
    IPC::WriteParam((&(writer__)), location);
    // Sentinel = 'location'
    ((&(writer__)))->WriteSentinel(251593562);
    IPC::WriteParam((&(writer__)), isHistoryStateUpdated);
    // Sentinel = 'isHistoryStateUpdated'
    ((&(writer__)))->WriteSentinel(1594362007);
    IPC::WriteParam((&(writer__)), isReferenceFragmentUpdated);
    // Sentinel = 'isReferenceFragmentUpdated'
    ((&(writer__)))->WriteSentinel(2348812903);


    if (mozilla::ipc::LoggingEnabledFor("PExtensions", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PExtensionsChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PExtensions::Msg_HistoryChange", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PExtensionsChild::SendStateChange(
        const MaybeDiscardedBrowsingContext& bc,
        nsIURI* requestURI,
        const nsresult& status,
        const uint32_t& stateFlags) -> bool
{
    UniquePtr<IPC::Message> msg__ = PExtensions::Msg_StateChange(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), bc);
    // Sentinel = 'bc'
    ((&(writer__)))->WriteSentinel(19464390);
    IPC::WriteParam((&(writer__)), requestURI);
    // Sentinel = 'requestURI'
    ((&(writer__)))->WriteSentinel(387908602);
    IPC::WriteParam((&(writer__)), status);
    // Sentinel = 'status'
    ((&(writer__)))->WriteSentinel(154731173);
    IPC::WriteParam((&(writer__)), stateFlags);
    // Sentinel = 'stateFlags'
    ((&(writer__)))->WriteSentinel(379585551);


    if (mozilla::ipc::LoggingEnabledFor("PExtensions", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PExtensionsChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PExtensions::Msg_StateChange", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PExtensionsChild::SendCreatedNavigationTarget(
        const MaybeDiscardedBrowsingContext& bc,
        const MaybeDiscardedBrowsingContext& sourceBC,
        const nsACString& url) -> bool
{
    UniquePtr<IPC::Message> msg__ = PExtensions::Msg_CreatedNavigationTarget(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), bc);
    // Sentinel = 'bc'
    ((&(writer__)))->WriteSentinel(19464390);
    IPC::WriteParam((&(writer__)), sourceBC);
    // Sentinel = 'sourceBC'
    ((&(writer__)))->WriteSentinel(253952791);
    IPC::WriteParam((&(writer__)), url);
    // Sentinel = 'url'
    ((&(writer__)))->WriteSentinel(45220180);


    if (mozilla::ipc::LoggingEnabledFor("PExtensions", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PExtensionsChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PExtensions::Msg_CreatedNavigationTarget", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PExtensionsChild::SendDOMContentLoaded(
        const MaybeDiscardedBrowsingContext& bc,
        nsIURI* documentURI) -> bool
{
    UniquePtr<IPC::Message> msg__ = PExtensions::Msg_DOMContentLoaded(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), bc);
    // Sentinel = 'bc'
    ((&(writer__)))->WriteSentinel(19464390);
    IPC::WriteParam((&(writer__)), documentURI);
    // Sentinel = 'documentURI'
    ((&(writer__)))->WriteSentinel(453706832);


    if (mozilla::ipc::LoggingEnabledFor("PExtensions", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PExtensionsChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PExtensions::Msg_DOMContentLoaded", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

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

auto PExtensionsChild::OnMessageReceived(const Message& msg__) -> PExtensionsChild::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 PExtensions::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

auto PExtensionsChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PExtensionsChild::Result
{
    return MsgNotKnown;
}



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

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

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

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

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

} // namespace IPC
