Source code

Revision control

Other Tools

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/. */
6
7
#ifndef XULFrameElement_h__
8
#define XULFrameElement_h__
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/ErrorResult.h"
12
#include "mozilla/dom/Nullable.h"
13
#include "mozilla/dom/WindowProxyHolder.h"
14
#include "js/TypeDecls.h"
15
#include "nsCycleCollectionParticipant.h"
16
#include "nsWrapperCache.h"
17
#include "nsString.h"
18
#include "nsXULElement.h"
19
#include "nsFrameLoaderOwner.h"
20
21
class nsIWebNavigation;
22
class nsFrameLoader;
23
24
namespace mozilla {
25
namespace dom {
26
27
class BrowsingContext;
28
29
class XULFrameElement final : public nsXULElement, public nsFrameLoaderOwner {
30
public:
31
explicit XULFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
32
: nsXULElement(std::move(aNodeInfo)) {}
33
34
NS_DECL_ISUPPORTS_INHERITED
35
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULFrameElement, nsXULElement)
36
37
// XULFrameElement.webidl
38
nsDocShell* GetDocShell();
39
already_AddRefed<nsIWebNavigation> GetWebNavigation();
40
Nullable<WindowProxyHolder> GetContentWindow();
41
Document* GetContentDocument();
42
43
void PresetOpenerWindow(const Nullable<WindowProxyHolder>& aWindow,
44
ErrorResult& aRv) {
45
mOpener = aWindow.IsNull() ? nullptr : aWindow.Value().get();
46
}
47
48
void SwapFrameLoaders(mozilla::dom::HTMLIFrameElement& aOtherLoaderOwner,
49
mozilla::ErrorResult& rv);
50
void SwapFrameLoaders(XULFrameElement& aOtherLoaderOwner,
51
mozilla::ErrorResult& rv);
52
void SwapFrameLoaders(nsFrameLoaderOwner* aOtherLoaderOwner,
53
mozilla::ErrorResult& rv);
54
55
// nsIContent
56
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
57
virtual void UnbindFromTree(bool aNullParent) override;
58
virtual void DestroyContent() override;
59
60
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
61
const nsAttrValue* aValue,
62
const nsAttrValue* aOldValue,
63
nsIPrincipal* aSubjectPrincipal,
64
bool aNotify) override;
65
66
protected:
67
virtual ~XULFrameElement() {}
68
69
RefPtr<BrowsingContext> mOpener;
70
71
JSObject* WrapNode(JSContext* aCx,
72
JS::Handle<JSObject*> aGivenProto) override;
73
74
void LoadSrc();
75
};
76
77
} // namespace dom
78
} // namespace mozilla
79
80
#endif // XULFrameElement_h