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"
16 class nsDocShellLoadState
;
21 namespace mozilla::dom
{
24 class BrowserBridgeHost
;
25 class BrowsingContext
;
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
{
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 LayoutDeviceIntRect
& aRect
,
65 const LayoutDeviceIntSize
& aSize
) = 0;
67 virtual void UpdateEffects(EffectsInfo aInfo
) = 0;
70 } // namespace mozilla::dom
72 #endif // mozilla_dom_ipc_RemoteBrowser_h