tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BrowserBridgeHost.h (2225B)


      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_BrowserBridgeHost_h
      8 #define mozilla_dom_BrowserBridgeHost_h
      9 
     10 #include "mozilla/dom/BrowserBridgeChild.h"
     11 #include "mozilla/dom/RemoteBrowser.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 /**
     16 * BrowserBridgeHost manages a remote browser from a content process.
     17 *
     18 * It is used via the RemoteBrowser interface in nsFrameLoader and proxies
     19 * work to the chrome process via PBrowserBridge.
     20 *
     21 * See `dom/docs/Fission-IPC-Diagram.svg` for an overview of the DOM IPC
     22 * actors.
     23 */
     24 class BrowserBridgeHost final : public RemoteBrowser {
     25 public:
     26  typedef mozilla::layers::LayersId LayersId;
     27 
     28  explicit BrowserBridgeHost(BrowserBridgeChild* aChild);
     29 
     30  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     31  NS_DECL_CYCLE_COLLECTION_CLASS(BrowserBridgeHost)
     32 
     33  // Get the IPDL actor for the BrowserBridgeChild.
     34  BrowserBridgeChild* GetActor() { return mBridge; }
     35 
     36  BrowserHost* AsBrowserHost() override { return nullptr; }
     37  BrowserBridgeHost* AsBrowserBridgeHost() override { return this; }
     38 
     39  TabId GetTabId() const override;
     40  LayersId GetLayersId() const override;
     41  BrowsingContext* GetBrowsingContext() const override;
     42  nsILoadContext* GetLoadContext() const override;
     43  bool CanRecv() const override;
     44 
     45  void LoadURL(nsDocShellLoadState* aLoadState) override;
     46  void ResumeLoad(uint64_t aPendingSwitchId) override;
     47  void DestroyStart() override;
     48  void DestroyComplete() override;
     49 
     50  bool Show(const OwnerShowInfo&) override;
     51  void UpdateDimensions(const LayoutDeviceIntRect& aRect,
     52                        const LayoutDeviceIntSize& aSize) override;
     53 
     54  void UpdateEffects(EffectsInfo aInfo) override;
     55 
     56 private:
     57  virtual ~BrowserBridgeHost() = default;
     58 
     59  already_AddRefed<nsIWidget> GetWidget() const;
     60 
     61  // The IPDL actor for proxying browser operations
     62  RefPtr<BrowserBridgeChild> mBridge;
     63  EffectsInfo mEffectsInfo;
     64 };
     65 
     66 }  // namespace mozilla::dom
     67 
     68 #endif  // mozilla_dom_BrowserBridgeHost_h