WindowGlobalActor.h (1864B)
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 mozilla_dom_WindowGlobalActor_h 8 #define mozilla_dom_WindowGlobalActor_h 9 10 #include "mozilla/dom/BrowsingContext.h" 11 #include "mozilla/dom/JSActor.h" 12 #include "mozilla/dom/JSActorManager.h" 13 #include "mozilla/dom/WindowGlobalTypes.h" 14 #include "nsILoadInfo.h" 15 #include "nsIOpenWindowInfo.h" 16 #include "nsISupports.h" 17 #include "nsIURI.h" 18 #include "nsString.h" 19 #include "nsWrapperCache.h" 20 21 namespace mozilla { 22 class ErrorResult; 23 24 namespace dom { 25 26 // Common base class for WindowGlobal{Parent, Child}. 27 class WindowGlobalActor : public JSActorManager { 28 public: 29 // Called to determine initial state for a window global actor created for an 30 // initial about:blank document. 31 static WindowGlobalInit AboutBlankInitializer( 32 dom::BrowsingContext* aBrowsingContext, nsIPrincipal* aPrincipal); 33 34 // Called to determine initial state for a window global actor created for a 35 // specific existing nsGlobalWindowInner. 36 static WindowGlobalInit WindowInitializer(nsGlobalWindowInner* aWindow); 37 38 protected: 39 virtual ~WindowGlobalActor() = default; 40 41 already_AddRefed<JSActorProtocol> MatchingJSActorProtocol( 42 JSActorService* aActorSvc, const nsACString& aName, 43 ErrorResult& aRv) final; 44 45 virtual nsIURI* GetDocumentURI() = 0; 46 virtual dom::BrowsingContext* BrowsingContext() = 0; 47 48 static WindowGlobalInit BaseInitializer( 49 dom::BrowsingContext* aBrowsingContext, uint64_t aInnerWindowId, 50 uint64_t aOuterWindowId); 51 }; 52 53 } // namespace dom 54 } // namespace mozilla 55 56 #endif // mozilla_dom_WindowGlobalActor_h