michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * 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: /* Private "control" methods on the Window Watcher. These are annoying michael@0: bookkeeping methods, not part of the public (embedding) interface. michael@0: */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMWindow; michael@0: interface nsISimpleEnumerator; michael@0: interface nsIWebBrowserChrome; michael@0: interface nsIDocShellTreeItem; michael@0: interface nsIArray; michael@0: michael@0: [uuid(00788A84-152F-4BD8-A814-FD8EB545DB29)] michael@0: michael@0: interface nsPIWindowWatcher : nsISupports michael@0: { michael@0: /** A window has been created. Add it to our list. michael@0: @param aWindow the window to add michael@0: @param aChrome the corresponding chrome window. The DOM window michael@0: and chrome will be mapped together, and the corresponding michael@0: chrome can be retrieved using the (not private) michael@0: method getChromeForWindow. If null, any extant mapping michael@0: will be cleared. michael@0: */ michael@0: void addWindow(in nsIDOMWindow aWindow, in nsIWebBrowserChrome aChrome); michael@0: michael@0: /** A window has been closed. Remove it from our list. michael@0: @param aWindow the window to remove michael@0: */ michael@0: void removeWindow(in nsIDOMWindow aWindow); michael@0: michael@0: /** Like the public interface's open(), but can handle openDialog-style michael@0: arguments and calls which shouldn't result in us navigating the window. michael@0: michael@0: @param aParent parent window, if any. Null if no parent. If it is michael@0: impossible to get to an nsIWebBrowserChrome from aParent, this michael@0: method will effectively act as if aParent were null. michael@0: @param aURL url to which to open the new window. Must already be michael@0: escaped, if applicable. can be null. michael@0: @param aName window name from JS window.open. can be null. If a window michael@0: with this name already exists, the openWindow call may just load michael@0: aUrl in it (if aUrl is not null) and return it. michael@0: @param aFeatures window features from JS window.open. can be null. michael@0: @param aCalledFromScript true if we were called from script. michael@0: @param aDialog use dialog defaults (see nsIDOMWindow::openDialog) michael@0: @param aNavigate true if we should navigate the new window to the michael@0: specified URL. michael@0: @param aArgs Window argument michael@0: @return the new window michael@0: michael@0: @note This method may examine the JS context stack for purposes of michael@0: determining the security context to use for the search for a given michael@0: window named aName. michael@0: @note This method should try to set the default charset for the new michael@0: window to the default charset of the document in the calling window michael@0: (which is determined based on the JS stack and the value of michael@0: aParent). This is not guaranteed, however. michael@0: */ michael@0: nsIDOMWindow openWindow2(in nsIDOMWindow aParent, in string aUrl, michael@0: in string aName, in string aFeatures, michael@0: in boolean aCalledFromScript, in boolean aDialog, michael@0: in boolean aNavigate, in nsISupports aArgs); michael@0: michael@0: /** michael@0: * Find a named docshell tree item amongst all windows registered michael@0: * with the window watcher. This may be a subframe in some window, michael@0: * for example. michael@0: * michael@0: * @param aName the name of the window. Must not be null. michael@0: * @param aRequestor the tree item immediately making the request. michael@0: * We should make sure to not recurse down into its findItemWithName michael@0: * method. michael@0: * @param aOriginalRequestor the original treeitem that made the request. michael@0: * Used for security checks. michael@0: * @return the tree item with aName as the name, or null if there michael@0: * isn't one. "Special" names, like _self, _top, etc, will be michael@0: * treated specially only if aRequestor is null; in that case they michael@0: * will be resolved relative to the first window the windowwatcher michael@0: * knows about. michael@0: * @see findItemWithName methods on nsIDocShellTreeItem and michael@0: * nsIDocShellTreeOwner michael@0: */ michael@0: nsIDocShellTreeItem findItemWithName(in wstring aName, michael@0: in nsIDocShellTreeItem aRequestor, michael@0: in nsIDocShellTreeItem aOriginalRequestor); michael@0: }; michael@0: