gecko-dev/dom/interfaces/base/nsIBrowserDOMWindow.idl

178 строки
6.4 KiB
Plaintext
Исходник Обычный вид История

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2012-05-21 15:12:37 +04:00
/* 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/. */
#include "nsISupports.idl"
interface mozIDOMWindowProxy;
interface nsIDOMWindow;
interface nsIURI;
interface nsIFrameLoaderOwner;
interface nsIPrincipal;
[scriptable, uuid(e774db14-79ac-4156-a7a3-aa3fd0a22c10)]
interface nsIOpenURIInFrameParams : nsISupports
{
attribute DOMString referrer;
attribute unsigned long referrerPolicy;
readonly attribute boolean isPrivate;
attribute nsIPrincipal triggeringPrincipal;
// The browser or frame element in the parent process which holds the
// opener window in the content process. May be null.
readonly attribute nsIFrameLoaderOwner openerBrowser;
[implicit_jscontext]
readonly attribute jsval openerOriginAttributes;
};
[scriptable, uuid(2a9bb880-5d73-40f3-8152-c60c8d137a14)]
/**
* The C++ source has access to the browser script source through
* nsIBrowserDOMWindow. It is intended to be attached to the chrome DOMWindow
* of a toplevel browser window (a XUL window). A DOMWindow that does not
* happen to be a browser chrome window will simply have no access to any such
* interface.
*/
interface nsIBrowserDOMWindow : nsISupports
{
/**
* Values for createContentWindow's and openURI's aWhere parameter.
*/
/**
* Do whatever the default is based on application state, user preferences,
* and the value of the aContext parameter to openURI.
*/
const short OPEN_DEFAULTWINDOW = 0;
/**
* Open in the "current window". If aOpener is provided, this should be the
* top window in aOpener's window hierarchy, but exact behavior is
* application-dependent. If aOpener is not provided, it's up to the
* application to decide what constitutes a "current window".
*/
const short OPEN_CURRENTWINDOW = 1;
/**
* Open in a new window.
*/
const short OPEN_NEWWINDOW = 2;
/**
* Open in a new content tab in the toplevel browser window corresponding to
* this nsIBrowserDOMWindow.
*/
const short OPEN_NEWTAB = 3;
/**
* Open in an existing content tab based on the URI. If a match can't be
* found, revert to OPEN_NEWTAB behavior.
*/
const short OPEN_SWITCHTAB = 4;
/**
* Values for createContentWindow's and openURI's aFlags parameter.
* This is a bitflags field.
*
* The 0x1 bit decides the behavior of OPEN_DEFAULTWINDOW, and the 0x4 bit
* controls whether or not to set the window.opener property on the newly
* opened window.
*
* NOTE: The 0x2 bit is ignored for backwards compatibility with addons, as
* OPEN_NEW used to have the value 2. The values 0 and 2 are treated
* the same way internally.
*/
/**
* Internal open new window.
*/
const long OPEN_NEW = 0x0;
/**
* External link (load request from another application, xremote, etc).
*/
const long OPEN_EXTERNAL = 0x1;
/**
* Don't set the window.opener property on the window which is being opened.
*/
const long OPEN_NO_OPENER = 0x4;
/**
* Create the content window for the given URI.
* @param aURI the URI to be opened in the window (can be null).
* @param aWhere see possible values described above.
* @param aOpener window requesting the creation (can be null).
* @param aFlags flags which control the behavior of the load. The
* OPEN_EXTERNAL/OPEN_NEW flag is only used when
* aWhere == OPEN_DEFAULTWINDOW.
* @param aTriggeringPrincipal the principal that would trigger the potential
* load of aURI.
* @return the window into which the URI would have been opened.
*/
mozIDOMWindowProxy
createContentWindow(in nsIURI aURI, in mozIDOMWindowProxy aOpener,
in short aWhere, in long aFlags,
in nsIPrincipal aTriggeringPrincipal);
/**
* As above, but return the nsIFrameLoaderOwner for the new window.
*
* Additional Parameters:
* @param aNextTabParentId The TabParent to associate the window with.
* @param aName The name to give the window opened in the new tab.
* @return The nsIFrameLoaderOwner for the newly opened window.
*/
nsIFrameLoaderOwner
createContentWindowInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
in short aWhere, in long aFlags,
in unsigned long long aNextTabParentId,
in AString aName);
/**
* Load a URI.
* @param aURI the URI to open. null is not allowed. To create the window
* without loading the URI, use createContentWindow instead.
* @param aWhere see possible values described above.
* @param aOpener window requesting the open (can be null).
* @param aFlags flags which control the behavior of the load. The
* OPEN_EXTERNAL/OPEN_NEW flag is only used when
* aWhere == OPEN_DEFAULTWINDOW.
* @param aTriggeringPrincipal the principal that triggered the load of aURI.
* @return the window into which the URI was opened.
*/
mozIDOMWindowProxy
openURI(in nsIURI aURI, in mozIDOMWindowProxy aOpener,
in short aWhere, in long aFlags, in nsIPrincipal aTriggeringPrincipal);
/**
* As above, but return the nsIFrameLoaderOwner for the new window.
*
* Additional Parameters:
* @param aNextTabParentId The TabParent to associate the window with.
* @param aName The name to give the window opened in the new tab.
* @return The nsIFrameLoaderOwner for the newly opened window.
// XXXbz is this the right API?
// See bug 537428
*/
nsIFrameLoaderOwner
openURIInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
in short aWhere, in long aFlags,
in unsigned long long aNextTabParentId,
in AString aName);
/**
* @param aWindow the window to test.
* @return whether the window is the main content window for any
* currently open tab in this toplevel browser window.
*/
boolean isTabContentWindow(in nsIDOMWindow aWindow);
/**
* This function is responsible for calling
* nsIContentViewer::PermitUnload on each frame in the window. It
* returns true if closing the window is allowed. See canClose() in
* BrowserUtils.jsm for a simple implementation of this method.
*/
boolean canClose();
};