Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / ipc / RemoteBrowser.h
blob7ea0b669fdb92057dfbd9a492af69b5a7ae92199
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/. */
7 #ifndef mozilla_dom_ipc_RemoteBrowser_h
8 #define mozilla_dom_ipc_RemoteBrowser_h
10 #include "mozilla/dom/ipc/IdType.h"
11 #include "mozilla/layers/LayersTypes.h"
12 #include "nsISupports.h"
13 #include "nsRect.h"
14 #include "Units.h"
16 class nsDocShellLoadState;
17 class nsFrameLoader;
18 class nsILoadContext;
19 class nsIContent;
21 namespace mozilla::dom {
23 class BrowserHost;
24 class BrowserBridgeHost;
25 class BrowsingContext;
26 class EffectsInfo;
27 class OwnerShowInfo;
29 /**
30 * An interface to control a browser hosted in another process.
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.
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.
40 class RemoteBrowser : public nsISupports {
41 public:
42 using LayersId = mozilla::layers::LayersId;
44 static RemoteBrowser* GetFrom(nsFrameLoader* aFrameLoader);
45 static RemoteBrowser* GetFrom(nsIContent* aContent);
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;
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;
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;
63 virtual bool Show(const OwnerShowInfo&) = 0;
64 virtual void UpdateDimensions(const nsIntRect& aRect,
65 const ScreenIntSize& aSize) = 0;
67 virtual void UpdateEffects(EffectsInfo aInfo) = 0;
70 } // namespace mozilla::dom
72 #endif // mozilla_dom_ipc_RemoteBrowser_h