2014-06-11 13:44:03 +08:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 15:32:37 -04:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-06-11 13:44:03 +08:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_nsIContentParent_h
|
|
|
|
#define mozilla_dom_nsIContentParent_h
|
|
|
|
|
2015-03-19 00:46:40 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-24 02:28:00 +02:00
|
|
|
#include "mozilla/dom/ipc/IdType.h"
|
2016-06-16 00:57:46 +08:00
|
|
|
#include "mozilla/ipc/ProtocolUtils.h"
|
2017-03-14 12:29:43 +01:00
|
|
|
#include "mozilla/ipc/PChildToParentStreamParent.h"
|
|
|
|
#include "mozilla/ipc/PParentToChildStreamParent.h"
|
2014-10-24 02:28:00 +02:00
|
|
|
|
2014-06-11 13:44:03 +08:00
|
|
|
#include "nsFrameMessageManager.h"
|
|
|
|
#include "nsISupports.h"
|
2014-10-06 15:45:42 -07:00
|
|
|
#include "mozilla/dom/CPOWManagerGetter.h"
|
2014-06-11 13:44:03 +08:00
|
|
|
|
|
|
|
#define NS_ICONTENTPARENT_IID \
|
|
|
|
{ 0xeeec9ebf, 0x8ecf, 0x4e38, \
|
|
|
|
{ 0x81, 0xda, 0xb7, 0x34, 0x13, 0x7e, 0xac, 0xf3 } }
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
class Principal;
|
|
|
|
} // namespace IPC
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace jsipc {
|
|
|
|
class PJavaScriptParent;
|
|
|
|
class CpowEntry;
|
|
|
|
} // namespace jsipc
|
|
|
|
|
2016-09-21 12:27:26 +02:00
|
|
|
namespace ipc {
|
|
|
|
class PFileDescriptorSetParent;
|
2017-03-14 12:28:58 +01:00
|
|
|
class PChildToParentStreamParent;
|
2017-03-14 12:29:43 +01:00
|
|
|
class PParentToChildStreamParent;
|
2016-09-21 12:27:26 +02:00
|
|
|
}
|
|
|
|
|
2014-06-11 13:44:03 +08:00
|
|
|
namespace dom {
|
2014-09-26 16:21:57 -07:00
|
|
|
|
2015-05-12 13:09:51 +01:00
|
|
|
class Blob;
|
2014-09-26 16:21:57 -07:00
|
|
|
class BlobConstructorParams;
|
2015-05-12 13:11:03 +01:00
|
|
|
class BlobImpl;
|
2014-09-26 16:21:57 -07:00
|
|
|
class BlobParent;
|
2014-09-17 19:36:01 -04:00
|
|
|
class ContentParent;
|
2015-08-31 01:53:00 -04:00
|
|
|
class ContentBridgeParent;
|
2014-09-26 16:21:57 -07:00
|
|
|
class IPCTabContext;
|
|
|
|
class PBlobParent;
|
|
|
|
class PBrowserParent;
|
2014-06-11 13:44:03 +08:00
|
|
|
|
|
|
|
class nsIContentParent : public nsISupports
|
|
|
|
, public mozilla::dom::ipc::MessageManagerCallback
|
2014-10-06 15:45:42 -07:00
|
|
|
, public CPOWManagerGetter
|
2016-06-16 00:57:46 +08:00
|
|
|
, public mozilla::ipc::IShmemAllocator
|
2014-06-11 13:44:03 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTPARENT_IID)
|
|
|
|
|
|
|
|
nsIContentParent();
|
2014-09-26 16:21:57 -07:00
|
|
|
|
2015-05-12 13:09:51 +01:00
|
|
|
BlobParent* GetOrCreateActorForBlob(Blob* aBlob);
|
2015-05-12 13:11:03 +01:00
|
|
|
BlobParent* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
|
2014-06-11 13:44:03 +08:00
|
|
|
|
2016-01-05 09:59:30 +00:00
|
|
|
virtual ContentParentId ChildID() const = 0;
|
|
|
|
virtual bool IsForBrowser() const = 0;
|
|
|
|
|
2016-04-27 14:16:50 +10:00
|
|
|
MOZ_MUST_USE virtual PBlobParent*
|
2016-01-05 09:59:30 +00:00
|
|
|
SendPBlobConstructor(PBlobParent* aActor,
|
|
|
|
const BlobConstructorParams& aParams) = 0;
|
|
|
|
|
2016-04-27 14:16:50 +10:00
|
|
|
MOZ_MUST_USE virtual PBrowserParent*
|
2016-01-05 09:59:30 +00:00
|
|
|
SendPBrowserConstructor(PBrowserParent* actor,
|
|
|
|
const TabId& aTabId,
|
|
|
|
const IPCTabContext& context,
|
|
|
|
const uint32_t& chromeFlags,
|
|
|
|
const ContentParentId& aCpId,
|
|
|
|
const bool& aIsForBrowser) = 0;
|
|
|
|
|
2017-03-14 12:29:43 +01:00
|
|
|
virtual mozilla::ipc::PFileDescriptorSetParent*
|
|
|
|
SendPFileDescriptorSetConstructor(const mozilla::ipc::FileDescriptor&) = 0;
|
|
|
|
|
2016-01-05 09:59:30 +00:00
|
|
|
virtual bool IsContentParent() const { return false; }
|
|
|
|
|
2014-06-11 13:44:03 +08:00
|
|
|
ContentParent* AsContentParent();
|
2016-01-05 09:59:30 +00:00
|
|
|
|
|
|
|
virtual bool IsContentBridgeParent() const { return false; }
|
|
|
|
|
2015-08-31 01:53:00 -04:00
|
|
|
ContentBridgeParent* AsContentBridgeParent();
|
2014-06-11 13:44:03 +08:00
|
|
|
|
2016-08-22 10:28:04 +02:00
|
|
|
nsFrameMessageManager* GetMessageManager() const { return mMessageManager; }
|
|
|
|
|
2017-03-15 02:00:00 +01:00
|
|
|
virtual bool SendActivate(PBrowserParent* aTab) = 0;
|
|
|
|
|
|
|
|
virtual bool SendDeactivate(PBrowserParent* aTab) = 0;
|
|
|
|
|
|
|
|
virtual bool SendParentActivated(PBrowserParent* aTab,
|
|
|
|
const bool& aActivated) = 0;
|
|
|
|
|
2016-08-01 12:26:48 +02:00
|
|
|
virtual int32_t Pid() const = 0;
|
|
|
|
|
2017-03-14 12:29:43 +01:00
|
|
|
virtual mozilla::ipc::PParentToChildStreamParent*
|
|
|
|
SendPParentToChildStreamConstructor(mozilla::ipc::PParentToChildStreamParent*) = 0;
|
|
|
|
|
2014-06-11 13:44:13 +08:00
|
|
|
protected: // methods
|
|
|
|
bool CanOpenBrowser(const IPCTabContext& aContext);
|
|
|
|
|
2014-06-11 13:44:03 +08:00
|
|
|
protected: // IPDL methods
|
|
|
|
virtual mozilla::jsipc::PJavaScriptParent* AllocPJavaScriptParent();
|
|
|
|
virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*);
|
|
|
|
|
2014-10-29 19:11:00 +01:00
|
|
|
virtual PBrowserParent* AllocPBrowserParent(const TabId& aTabId,
|
|
|
|
const IPCTabContext& aContext,
|
2014-06-11 13:44:03 +08:00
|
|
|
const uint32_t& aChromeFlags,
|
2014-10-24 02:28:00 +02:00
|
|
|
const ContentParentId& aCpId,
|
2014-06-11 13:44:03 +08:00
|
|
|
const bool& aIsForBrowser);
|
|
|
|
virtual bool DeallocPBrowserParent(PBrowserParent* frame);
|
|
|
|
|
|
|
|
virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams);
|
2014-09-26 16:21:57 -07:00
|
|
|
|
|
|
|
virtual bool DeallocPBlobParent(PBlobParent* aActor);
|
2014-06-11 13:44:03 +08:00
|
|
|
|
2016-09-21 12:27:26 +02:00
|
|
|
virtual mozilla::ipc::PFileDescriptorSetParent*
|
|
|
|
AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor& aFD);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPFileDescriptorSetParent(mozilla::ipc::PFileDescriptorSetParent* aActor);
|
|
|
|
|
2017-03-14 12:28:58 +01:00
|
|
|
virtual mozilla::ipc::PChildToParentStreamParent* AllocPChildToParentStreamParent();
|
2016-09-21 12:27:26 +02:00
|
|
|
|
2017-03-14 12:28:58 +01:00
|
|
|
virtual bool
|
|
|
|
DeallocPChildToParentStreamParent(mozilla::ipc::PChildToParentStreamParent* aActor);
|
2016-09-21 12:27:26 +02:00
|
|
|
|
2017-03-14 12:29:43 +01:00
|
|
|
virtual mozilla::ipc::PParentToChildStreamParent* AllocPParentToChildStreamParent();
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPParentToChildStreamParent(mozilla::ipc::PParentToChildStreamParent* aActor);
|
|
|
|
|
2016-11-15 04:26:00 +01:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSyncMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData,
|
|
|
|
InfallibleTArray<jsipc::CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
nsTArray<ipc::StructuredCloneData>* aRetvals);
|
|
|
|
virtual mozilla::ipc::IPCResult RecvRpcMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData,
|
|
|
|
InfallibleTArray<jsipc::CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
nsTArray<ipc::StructuredCloneData>* aRetvals);
|
|
|
|
virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg,
|
|
|
|
InfallibleTArray<jsipc::CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
const ClonedMessageData& aData);
|
2014-06-11 13:44:03 +08:00
|
|
|
|
|
|
|
protected: // members
|
2015-10-18 01:24:48 -04:00
|
|
|
RefPtr<nsFrameMessageManager> mMessageManager;
|
2014-06-11 13:44:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentParent, NS_ICONTENTPARENT_IID)
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_nsIContentParent_h */
|