RemoteBrowser.h (2473B)
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_ipc_RemoteBrowser_h 8 #define mozilla_dom_ipc_RemoteBrowser_h 9 10 #include "Units.h" 11 #include "mozilla/dom/ipc/IdType.h" 12 #include "mozilla/layers/LayersTypes.h" 13 #include "nsISupports.h" 14 #include "nsRect.h" 15 16 class nsDocShellLoadState; 17 class nsFrameLoader; 18 class nsILoadContext; 19 class nsIContent; 20 21 namespace mozilla::dom { 22 23 class BrowserHost; 24 class BrowserBridgeHost; 25 class BrowsingContext; 26 class EffectsInfo; 27 class OwnerShowInfo; 28 29 /** 30 * An interface to control a browser hosted in another process. 31 * 32 * This is used by nsFrameLoader to abstract between hosting a top-level remote 33 * browser in the chrome process and hosting an OOP-iframe in a content process. 34 * 35 * There are two concrete implementations that are used depending on whether 36 * the nsFrameLoader is in the chrome or content process. A chrome process 37 * nsFrameLoader will use BrowserHost, and a content process nsFrameLoader will 38 * use BrowserBridgeHost. 39 */ 40 class RemoteBrowser : public nsISupports { 41 public: 42 using LayersId = mozilla::layers::LayersId; 43 44 static RemoteBrowser* GetFrom(nsFrameLoader* aFrameLoader); 45 static RemoteBrowser* GetFrom(nsIContent* aContent); 46 47 // Try to cast this RemoteBrowser to a BrowserHost, may return null 48 virtual BrowserHost* AsBrowserHost() = 0; 49 // Try to cast this RemoteBrowser to a BrowserBridgeHost, may return null 50 virtual BrowserBridgeHost* AsBrowserBridgeHost() = 0; 51 52 virtual TabId GetTabId() const = 0; 53 virtual LayersId GetLayersId() const = 0; 54 virtual BrowsingContext* GetBrowsingContext() const = 0; 55 virtual nsILoadContext* GetLoadContext() const = 0; 56 virtual bool CanRecv() const = 0; 57 58 virtual void LoadURL(nsDocShellLoadState* aLoadState) = 0; 59 virtual void ResumeLoad(uint64_t aPendingSwitchId) = 0; 60 virtual void DestroyStart() = 0; 61 virtual void DestroyComplete() = 0; 62 63 virtual bool Show(const OwnerShowInfo&) = 0; 64 virtual void UpdateDimensions(const LayoutDeviceIntRect& aRect, 65 const LayoutDeviceIntSize& aSize) = 0; 66 67 virtual void UpdateEffects(EffectsInfo aInfo) = 0; 68 }; 69 70 } // namespace mozilla::dom 71 72 #endif // mozilla_dom_ipc_RemoteBrowser_h