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 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_BrowserBridgeParent_h 8 #define mozilla_dom_BrowserBridgeParent_h 9 10 #include "mozilla/dom/PBrowserBridgeParent.h" 11 #include "mozilla/dom/ipc/IdType.h" 12 #include "mozilla/dom/WindowGlobalTypes.h" 13 14 namespace mozilla { 15 16 namespace a11y { 17 class DocAccessibleParent; 18 } 19 20 namespace embedding { 21 class PrintData; 22 } 23 24 namespace dom { 25 26 class BrowserParent; 27 28 /** 29 * BrowserBridgeParent implements the parent actor part of the PBrowserBridge 30 * protocol. See PBrowserBridge for more information. 31 */ 32 class BrowserBridgeParent : public PBrowserBridgeParent { 33 public: 34 NS_INLINE_DECL_REFCOUNTING(BrowserBridgeParent, final); 35 36 BrowserBridgeParent(); 37 38 nsresult InitWithProcess(BrowserParent* aParentBrowser, 39 ContentParent* aContentParent, 40 const WindowGlobalInit& aWindowInit, 41 uint32_t aChromeFlags, TabId aTabId); 42 GetBrowserParent()43 BrowserParent* GetBrowserParent() { return mBrowserParent; } 44 45 CanonicalBrowsingContext* GetBrowsingContext(); 46 47 // Get our manager actor. 48 BrowserParent* Manager(); 49 50 #if defined(ACCESSIBILITY) 51 /** 52 * Get the DocAccessibleParent which contains this iframe. 53 */ 54 a11y::DocAccessibleParent* GetEmbedderAccessibleDoc(); 55 56 /** 57 * Get the unique id of the OuterDocAccessible associated with this iframe. 58 * This is the id of the RemoteAccessible inside the document returned by 59 * GetEmbedderAccessibleDoc. 60 */ GetEmbedderAccessibleId()61 uint64_t GetEmbedderAccessibleId() { return mEmbedderAccessibleID; } 62 63 /** 64 * Get the DocAccessibleParent for the embedded document. 65 */ 66 a11y::DocAccessibleParent* GetDocAccessibleParent(); 67 #endif // defined(ACCESSIBILITY) 68 69 // Tear down this BrowserBridgeParent. 70 void Destroy(); 71 72 protected: 73 friend class PBrowserBridgeParent; 74 75 mozilla::ipc::IPCResult RecvShow(const OwnerShowInfo&); 76 mozilla::ipc::IPCResult RecvScrollbarPreferenceChanged(ScrollbarPreference); 77 mozilla::ipc::IPCResult RecvLoadURL(nsDocShellLoadState* aLoadState); 78 mozilla::ipc::IPCResult RecvResumeLoad(uint64_t aPendingSwitchID); 79 mozilla::ipc::IPCResult RecvUpdateDimensions(const nsIntRect& aRect, 80 const ScreenIntSize& aSize); 81 mozilla::ipc::IPCResult RecvUpdateEffects(const EffectsInfo& aEffects); 82 mozilla::ipc::IPCResult RecvUpdateRemotePrintSettings( 83 const embedding::PrintData&); 84 mozilla::ipc::IPCResult RecvRenderLayers(const bool& aEnabled, 85 const LayersObserverEpoch& aEpoch); 86 87 mozilla::ipc::IPCResult RecvNavigateByKey(const bool& aForward, 88 const bool& aForDocumentNavigation); 89 mozilla::ipc::IPCResult RecvBeginDestroy(); 90 91 mozilla::ipc::IPCResult RecvDispatchSynthesizedMouseEvent( 92 const WidgetMouseEvent& aEvent); 93 94 mozilla::ipc::IPCResult RecvWillChangeProcess(); 95 96 mozilla::ipc::IPCResult RecvActivate(uint64_t aActionId); 97 98 mozilla::ipc::IPCResult RecvDeactivate(const bool& aWindowLowering, 99 uint64_t aActionId); 100 101 mozilla::ipc::IPCResult RecvSetIsUnderHiddenEmbedderElement( 102 const bool& aIsUnderHiddenEmbedderElement); 103 104 #ifdef ACCESSIBILITY 105 mozilla::ipc::IPCResult RecvSetEmbedderAccessible(PDocAccessibleParent* aDoc, 106 uint64_t aID); 107 #endif 108 109 void ActorDestroy(ActorDestroyReason aWhy) override; 110 111 private: 112 ~BrowserBridgeParent(); 113 114 RefPtr<BrowserParent> mBrowserParent; 115 #ifdef ACCESSIBILITY 116 RefPtr<a11y::DocAccessibleParent> mEmbedderAccessibleDoc; 117 uint64_t mEmbedderAccessibleID = 0; 118 #endif // ACCESSIBILITY 119 }; 120 121 } // namespace dom 122 } // namespace mozilla 123 124 #endif // !defined(mozilla_dom_BrowserBridgeParent_h) 125