/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsPIDOMWindow_h__ #define nsPIDOMWindow_h__ #include "nsIDOMWindow.h" #include "mozIDOMWindow.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "nsTArray.h" #include "mozilla/dom/EventTarget.h" #include "js/TypeDecls.h" #include "nsRefPtrHashtable.h" // Only fired for inner windows. #define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed" #define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen" #define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed" class nsGlobalWindow; class nsIArray; class nsIContent; class nsICSSDeclaration; class nsIDocShell; class nsIDocument; class nsIIdleObserver; class nsIScriptTimeoutHandler; class nsIURI; class nsPerformance; class nsPIDOMWindowInner; class nsPIDOMWindowOuter; class nsPIWindowRoot; class nsXBLPrototypeHandler; struct nsTimeout; typedef uint32_t SuspendTypes; namespace mozilla { namespace dom { class AudioContext; class Element; class ServiceWorkerRegistrationMainThread; } // namespace dom namespace gfx { class VRDeviceProxy; } // namespace gfx } // namespace mozilla // Popup control state enum. The values in this enum must go from most // permissive to least permissive so that it's safe to push state in // all situations. Pushing popup state onto the stack never makes the // current popup state less permissive (see // nsGlobalWindow::PushPopupControlState()). enum PopupControlState { openAllowed = 0, // open that window without worries openControlled, // it's a popup, but allow it openAbused, // it's a popup. disallow it, but allow domain override. openOverridden // disallow window open }; enum UIStateChangeType { UIStateChangeType_NoChange, UIStateChangeType_Set, UIStateChangeType_Clear, UIStateChangeType_Invalid // used for serialization only }; enum class FullscreenReason { // Toggling the fullscreen mode requires trusted context. ForFullscreenMode, // Fullscreen API is the API provided to untrusted content. ForFullscreenAPI, // This reason can only be used with exiting fullscreen. // It is otherwise identical to eForFullscreenAPI except it would // suppress the fullscreen transition. ForForceExitFullscreen }; // nsPIDOMWindowInner and nsPIDOMWindowOuter are identical in all respects // except for the type name. They *must* remain identical so that we can // reinterpret_cast between them. template class nsPIDOMWindow : public T { public: nsPIDOMWindowInner* AsInner(); const nsPIDOMWindowInner* AsInner() const; nsPIDOMWindowOuter* AsOuter(); const nsPIDOMWindowOuter* AsOuter() const; virtual nsPIDOMWindowOuter* GetPrivateRoot() = 0; // Outer windows only. virtual void ActivateOrDeactivate(bool aActivate) = 0; // this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow::GetWindowRoot /** * |top| gets the root of the window hierarchy. * * This function does not cross chrome-content boundaries, so if this * window's parent is of a different type, |top| will return this window. * * When script reads the top property, we run GetScriptableTop, which * will not cross an