BrowserBridgeParent.h (3930B)
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/WindowGlobalTypes.h" 12 #include "mozilla/dom/ipc/IdType.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 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 */ 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( 80 const LayoutDeviceIntRect& aRect, const LayoutDeviceIntSize& 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 86 mozilla::ipc::IPCResult RecvNavigateByKey(const bool& aForward, 87 const bool& aForDocumentNavigation); 88 mozilla::ipc::IPCResult RecvBeginDestroy(); 89 90 mozilla::ipc::IPCResult RecvDispatchSynthesizedMouseEvent( 91 const WidgetMouseEvent& aEvent); 92 93 mozilla::ipc::IPCResult RecvWillChangeProcess(); 94 95 mozilla::ipc::IPCResult RecvActivate(uint64_t aActionId); 96 97 mozilla::ipc::IPCResult RecvDeactivate(const bool& aWindowLowering, 98 uint64_t aActionId); 99 100 mozilla::ipc::IPCResult RecvUpdateRemoteStyle( 101 const StyleImageRendering& aImageRendering); 102 103 #ifdef ACCESSIBILITY 104 mozilla::ipc::IPCResult RecvSetEmbedderAccessible(PDocAccessibleParent* aDoc, 105 uint64_t aID); 106 #endif 107 108 void ActorDestroy(ActorDestroyReason aWhy) override; 109 110 private: 111 ~BrowserBridgeParent(); 112 113 RefPtr<BrowserParent> mBrowserParent; 114 #ifdef ACCESSIBILITY 115 RefPtr<a11y::DocAccessibleParent> mEmbedderAccessibleDoc; 116 uint64_t mEmbedderAccessibleID = 0; 117 #endif // ACCESSIBILITY 118 }; 119 120 } // namespace dom 121 } // namespace mozilla 122 123 #endif // !defined(mozilla_dom_BrowserBridgeParent_h)