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
{
19 class WindowProxyHolder
;
21 #define NS_CONTENTFRAMEMESSAGEMANAGER_IID \
23 0x97e192a6, 0xab7a, 0x4c8f, { \
24 0xb7, 0xdd, 0xf7, 0xec, 0x36, 0x38, 0x71, 0xb5 \
29 * Base class for implementing the WebIDL ContentFrameMessageManager class.
31 class ContentFrameMessageManager
: public DOMEventTargetHelper
,
32 public MessageManagerGlobal
{
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();
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