Backed out 4 changesets (bug 1825722) for causing reftest failures CLOSED TREE
[gecko.git] / dom / base / ContentFrameMessageManager.h
blob49c0676bcb1e62589f89c201054f3893157b7103
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_ContentFrameMessageManager_h
8 #define mozilla_dom_ContentFrameMessageManager_h
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/MessageManagerGlobal.h"
12 #include "nsContentUtils.h"
13 #include "xpcpublic.h"
15 namespace mozilla::dom {
17 template <typename>
18 struct Nullable;
19 class WindowProxyHolder;
21 #define NS_CONTENTFRAMEMESSAGEMANAGER_IID \
22 { \
23 0x97e192a6, 0xab7a, 0x4c8f, { \
24 0xb7, 0xdd, 0xf7, 0xec, 0x36, 0x38, 0x71, 0xb5 \
25 } \
28 /**
29 * Base class for implementing the WebIDL ContentFrameMessageManager class.
31 class ContentFrameMessageManager : public DOMEventTargetHelper,
32 public MessageManagerGlobal {
33 public:
34 using DOMEventTargetHelper::AddRef;
35 using DOMEventTargetHelper::Release;
37 NS_DECLARE_STATIC_IID_ACCESSOR(NS_CONTENTFRAMEMESSAGEMANAGER_IID)
39 virtual Nullable<WindowProxyHolder> GetContent(ErrorResult& aError) = 0;
40 virtual already_AddRefed<nsIDocShell> GetDocShell(ErrorResult& aError) = 0;
41 virtual already_AddRefed<nsIEventTarget> GetTabEventTarget() = 0;
43 nsFrameMessageManager* GetMessageManager() { return mMessageManager; }
44 void DisconnectMessageManager() {
45 mMessageManager->Disconnect();
46 mMessageManager = nullptr;
49 JSObject* GetOrCreateWrapper();
51 protected:
52 explicit ContentFrameMessageManager(nsFrameMessageManager* aMessageManager)
53 : DOMEventTargetHelper(xpc::NativeGlobal(xpc::PrivilegedJunkScope())),
54 MessageManagerGlobal(aMessageManager) {}
57 NS_DEFINE_STATIC_IID_ACCESSOR(ContentFrameMessageManager,
58 NS_CONTENTFRAMEMESSAGEMANAGER_IID)
60 } // namespace mozilla::dom
62 #endif // mozilla_dom_ContentFrameMessageManager_h