michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIXULWindow; michael@0: interface nsIWebNavigation; michael@0: interface nsIURI; michael@0: interface nsIDOMWindow; michael@0: interface nsIAppShell; michael@0: michael@0: [ptr] native JSContext(JSContext); michael@0: michael@0: %{C++ michael@0: #include "js/TypeDecls.h" michael@0: %} michael@0: michael@0: [scriptable, uuid(2fa2f813-c216-4efb-8a8c-de60108ce5e5)] michael@0: interface nsIAppShellService : nsISupports michael@0: { michael@0: /** michael@0: * Create a window, which will be initially invisible. michael@0: * @param aParent the parent window. Can be null. michael@0: * @param aUrl the contents of the new window. michael@0: * @param aChromeMask chrome flags affecting the kind of OS border michael@0: * given to the window. see nsIBrowserWindow for michael@0: * bit/flag definitions. michael@0: * @param aCallbacks interface providing C++ hooks for window initialization michael@0: * before the window is made visible. Can be null. michael@0: * Deprecated. michael@0: * @param aInitialWidth width, in pixels, of the window. Width of window michael@0: * at creation. Can be overridden by the "width" michael@0: * tag in the XUL. Set to NS_SIZETOCONTENT to force michael@0: * the window to wrap to its contents. michael@0: * @param aInitialHeight like aInitialWidth, but subtly different. michael@0: * @param aResult the newly created window is returned here. michael@0: */ michael@0: const long SIZE_TO_CONTENT = -1; michael@0: nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent, michael@0: in nsIURI aUrl, michael@0: in uint32_t aChromeMask, michael@0: in long aInitialWidth, michael@0: in long aInitialHeight); michael@0: michael@0: /** michael@0: * This is the constructor for creating an invisible DocShell. michael@0: * It is used to simulate DOM windows without an actual physical michael@0: * representation. michael@0: * @param aIsChrome Set true if you want to use it for chrome content. michael@0: */ michael@0: nsIWebNavigation createWindowlessBrowser([optional] in bool aIsChrome); michael@0: michael@0: [noscript] michael@0: void createHiddenWindow(); michael@0: michael@0: void destroyHiddenWindow(); michael@0: michael@0: /** michael@0: * Return the (singleton) application hidden window, automatically created michael@0: * and maintained by this AppShellService. michael@0: * @param aResult the hidden window. Do not unhide hidden window. michael@0: * Do not taunt hidden window. michael@0: */ michael@0: readonly attribute nsIXULWindow hiddenWindow; michael@0: michael@0: /** michael@0: * Return the (singleton) application hidden window, automatically created michael@0: * and maintained by this AppShellService. michael@0: * @param aResult the hidden window. Do not unhide hidden window. michael@0: * Do not taunt hidden window. michael@0: */ michael@0: readonly attribute nsIDOMWindow hiddenDOMWindow; michael@0: michael@0: /** michael@0: * Return the (singleton) application hidden private window, automatically michael@0: * created and maintained by this AppShellService. This window is created michael@0: * in private browsing mode. michael@0: * @param aResult the hidden private window. Do not unhide hidden window. michael@0: * Do not taunt hidden window. michael@0: */ michael@0: readonly attribute nsIXULWindow hiddenPrivateWindow; michael@0: michael@0: /** michael@0: * Return the (singleton) application hidden private window, automatically michael@0: * created and maintained by this AppShellService. This window is created michael@0: * in private browsing mode. michael@0: * @param aResult the hidden private window. Do not unhide hidden window. michael@0: * Do not taunt hidden window. michael@0: */ michael@0: readonly attribute nsIDOMWindow hiddenPrivateDOMWindow; michael@0: michael@0: /** michael@0: * Return the (singleton) application hidden window as an nsIDOMWindow, michael@0: * and, the corresponding JavaScript context pointer. This is useful michael@0: * if you'd like to subsequently call OpenDialog on the hidden window. michael@0: * @aHiddenDOMWindow the hidden window QI'd to type nsIDOMWindow michael@0: * @aJSContext the corresponding JavaScript context michael@0: */ michael@0: [noscript] michael@0: void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, michael@0: out JSContext aJSContext); michael@0: michael@0: /** michael@0: * Return true if the application hidden window was provided by the michael@0: * application. If it wasn't, the default hidden window was used. This will michael@0: * usually be false on all non-mac platforms. michael@0: */ michael@0: readonly attribute boolean applicationProvidedHiddenWindow; michael@0: michael@0: /** michael@0: * Add a window to the application's registry of windows. These windows michael@0: * are generally shown in the Windows taskbar, and the application michael@0: * knows it can't quit until it's out of registered windows. michael@0: * @param aWindow the window to register michael@0: * @note When this method is successful, it fires the global notification michael@0: * "xul-window-registered" michael@0: */ michael@0: void registerTopLevelWindow(in nsIXULWindow aWindow); michael@0: michael@0: /** michael@0: * Remove a window from the application's window registry. Note that michael@0: * this method won't automatically attempt to quit the app when michael@0: * the last window is unregistered. For that, see Quit(). michael@0: * @param aWindow you see the pattern michael@0: */ michael@0: void unregisterTopLevelWindow(in nsIXULWindow aWindow); michael@0: michael@0: /** michael@0: * Whether the hidden private window has been lazily created. michael@0: */ michael@0: [noscript] michael@0: readonly attribute boolean hasHiddenPrivateWindow; michael@0: michael@0: /** michael@0: * Start/stop tracking lags in the event loop. michael@0: * If the event loop gets unresponsive, a "event-loop-lag" notification michael@0: * is sent. Note that calling `startEventLoopLagTracking` when tracking michael@0: * is already enabled has no effect. michael@0: * @return true if tracking succeeded. michael@0: */ michael@0: bool startEventLoopLagTracking(); michael@0: void stopEventLoopLagTracking(); michael@0: };