Bug 1843230 - Remove IsWin8OrLater checks from dom/geolocation/ r=emk
[gecko.git] / dom / ipc / BrowserBridgeHost.cpp
blob2cb8decd58b824b0cde70d21778471c1688c1a41
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 #include "mozilla/dom/BrowserBridgeHost.h"
9 #include "mozilla/Unused.h"
10 #include "mozilla/dom/Element.h"
11 #include "nsFrameLoader.h"
13 namespace mozilla::dom {
15 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserBridgeHost)
16 NS_INTERFACE_MAP_ENTRY(nsISupports)
17 NS_INTERFACE_MAP_END
19 NS_IMPL_CYCLE_COLLECTION(BrowserBridgeHost)
21 NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserBridgeHost)
22 NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserBridgeHost)
24 BrowserBridgeHost::BrowserBridgeHost(BrowserBridgeChild* aChild)
25 : mBridge(aChild) {}
27 TabId BrowserBridgeHost::GetTabId() const { return mBridge->GetTabId(); }
29 mozilla::layers::LayersId BrowserBridgeHost::GetLayersId() const {
30 return mBridge->GetLayersId();
33 BrowsingContext* BrowserBridgeHost::GetBrowsingContext() const {
34 return mBridge->GetBrowsingContext();
37 nsILoadContext* BrowserBridgeHost::GetLoadContext() const {
38 return mBridge->GetLoadContext();
41 bool BrowserBridgeHost::CanRecv() const {
42 return mBridge && mBridge->CanRecv();
45 void BrowserBridgeHost::LoadURL(nsDocShellLoadState* aLoadState) {
46 MOZ_ASSERT(aLoadState);
47 Unused << mBridge->SendLoadURL(WrapNotNull(aLoadState));
50 void BrowserBridgeHost::ResumeLoad(uint64_t aPendingSwitchId) {
51 Unused << mBridge->SendResumeLoad(aPendingSwitchId);
54 void BrowserBridgeHost::DestroyStart() {
55 // We don't clear the bridge until BrowserBridgeChild::ActorDestroy is called,
56 // which will end up calling DestroyComplete().
57 if (mBridge) {
58 Unused << mBridge->SendBeginDestroy();
62 void BrowserBridgeHost::DestroyComplete() { mBridge = nullptr; }
64 bool BrowserBridgeHost::Show(const OwnerShowInfo& aShowInfo) {
65 Unused << mBridge->SendShow(aShowInfo);
66 return true;
69 void BrowserBridgeHost::UpdateDimensions(const nsIntRect& aRect,
70 const ScreenIntSize& aSize) {
71 Unused << mBridge->SendUpdateDimensions(aRect, aSize);
74 void BrowserBridgeHost::UpdateEffects(EffectsInfo aEffects) {
75 if (!mBridge || mEffectsInfo == aEffects) {
76 return;
78 mEffectsInfo = aEffects;
79 Unused << mBridge->SendUpdateEffects(mEffectsInfo);
82 already_AddRefed<nsIWidget> BrowserBridgeHost::GetWidget() const {
83 RefPtr<Element> owner = mBridge->GetFrameLoader()->GetOwnerContent();
84 nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForContent(owner);
85 if (!widget) {
86 widget = nsContentUtils::WidgetForDocument(owner->OwnerDoc());
88 return widget.forget();
91 } // namespace mozilla::dom