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 /* BarProps are the collection of little properties of DOM windows whose
8 only property of their own is "visible". They describe the window
9 chrome which can be made visible or not through JavaScript by setting
10 the appropriate property (window.menubar.visible)
13 #ifndef mozilla_dom_BarProps_h
14 #define mozilla_dom_BarProps_h
16 #include "mozilla/Attributes.h"
17 #include "nsCycleCollectionParticipant.h"
18 #include "nsWrapperCache.h"
19 #include "nsPIDOMWindow.h"
20 #include "mozilla/dom/BindingDeclarations.h"
21 #include "mozilla/dom/BrowsingContext.h"
23 class nsGlobalWindowInner
;
24 class nsIWebBrowserChrome
;
32 // Script "BarProp" object
33 class BarProp
: public nsISupports
, public nsWrapperCache
{
35 explicit BarProp(nsGlobalWindowInner
* aWindow
);
37 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
38 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(BarProp
)
40 nsPIDOMWindowInner
* GetParentObject() const;
42 JSObject
* WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) final
;
44 virtual bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) = 0;
45 virtual void SetVisible(bool aVisible
, CallerType aCallerType
,
46 ErrorResult
& aRv
) = 0;
51 bool GetVisibleByIsPopup();
52 bool GetVisibleByFlag(uint32_t aChromeFlag
, CallerType aCallerType
,
54 void SetVisibleByFlag(bool aVisible
, uint32_t aChromeFlag
,
55 CallerType aCallerType
, ErrorResult
& aRv
);
57 already_AddRefed
<nsIWebBrowserChrome
> GetBrowserChrome();
59 BrowsingContext
* GetBrowsingContext();
61 RefPtr
<nsGlobalWindowInner
> mDOMWindow
;
64 // Script "menubar" object
65 class MenubarProp final
: public BarProp
{
67 explicit MenubarProp(nsGlobalWindowInner
* aWindow
);
68 virtual ~MenubarProp();
70 bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) override
;
71 void SetVisible(bool aVisible
, CallerType aCallerType
,
72 ErrorResult
& aRv
) override
;
75 // Script "toolbar" object
76 class ToolbarProp final
: public BarProp
{
78 explicit ToolbarProp(nsGlobalWindowInner
* aWindow
);
79 virtual ~ToolbarProp();
81 bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) override
;
82 void SetVisible(bool aVisible
, CallerType aCallerType
,
83 ErrorResult
& aRv
) override
;
86 // Script "locationbar" object
87 class LocationbarProp final
: public BarProp
{
89 explicit LocationbarProp(nsGlobalWindowInner
* aWindow
);
90 virtual ~LocationbarProp();
92 bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) override
;
93 void SetVisible(bool aVisible
, CallerType aCallerType
,
94 ErrorResult
& aRv
) override
;
97 // Script "personalbar" object
98 class PersonalbarProp final
: public BarProp
{
100 explicit PersonalbarProp(nsGlobalWindowInner
* aWindow
);
101 virtual ~PersonalbarProp();
103 bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) override
;
104 void SetVisible(bool aVisible
, CallerType aCallerType
,
105 ErrorResult
& aRv
) override
;
108 // Script "statusbar" object
109 class StatusbarProp final
: public BarProp
{
111 explicit StatusbarProp(nsGlobalWindowInner
* aWindow
);
112 virtual ~StatusbarProp();
114 bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) override
;
115 void SetVisible(bool aVisible
, CallerType aCallerType
,
116 ErrorResult
& aRv
) override
;
119 // Script "scrollbars" object
120 class ScrollbarsProp final
: public BarProp
{
122 explicit ScrollbarsProp(nsGlobalWindowInner
* aWindow
);
123 virtual ~ScrollbarsProp();
125 bool GetVisible(CallerType aCallerType
, ErrorResult
& aRv
) override
;
126 void SetVisible(bool aVisible
, CallerType aCallerType
,
127 ErrorResult
& aRv
) override
;
131 } // namespace mozilla
133 #endif /* mozilla_dom_BarProps_h */