ContentChild.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_ContentChild_h
  6. #define mozilla_dom_ContentChild_h
  7. #include "mozilla/Attributes.h"
  8. #include "mozilla/dom/ContentBridgeParent.h"
  9. #include "mozilla/dom/nsIContentChild.h"
  10. #include "mozilla/dom/PBrowserOrId.h"
  11. #include "mozilla/dom/PContentChild.h"
  12. #include "nsAutoPtr.h"
  13. #include "nsHashKeys.h"
  14. #include "nsIObserver.h"
  15. #include "nsTHashtable.h"
  16. #include "nsRefPtrHashtable.h"
  17. #include "nsWeakPtr.h"
  18. #include "nsIWindowProvider.h"
  19. struct ChromePackage;
  20. class nsIObserver;
  21. struct SubstitutionMapping;
  22. struct OverrideMapping;
  23. class nsIDomainPolicy;
  24. namespace mozilla {
  25. class RemoteSpellcheckEngineChild;
  26. namespace ipc {
  27. class OptionalURIParams;
  28. class URIParams;
  29. }// namespace ipc
  30. namespace dom {
  31. class AlertObserver;
  32. class ConsoleListener;
  33. class PStorageChild;
  34. class ClonedMessageData;
  35. class TabChild;
  36. class GetFilesHelperChild;
  37. class ContentChild final : public PContentChild
  38. , public nsIWindowProvider
  39. , public nsIContentChild
  40. {
  41. typedef mozilla::dom::ClonedMessageData ClonedMessageData;
  42. typedef mozilla::ipc::FileDescriptor FileDescriptor;
  43. typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
  44. typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild;
  45. typedef mozilla::ipc::URIParams URIParams;
  46. public:
  47. NS_DECL_NSIWINDOWPROVIDER
  48. ContentChild();
  49. virtual ~ContentChild();
  50. NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
  51. NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override { return 1; }
  52. NS_IMETHOD_(MozExternalRefCountType) Release(void) override { return 1; }
  53. struct AppInfo
  54. {
  55. nsCString version;
  56. nsCString buildID;
  57. nsCString name;
  58. nsCString UAName;
  59. nsCString ID;
  60. nsCString vendor;
  61. };
  62. nsresult
  63. ProvideWindowCommon(TabChild* aTabOpener,
  64. mozIDOMWindowProxy* aOpener,
  65. bool aIframeMoz,
  66. uint32_t aChromeFlags,
  67. bool aCalledFromJS,
  68. bool aPositionSpecified,
  69. bool aSizeSpecified,
  70. nsIURI* aURI,
  71. const nsAString& aName,
  72. const nsACString& aFeatures,
  73. bool aForceNoOpener,
  74. bool* aWindowIsNew,
  75. mozIDOMWindowProxy** aReturn);
  76. bool Init(MessageLoop* aIOLoop,
  77. base::ProcessId aParentPid,
  78. IPC::Channel* aChannel);
  79. void InitProcessAttributes();
  80. void InitXPCOM();
  81. void InitGraphicsDeviceData();
  82. static ContentChild* GetSingleton()
  83. {
  84. return sSingleton;
  85. }
  86. const AppInfo& GetAppInfo()
  87. {
  88. return mAppInfo;
  89. }
  90. void SetProcessName(const nsAString& aName, bool aDontOverride = false);
  91. void GetProcessName(nsAString& aName) const;
  92. void GetProcessName(nsACString& aName) const;
  93. bool IsAlive() const;
  94. bool IsShuttingDown() const;
  95. static void AppendProcessId(nsACString& aName);
  96. ContentBridgeParent* GetLastBridge()
  97. {
  98. MOZ_ASSERT(mLastBridge);
  99. ContentBridgeParent* parent = mLastBridge;
  100. mLastBridge = nullptr;
  101. return parent;
  102. }
  103. RefPtr<ContentBridgeParent> mLastBridge;
  104. PPluginModuleParent *
  105. AllocPPluginModuleParent(mozilla::ipc::Transport* transport,
  106. base::ProcessId otherProcess) override;
  107. PContentBridgeParent*
  108. AllocPContentBridgeParent(mozilla::ipc::Transport* transport,
  109. base::ProcessId otherProcess) override;
  110. PContentBridgeChild*
  111. AllocPContentBridgeChild(mozilla::ipc::Transport* transport,
  112. base::ProcessId otherProcess) override;
  113. PGMPServiceChild*
  114. AllocPGMPServiceChild(mozilla::ipc::Transport* transport,
  115. base::ProcessId otherProcess) override;
  116. bool
  117. RecvGMPsChanged(nsTArray<GMPCapabilityData>&& capabilities) override;
  118. bool
  119. RecvInitRendering(
  120. Endpoint<PCompositorBridgeChild>&& aCompositor,
  121. Endpoint<PImageBridgeChild>&& aImageBridge,
  122. Endpoint<PVideoDecoderManagerChild>&& aVideoManager) override;
  123. bool
  124. RecvReinitRendering(
  125. Endpoint<PCompositorBridgeChild>&& aCompositor,
  126. Endpoint<PImageBridgeChild>&& aImageBridge,
  127. Endpoint<PVideoDecoderManagerChild>&& aVideoManager) override;
  128. PProcessHangMonitorChild*
  129. AllocPProcessHangMonitorChild(Transport* aTransport,
  130. ProcessId aOtherProcess) override;
  131. virtual bool RecvSetProcessSandbox(const MaybeFileDesc& aBroker) override;
  132. PBackgroundChild*
  133. AllocPBackgroundChild(Transport* aTransport, ProcessId aOtherProcess)
  134. override;
  135. virtual PBrowserChild* AllocPBrowserChild(const TabId& aTabId,
  136. const IPCTabContext& aContext,
  137. const uint32_t& aChromeFlags,
  138. const ContentParentId& aCpID,
  139. const bool& aIsForApp,
  140. const bool& aIsForBrowser) override;
  141. virtual bool DeallocPBrowserChild(PBrowserChild*) override;
  142. virtual PBlobChild*
  143. AllocPBlobChild(const BlobConstructorParams& aParams) override;
  144. virtual bool DeallocPBlobChild(PBlobChild* aActor) override;
  145. virtual PHalChild* AllocPHalChild() override;
  146. virtual bool DeallocPHalChild(PHalChild*) override;
  147. virtual PHeapSnapshotTempFileHelperChild*
  148. AllocPHeapSnapshotTempFileHelperChild() override;
  149. virtual bool
  150. DeallocPHeapSnapshotTempFileHelperChild(PHeapSnapshotTempFileHelperChild*) override;
  151. virtual PMemoryReportRequestChild*
  152. AllocPMemoryReportRequestChild(const uint32_t& aGeneration,
  153. const bool& aAnonymize,
  154. const bool& aMinimizeMemoryUsage,
  155. const MaybeFileDesc& aDMDFile) override;
  156. virtual bool
  157. DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor) override;
  158. virtual bool
  159. RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* aChild,
  160. const uint32_t& aGeneration,
  161. const bool& aAnonymize,
  162. const bool &aMinimizeMemoryUsage,
  163. const MaybeFileDesc &aDMDFile) override;
  164. virtual PCycleCollectWithLogsChild*
  165. AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces,
  166. const FileDescriptor& aGCLog,
  167. const FileDescriptor& aCCLog) override;
  168. virtual bool
  169. DeallocPCycleCollectWithLogsChild(PCycleCollectWithLogsChild* aActor) override;
  170. virtual bool
  171. RecvPCycleCollectWithLogsConstructor(PCycleCollectWithLogsChild* aChild,
  172. const bool& aDumpAllTraces,
  173. const FileDescriptor& aGCLog,
  174. const FileDescriptor& aCCLog) override;
  175. virtual PWebBrowserPersistDocumentChild*
  176. AllocPWebBrowserPersistDocumentChild(PBrowserChild* aBrowser,
  177. const uint64_t& aOuterWindowID) override;
  178. virtual bool
  179. RecvPWebBrowserPersistDocumentConstructor(PWebBrowserPersistDocumentChild *aActor,
  180. PBrowserChild *aBrowser,
  181. const uint64_t& aOuterWindowID) override;
  182. virtual bool
  183. DeallocPWebBrowserPersistDocumentChild(PWebBrowserPersistDocumentChild* aActor) override;
  184. virtual PTestShellChild* AllocPTestShellChild() override;
  185. virtual bool DeallocPTestShellChild(PTestShellChild*) override;
  186. virtual bool RecvPTestShellConstructor(PTestShellChild*) override;
  187. jsipc::CPOWManager* GetCPOWManager() override;
  188. virtual PNeckoChild* AllocPNeckoChild() override;
  189. virtual bool DeallocPNeckoChild(PNeckoChild*) override;
  190. virtual PPrintingChild* AllocPPrintingChild() override;
  191. virtual bool DeallocPPrintingChild(PPrintingChild*) override;
  192. virtual PSendStreamChild*
  193. SendPSendStreamConstructor(PSendStreamChild*) override;
  194. virtual PSendStreamChild* AllocPSendStreamChild() override;
  195. virtual bool DeallocPSendStreamChild(PSendStreamChild*) override;
  196. virtual PScreenManagerChild*
  197. AllocPScreenManagerChild(uint32_t* aNumberOfScreens,
  198. float* aSystemDefaultScale,
  199. bool* aSuccess) override;
  200. virtual bool DeallocPScreenManagerChild(PScreenManagerChild*) override;
  201. virtual PPSMContentDownloaderChild*
  202. AllocPPSMContentDownloaderChild( const uint32_t& aCertType) override;
  203. virtual bool
  204. DeallocPPSMContentDownloaderChild(PPSMContentDownloaderChild* aDownloader) override;
  205. virtual PExternalHelperAppChild*
  206. AllocPExternalHelperAppChild(const OptionalURIParams& uri,
  207. const nsCString& aMimeContentType,
  208. const nsCString& aContentDisposition,
  209. const uint32_t& aContentDispositionHint,
  210. const nsString& aContentDispositionFilename,
  211. const bool& aForceSave,
  212. const int64_t& aContentLength,
  213. const bool& aWasFileChannel,
  214. const OptionalURIParams& aReferrer,
  215. PBrowserChild* aBrowser) override;
  216. virtual bool
  217. DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService) override;
  218. virtual PHandlerServiceChild* AllocPHandlerServiceChild() override;
  219. virtual bool DeallocPHandlerServiceChild(PHandlerServiceChild*) override;
  220. virtual PMediaChild* AllocPMediaChild() override;
  221. virtual bool DeallocPMediaChild(PMediaChild* aActor) override;
  222. virtual PStorageChild* AllocPStorageChild() override;
  223. virtual bool DeallocPStorageChild(PStorageChild* aActor) override;
  224. virtual bool RecvNotifyEmptyHTTPCache() override;
  225. virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override;
  226. virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor) override;
  227. virtual bool RecvRegisterChrome(InfallibleTArray<ChromePackage>&& packages,
  228. InfallibleTArray<SubstitutionMapping>&& resources,
  229. InfallibleTArray<OverrideMapping>&& overrides,
  230. const nsCString& locale,
  231. const bool& reset) override;
  232. virtual bool RecvRegisterChromeItem(const ChromeRegistryItem& item) override;
  233. virtual bool RecvClearImageCache(const bool& privateLoader,
  234. const bool& chrome) override;
  235. virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
  236. virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override;
  237. virtual PRemoteSpellcheckEngineChild* AllocPRemoteSpellcheckEngineChild() override;
  238. virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override;
  239. virtual bool RecvSetOffline(const bool& offline) override;
  240. virtual bool RecvSetConnectivity(const bool& connectivity) override;
  241. virtual bool RecvSetCaptivePortalState(const int32_t& state) override;
  242. virtual bool RecvNotifyLayerAllocated(const dom::TabId& aTabId, const uint64_t& aLayersId) override;
  243. virtual bool RecvSpeakerManagerNotify() override;
  244. virtual bool RecvBidiKeyboardNotify(const bool& isLangRTL,
  245. const bool& haveBidiKeyboards) override;
  246. virtual bool RecvNotifyVisited(const URIParams& aURI) override;
  247. // auto remove when alertfinished is received.
  248. nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
  249. virtual bool RecvPreferenceUpdate(const PrefSetting& aPref) override;
  250. virtual bool RecvVarUpdate(const GfxVarUpdate& pref) override;
  251. virtual bool RecvDataStoragePut(const nsString& aFilename,
  252. const DataStorageItem& aItem) override;
  253. virtual bool RecvDataStorageRemove(const nsString& aFilename,
  254. const nsCString& aKey,
  255. const DataStorageType& aType) override;
  256. virtual bool RecvDataStorageClear(const nsString& aFilename) override;
  257. virtual bool RecvNotifyAlertsObserver(const nsCString& aType,
  258. const nsString& aData) override;
  259. virtual bool RecvLoadProcessScript(const nsString& aURL) override;
  260. virtual bool RecvAsyncMessage(const nsString& aMsg,
  261. InfallibleTArray<CpowEntry>&& aCpows,
  262. const IPC::Principal& aPrincipal,
  263. const ClonedMessageData& aData) override;
  264. virtual bool RecvGeolocationUpdate(const GeoPosition& somewhere) override;
  265. virtual bool RecvGeolocationError(const uint16_t& errorCode) override;
  266. virtual bool RecvUpdateDictionaryList(InfallibleTArray<nsString>&& aDictionaries) override;
  267. virtual bool RecvAddPermission(const IPC::Permission& permission) override;
  268. virtual bool RecvFlushMemory(const nsString& reason) override;
  269. virtual bool RecvActivateA11y(const uint32_t& aMsaaID) override;
  270. virtual bool RecvShutdownA11y() override;
  271. virtual bool RecvGarbageCollect() override;
  272. virtual bool RecvCycleCollect() override;
  273. virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID,
  274. const nsCString& name, const nsCString& UAName,
  275. const nsCString& ID, const nsCString& vendor) override;
  276. virtual bool RecvAppInit() override;
  277. virtual bool
  278. RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override;
  279. virtual bool
  280. RecvInitBlobURLs(nsTArray<BlobURLRegistrationData>&& aRegistations) override;
  281. virtual bool RecvLastPrivateDocShellDestroyed() override;
  282. virtual bool RecvVolumes(InfallibleTArray<VolumeInfo>&& aVolumes) override;
  283. virtual bool RecvFileSystemUpdate(const nsString& aFsName,
  284. const nsString& aVolumeName,
  285. const int32_t& aState,
  286. const int32_t& aMountGeneration,
  287. const bool& aIsMediaPresent,
  288. const bool& aIsSharing,
  289. const bool& aIsFormatting,
  290. const bool& aIsFake,
  291. const bool& aIsUnmounting,
  292. const bool& aIsRemovable,
  293. const bool& aIsHotSwappable) override;
  294. virtual bool RecvVolumeRemoved(const nsString& aFsName) override;
  295. virtual bool
  296. RecvNotifyProcessPriorityChanged(const hal::ProcessPriority& aPriority) override;
  297. virtual bool RecvMinimizeMemoryUsage() override;
  298. virtual bool RecvLoadAndRegisterSheet(const URIParams& aURI,
  299. const uint32_t& aType) override;
  300. virtual bool RecvUnregisterSheet(const URIParams& aURI,
  301. const uint32_t& aType) override;
  302. virtual bool RecvNotifyPhoneStateChange(const nsString& aState) override;
  303. void AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS);
  304. void RemoveIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS);
  305. virtual bool RecvNotifyIdleObserver(const uint64_t& aObserver,
  306. const nsCString& aTopic,
  307. const nsString& aData) override;
  308. virtual bool RecvAssociatePluginId(const uint32_t& aPluginId,
  309. const base::ProcessId& aProcessId) override;
  310. virtual bool RecvLoadPluginResult(const uint32_t& aPluginId,
  311. const bool& aResult) override;
  312. virtual bool RecvUpdateWindow(const uintptr_t& aChildId) override;
  313. virtual bool RecvDomainSetChanged(const uint32_t& aSetType,
  314. const uint32_t& aChangeType,
  315. const OptionalURIParams& aDomain) override;
  316. virtual bool RecvShutdown() override;
  317. virtual bool
  318. RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
  319. const uint32_t& aAction) override;
  320. virtual bool RecvEndDragSession(const bool& aDoneDrag,
  321. const bool& aUserCancelled,
  322. const mozilla::LayoutDeviceIntPoint& aEndDragPoint) override;
  323. virtual bool
  324. RecvPush(const nsCString& aScope,
  325. const IPC::Principal& aPrincipal,
  326. const nsString& aMessageId) override;
  327. virtual bool
  328. RecvPushWithData(const nsCString& aScope,
  329. const IPC::Principal& aPrincipal,
  330. const nsString& aMessageId,
  331. InfallibleTArray<uint8_t>&& aData) override;
  332. virtual bool
  333. RecvPushSubscriptionChange(const nsCString& aScope,
  334. const IPC::Principal& aPrincipal) override;
  335. virtual bool
  336. RecvPushError(const nsCString& aScope, const IPC::Principal& aPrincipal,
  337. const nsString& aMessage, const uint32_t& aFlags) override;
  338. virtual bool
  339. RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aScope,
  340. const IPC::Principal& aPrincipal) override;
  341. // Get the directory for IndexedDB files. We query the parent for this and
  342. // cache the value
  343. nsString &GetIndexedDBPath();
  344. ContentParentId GetID() const { return mID; }
  345. #if defined(XP_WIN) && defined(ACCESSIBILITY)
  346. uint32_t GetMsaaID() const { return mMsaaID; }
  347. #endif
  348. bool IsForApp() const { return mIsForApp; }
  349. bool IsForBrowser() const { return mIsForBrowser; }
  350. virtual PBlobChild*
  351. SendPBlobConstructor(PBlobChild* actor,
  352. const BlobConstructorParams& params) override;
  353. virtual PFileDescriptorSetChild*
  354. SendPFileDescriptorSetConstructor(const FileDescriptor&) override;
  355. virtual PFileDescriptorSetChild*
  356. AllocPFileDescriptorSetChild(const FileDescriptor&) override;
  357. virtual bool
  358. DeallocPFileDescriptorSetChild(PFileDescriptorSetChild*) override;
  359. virtual bool SendPBrowserConstructor(PBrowserChild* actor,
  360. const TabId& aTabId,
  361. const IPCTabContext& context,
  362. const uint32_t& chromeFlags,
  363. const ContentParentId& aCpID,
  364. const bool& aIsForApp,
  365. const bool& aIsForBrowser) override;
  366. virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
  367. const TabId& aTabId,
  368. const IPCTabContext& aContext,
  369. const uint32_t& aChromeFlags,
  370. const ContentParentId& aCpID,
  371. const bool& aIsForApp,
  372. const bool& aIsForBrowser) override;
  373. FORWARD_SHMEM_ALLOCATOR_TO(PContentChild)
  374. void GetAvailableDictionaries(InfallibleTArray<nsString>& aDictionaries);
  375. PBrowserOrId
  376. GetBrowserOrId(TabChild* aTabChild);
  377. virtual POfflineCacheUpdateChild*
  378. AllocPOfflineCacheUpdateChild(const URIParams& manifestURI,
  379. const URIParams& documentURI,
  380. const PrincipalInfo& aLoadingPrincipalInfo,
  381. const bool& stickDocument) override;
  382. virtual bool
  383. DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* offlineCacheUpdate) override;
  384. virtual PWebrtcGlobalChild* AllocPWebrtcGlobalChild() override;
  385. virtual bool DeallocPWebrtcGlobalChild(PWebrtcGlobalChild *aActor) override;
  386. virtual PContentPermissionRequestChild*
  387. AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
  388. const IPC::Principal& aPrincipal,
  389. const TabId& aTabId) override;
  390. virtual bool
  391. DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor) override;
  392. // Windows specific - set up audio session
  393. virtual bool
  394. RecvSetAudioSessionData(const nsID& aId,
  395. const nsString& aDisplayName,
  396. const nsString& aIconPath) override;
  397. // GetFiles for WebKit/Blink FileSystem API and Directory API must run on the
  398. // parent process.
  399. void
  400. CreateGetFilesRequest(const nsAString& aDirectoryPath, bool aRecursiveFlag,
  401. nsID& aUUID, GetFilesHelperChild* aChild);
  402. void
  403. DeleteGetFilesRequest(nsID& aUUID, GetFilesHelperChild* aChild);
  404. virtual bool
  405. RecvGetFilesResponse(const nsID& aUUID,
  406. const GetFilesResponseResult& aResult) override;
  407. virtual bool
  408. RecvBlobURLRegistration(const nsCString& aURI, PBlobChild* aBlobChild,
  409. const IPC::Principal& aPrincipal) override;
  410. virtual bool
  411. RecvBlobURLUnregistration(const nsCString& aURI) override;
  412. #if defined(XP_WIN) && defined(ACCESSIBILITY)
  413. bool
  414. SendGetA11yContentId();
  415. #endif // defined(XP_WIN) && defined(ACCESSIBILITY)
  416. /**
  417. * Helper function for protocols that use the GPU process when available.
  418. * Overrides FatalError to just be a warning when communicating with the
  419. * GPU process since we don't want to crash the content process when the
  420. * GPU process crashes.
  421. */
  422. static void FatalErrorIfNotUsingGPUProcess(const char* const aProtocolName,
  423. const char* const aErrorMsg,
  424. base::ProcessId aOtherPid);
  425. private:
  426. static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure);
  427. void StartForceKillTimer();
  428. virtual void ActorDestroy(ActorDestroyReason why) override;
  429. virtual void ProcessingError(Result aCode, const char* aReason) override;
  430. InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
  431. RefPtr<ConsoleListener> mConsoleListener;
  432. nsTHashtable<nsPtrHashKey<nsIObserver>> mIdleObservers;
  433. InfallibleTArray<nsString> mAvailableDictionaries;
  434. /**
  435. * An ID unique to the process containing our corresponding
  436. * content parent.
  437. *
  438. * We expect our content parent to set this ID immediately after opening a
  439. * channel to us.
  440. */
  441. ContentParentId mID;
  442. #if defined(XP_WIN) && defined(ACCESSIBILITY)
  443. /**
  444. * This is an a11y-specific unique id for the content process that is
  445. * generated by the chrome process.
  446. */
  447. uint32_t mMsaaID;
  448. #endif
  449. AppInfo mAppInfo;
  450. bool mIsForApp;
  451. bool mIsForBrowser;
  452. bool mCanOverrideProcessName;
  453. bool mIsAlive;
  454. nsString mProcessName;
  455. static ContentChild* sSingleton;
  456. nsCOMPtr<nsIDomainPolicy> mPolicy;
  457. nsCOMPtr<nsITimer> mForceKillTimer;
  458. // Hashtable to keep track of the pending GetFilesHelper objects.
  459. // This GetFilesHelperChild objects are removed when RecvGetFilesResponse is
  460. // received.
  461. nsRefPtrHashtable<nsIDHashKey, GetFilesHelperChild> mGetFilesPendingRequests;
  462. bool mShuttingDown;
  463. DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
  464. };
  465. uint64_t
  466. NextWindowID();
  467. } // namespace dom
  468. } // namespace mozilla
  469. #endif // mozilla_dom_ContentChild_h