Bug 1655413 [wpt PR 24763] - Make CSP default-src without 'unsafe-eval' block eval...
[gecko.git] / dom / ipc / BrowserBridgeParent.h
blob13bd56b8db5860f83fd5abda04c15545a80d9255
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_BrowserBridgeParent_h
8 #define mozilla_dom_BrowserBridgeParent_h
10 #include "mozilla/dom/PBrowserBridgeParent.h"
11 #include "mozilla/Tuple.h"
12 #include "mozilla/dom/ipc/IdType.h"
13 #include "mozilla/dom/WindowGlobalTypes.h"
15 namespace mozilla {
17 namespace a11y {
18 class DocAccessibleParent;
21 namespace dom {
23 class BrowserParent;
25 /**
26 * BrowserBridgeParent implements the parent actor part of the PBrowserBridge
27 * protocol. See PBrowserBridge for more information.
29 class BrowserBridgeParent : public PBrowserBridgeParent {
30 public:
31 NS_INLINE_DECL_REFCOUNTING(BrowserBridgeParent, final);
33 BrowserBridgeParent();
35 nsresult InitWithProcess(BrowserParent* aParentBrowser,
36 ContentParent* aContentParent,
37 const WindowGlobalInit& aWindowInit,
38 uint32_t aChromeFlags, TabId aTabId);
40 BrowserParent* GetBrowserParent() { return mBrowserParent; }
42 CanonicalBrowsingContext* GetBrowsingContext();
44 // Get our manager actor.
45 BrowserParent* Manager();
47 #if defined(ACCESSIBILITY)
48 /**
49 * Get the accessible for this iframe's embedder OuterDocAccessible.
50 * This returns the actor for the containing document and the unique id of
51 * the embedder accessible within that document.
53 Tuple<a11y::DocAccessibleParent*, uint64_t> GetEmbedderAccessible() {
54 return Tuple<a11y::DocAccessibleParent*, uint64_t>(mEmbedderAccessibleDoc,
55 mEmbedderAccessibleID);
57 #endif // defined(ACCESSIBILITY)
59 // Tear down this BrowserBridgeParent.
60 void Destroy();
62 protected:
63 friend class PBrowserBridgeParent;
65 mozilla::ipc::IPCResult RecvShow(const OwnerShowInfo&);
66 mozilla::ipc::IPCResult RecvScrollbarPreferenceChanged(ScrollbarPreference);
67 mozilla::ipc::IPCResult RecvLoadURL(const nsCString& aUrl,
68 nsIPrincipal* aTriggeringPrincipal);
69 mozilla::ipc::IPCResult RecvResumeLoad(uint64_t aPendingSwitchID);
70 mozilla::ipc::IPCResult RecvUpdateDimensions(const nsIntRect& aRect,
71 const ScreenIntSize& aSize);
72 mozilla::ipc::IPCResult RecvUpdateEffects(const EffectsInfo& aEffects);
73 mozilla::ipc::IPCResult RecvRenderLayers(const bool& aEnabled,
74 const LayersObserverEpoch& aEpoch);
76 mozilla::ipc::IPCResult RecvNavigateByKey(const bool& aForward,
77 const bool& aForDocumentNavigation);
79 mozilla::ipc::IPCResult RecvDispatchSynthesizedMouseEvent(
80 const WidgetMouseEvent& aEvent);
82 mozilla::ipc::IPCResult RecvWillChangeProcess();
84 mozilla::ipc::IPCResult RecvActivate();
86 mozilla::ipc::IPCResult RecvDeactivate(const bool& aWindowLowering);
88 mozilla::ipc::IPCResult RecvSetIsUnderHiddenEmbedderElement(
89 const bool& aIsUnderHiddenEmbedderElement);
91 #ifdef ACCESSIBILITY
92 mozilla::ipc::IPCResult RecvSetEmbedderAccessible(PDocAccessibleParent* aDoc,
93 uint64_t aID);
94 #endif
96 void ActorDestroy(ActorDestroyReason aWhy) override;
98 private:
99 ~BrowserBridgeParent();
101 RefPtr<BrowserParent> mBrowserParent;
102 #ifdef ACCESSIBILITY
103 RefPtr<a11y::DocAccessibleParent> mEmbedderAccessibleDoc;
104 uint64_t mEmbedderAccessibleID = 0;
105 #endif // ACCESSIBILITY
108 } // namespace dom
109 } // namespace mozilla
111 #endif // !defined(mozilla_dom_BrowserBridgeParent_h)