Bug 1634779 - pt 2. Partially revert Bug 1603006 r=kmag
[gecko.git] / dom / ipc / BrowserBridgeParent.h
blob384c3d98dbe61ee202a449660b54ab7006bf8163
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"
14 namespace mozilla {
16 namespace a11y {
17 class DocAccessibleParent;
20 namespace dom {
22 class BrowserParent;
24 /**
25 * BrowserBridgeParent implements the parent actor part of the PBrowserBridge
26 * protocol. See PBrowserBridge for more information.
28 class BrowserBridgeParent : public PBrowserBridgeParent {
29 public:
30 NS_INLINE_DECL_REFCOUNTING(BrowserBridgeParent, final);
32 BrowserBridgeParent();
34 nsresult InitWithProcess(ContentParent* aContentParent,
35 const nsString& aPresentationURL,
36 const WindowGlobalInit& aWindowInit,
37 uint32_t aChromeFlags, TabId aTabId);
39 BrowserParent* GetBrowserParent() { return mBrowserParent; }
41 CanonicalBrowsingContext* GetBrowsingContext();
43 // Get our manager actor.
44 BrowserParent* Manager();
46 #if defined(ACCESSIBILITY)
47 /**
48 * Get the accessible for this iframe's embedder OuterDocAccessible.
49 * This returns the actor for the containing document and the unique id of
50 * the embedder accessible within that document.
52 Tuple<a11y::DocAccessibleParent*, uint64_t> GetEmbedderAccessible() {
53 return Tuple<a11y::DocAccessibleParent*, uint64_t>(mEmbedderAccessibleDoc,
54 mEmbedderAccessibleID);
56 #endif // defined(ACCESSIBILITY)
58 // Tear down this BrowserBridgeParent.
59 void Destroy();
61 protected:
62 friend class PBrowserBridgeParent;
64 mozilla::ipc::IPCResult RecvShow(const OwnerShowInfo&);
65 mozilla::ipc::IPCResult RecvScrollbarPreferenceChanged(ScrollbarPreference);
66 mozilla::ipc::IPCResult RecvLoadURL(const nsCString& aUrl);
67 mozilla::ipc::IPCResult RecvResumeLoad(uint64_t aPendingSwitchID);
68 mozilla::ipc::IPCResult RecvUpdateDimensions(const nsIntRect& aRect,
69 const ScreenIntSize& aSize);
70 mozilla::ipc::IPCResult RecvUpdateEffects(const EffectsInfo& aEffects);
71 mozilla::ipc::IPCResult RecvRenderLayers(const bool& aEnabled,
72 const LayersObserverEpoch& aEpoch);
74 mozilla::ipc::IPCResult RecvNavigateByKey(const bool& aForward,
75 const bool& aForDocumentNavigation);
77 mozilla::ipc::IPCResult RecvDispatchSynthesizedMouseEvent(
78 const WidgetMouseEvent& aEvent);
80 mozilla::ipc::IPCResult RecvWillChangeProcess();
82 mozilla::ipc::IPCResult RecvActivate();
84 mozilla::ipc::IPCResult RecvDeactivate(const bool& aWindowLowering);
86 mozilla::ipc::IPCResult RecvSetIsUnderHiddenEmbedderElement(
87 const bool& aIsUnderHiddenEmbedderElement);
89 #ifdef ACCESSIBILITY
90 mozilla::ipc::IPCResult RecvSetEmbedderAccessible(PDocAccessibleParent* aDoc,
91 uint64_t aID);
92 #endif
94 void ActorDestroy(ActorDestroyReason aWhy) override;
96 private:
97 ~BrowserBridgeParent();
99 RefPtr<BrowserParent> mBrowserParent;
100 #ifdef ACCESSIBILITY
101 RefPtr<a11y::DocAccessibleParent> mEmbedderAccessibleDoc;
102 uint64_t mEmbedderAccessibleID = 0;
103 #endif // ACCESSIBILITY
106 } // namespace dom
107 } // namespace mozilla
109 #endif // !defined(mozilla_dom_BrowserBridgeParent_h)