Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_nsIContentParent_h
8 : #define mozilla_dom_nsIContentParent_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "mozilla/dom/ipc/IdType.h"
12 : #include "mozilla/ipc/ProtocolUtils.h"
13 : #include "mozilla/ipc/PChildToParentStreamParent.h"
14 : #include "mozilla/ipc/PParentToChildStreamParent.h"
15 :
16 : #include "nsFrameMessageManager.h"
17 : #include "nsISupports.h"
18 : #include "mozilla/dom/CPOWManagerGetter.h"
19 :
20 : #define NS_ICONTENTPARENT_IID \
21 : { 0xeeec9ebf, 0x8ecf, 0x4e38, \
22 : { 0x81, 0xda, 0xb7, 0x34, 0x13, 0x7e, 0xac, 0xf3 } }
23 :
24 : namespace IPC {
25 : class Principal;
26 : } // namespace IPC
27 :
28 : namespace mozilla {
29 :
30 : namespace jsipc {
31 : class PJavaScriptParent;
32 : class CpowEntry;
33 : } // namespace jsipc
34 :
35 : namespace ipc {
36 : class PFileDescriptorSetParent;
37 : class PChildToParentStreamParent;
38 : class PParentToChildStreamParent;
39 : class PIPCBlobInputStreamParent;
40 : }
41 :
42 : namespace dom {
43 :
44 : class Blob;
45 : class BlobConstructorParams;
46 : class BlobImpl;
47 : class ContentParent;
48 : class ContentBridgeParent;
49 : class IPCTabContext;
50 : class PBrowserParent;
51 :
52 0 : class nsIContentParent : public nsISupports
53 : , public mozilla::dom::ipc::MessageManagerCallback
54 : , public CPOWManagerGetter
55 : , public mozilla::ipc::IShmemAllocator
56 : {
57 : public:
58 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTPARENT_IID)
59 :
60 : nsIContentParent();
61 :
62 : virtual ContentParentId ChildID() const = 0;
63 : virtual bool IsForBrowser() const = 0;
64 : virtual bool IsForJSPlugin() const = 0;
65 :
66 : virtual mozilla::ipc::PIPCBlobInputStreamParent*
67 : SendPIPCBlobInputStreamConstructor(mozilla::ipc::PIPCBlobInputStreamParent* aActor,
68 : const nsID& aID,
69 : const uint64_t& aSize) = 0;
70 :
71 : MOZ_MUST_USE virtual PBrowserParent*
72 : SendPBrowserConstructor(PBrowserParent* actor,
73 : const TabId& aTabId,
74 : const TabId& aSameTabGroupAs,
75 : const IPCTabContext& context,
76 : const uint32_t& chromeFlags,
77 : const ContentParentId& aCpId,
78 : const bool& aIsForBrowser) = 0;
79 :
80 : virtual mozilla::ipc::PFileDescriptorSetParent*
81 : SendPFileDescriptorSetConstructor(const mozilla::ipc::FileDescriptor&) = 0;
82 :
83 0 : virtual bool IsContentParent() const { return false; }
84 :
85 : ContentParent* AsContentParent();
86 :
87 0 : virtual bool IsContentBridgeParent() const { return false; }
88 :
89 : ContentBridgeParent* AsContentBridgeParent();
90 :
91 0 : nsFrameMessageManager* GetMessageManager() const { return mMessageManager; }
92 :
93 : virtual bool SendActivate(PBrowserParent* aTab) = 0;
94 :
95 : virtual bool SendDeactivate(PBrowserParent* aTab) = 0;
96 :
97 : virtual bool SendParentActivated(PBrowserParent* aTab,
98 : const bool& aActivated) = 0;
99 :
100 : virtual int32_t Pid() const = 0;
101 :
102 : virtual mozilla::ipc::PParentToChildStreamParent*
103 : SendPParentToChildStreamConstructor(mozilla::ipc::PParentToChildStreamParent*) = 0;
104 :
105 : protected: // methods
106 : bool CanOpenBrowser(const IPCTabContext& aContext);
107 :
108 : protected: // IPDL methods
109 : virtual mozilla::jsipc::PJavaScriptParent* AllocPJavaScriptParent();
110 : virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*);
111 :
112 : virtual PBrowserParent* AllocPBrowserParent(const TabId& aTabId,
113 : const TabId& aSameTabGroupsAs,
114 : const IPCTabContext& aContext,
115 : const uint32_t& aChromeFlags,
116 : const ContentParentId& aCpId,
117 : const bool& aIsForBrowser);
118 : virtual bool DeallocPBrowserParent(PBrowserParent* frame);
119 :
120 : virtual mozilla::ipc::PIPCBlobInputStreamParent*
121 : AllocPIPCBlobInputStreamParent(const nsID& aID, const uint64_t& aSize);
122 :
123 : virtual bool
124 : DeallocPIPCBlobInputStreamParent(mozilla::ipc::PIPCBlobInputStreamParent* aActor);
125 :
126 : virtual mozilla::ipc::PFileDescriptorSetParent*
127 : AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor& aFD);
128 :
129 : virtual bool
130 : DeallocPFileDescriptorSetParent(mozilla::ipc::PFileDescriptorSetParent* aActor);
131 :
132 : virtual mozilla::ipc::PChildToParentStreamParent* AllocPChildToParentStreamParent();
133 :
134 : virtual bool
135 : DeallocPChildToParentStreamParent(mozilla::ipc::PChildToParentStreamParent* aActor);
136 :
137 : virtual mozilla::ipc::PParentToChildStreamParent* AllocPParentToChildStreamParent();
138 :
139 : virtual bool
140 : DeallocPParentToChildStreamParent(mozilla::ipc::PParentToChildStreamParent* aActor);
141 :
142 : virtual mozilla::ipc::IPCResult RecvSyncMessage(const nsString& aMsg,
143 : const ClonedMessageData& aData,
144 : InfallibleTArray<jsipc::CpowEntry>&& aCpows,
145 : const IPC::Principal& aPrincipal,
146 : nsTArray<ipc::StructuredCloneData>* aRetvals);
147 : virtual mozilla::ipc::IPCResult RecvRpcMessage(const nsString& aMsg,
148 : const ClonedMessageData& aData,
149 : InfallibleTArray<jsipc::CpowEntry>&& aCpows,
150 : const IPC::Principal& aPrincipal,
151 : nsTArray<ipc::StructuredCloneData>* aRetvals);
152 : virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg,
153 : InfallibleTArray<jsipc::CpowEntry>&& aCpows,
154 : const IPC::Principal& aPrincipal,
155 : const ClonedMessageData& aData);
156 :
157 : protected: // members
158 : RefPtr<nsFrameMessageManager> mMessageManager;
159 : };
160 :
161 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentParent, NS_ICONTENTPARENT_IID)
162 :
163 : } // namespace dom
164 : } // namespace mozilla
165 :
166 : #endif /* mozilla_dom_nsIContentParent_h */
|