tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

XULFrameElement.h (2717B)


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