Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIDOMWindow; |
michael@0 | 9 | interface nsIURI; |
michael@0 | 10 | interface nsIFrameLoaderOwner; |
michael@0 | 11 | |
michael@0 | 12 | [scriptable, uuid(e420bd32-b8c4-4b47-8cca-09e0bddbb0c3)] |
michael@0 | 13 | |
michael@0 | 14 | /** |
michael@0 | 15 | * The C++ source has access to the browser script source through |
michael@0 | 16 | * nsIBrowserDOMWindow. It is intended to be attached to the chrome DOMWindow |
michael@0 | 17 | * of a toplevel browser window (a XUL window). A DOMWindow that does not |
michael@0 | 18 | * happen to be a browser chrome window will simply have no access to any such |
michael@0 | 19 | * interface. |
michael@0 | 20 | */ |
michael@0 | 21 | interface nsIBrowserDOMWindow : nsISupports |
michael@0 | 22 | { |
michael@0 | 23 | /** |
michael@0 | 24 | * Values for openURI's aWhere parameter. |
michael@0 | 25 | */ |
michael@0 | 26 | /** |
michael@0 | 27 | * Do whatever the default is based on application state, user preferences, |
michael@0 | 28 | * and the value of the aContext parameter to openURI. |
michael@0 | 29 | */ |
michael@0 | 30 | const short OPEN_DEFAULTWINDOW = 0; |
michael@0 | 31 | /** |
michael@0 | 32 | * Open in the "current window". If aOpener is provided, this should be the |
michael@0 | 33 | * top window in aOpener's window hierarchy, but exact behavior is |
michael@0 | 34 | * application-dependent. If aOpener is not provided, it's up to the |
michael@0 | 35 | * application to decide what constitutes a "current window". |
michael@0 | 36 | */ |
michael@0 | 37 | const short OPEN_CURRENTWINDOW = 1; |
michael@0 | 38 | /** |
michael@0 | 39 | * Open in a new window. |
michael@0 | 40 | */ |
michael@0 | 41 | const short OPEN_NEWWINDOW = 2; |
michael@0 | 42 | /** |
michael@0 | 43 | * Open in a new content tab in the toplevel browser window corresponding to |
michael@0 | 44 | * this nsIBrowserDOMWindow. |
michael@0 | 45 | */ |
michael@0 | 46 | const short OPEN_NEWTAB = 3; |
michael@0 | 47 | /** |
michael@0 | 48 | * Open in an existing content tab based on the URI. If a match can't be |
michael@0 | 49 | * found, revert to OPEN_NEWTAB behavior. |
michael@0 | 50 | */ |
michael@0 | 51 | const short OPEN_SWITCHTAB = 4; |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Values for openURI's aContext parameter. These affect the behavior of |
michael@0 | 55 | * OPEN_DEFAULTWINDOW. |
michael@0 | 56 | */ |
michael@0 | 57 | /** |
michael@0 | 58 | * external link (load request from another application, xremote, etc). |
michael@0 | 59 | */ |
michael@0 | 60 | const short OPEN_EXTERNAL = 1; |
michael@0 | 61 | /** |
michael@0 | 62 | * internal open new window |
michael@0 | 63 | */ |
michael@0 | 64 | const short OPEN_NEW = 2; |
michael@0 | 65 | |
michael@0 | 66 | /** |
michael@0 | 67 | * Load a URI |
michael@0 | 68 | |
michael@0 | 69 | * @param aURI the URI to open. null is allowed. If null is passed in, no |
michael@0 | 70 | * load will be done, though the window the load would have |
michael@0 | 71 | * happened in will be returned. |
michael@0 | 72 | * @param aWhere see possible values described above. |
michael@0 | 73 | * @param aOpener window requesting the open (can be null). |
michael@0 | 74 | * @param aContext the context in which the URI is being opened. This |
michael@0 | 75 | * is used only when aWhere == OPEN_DEFAULTWINDOW. |
michael@0 | 76 | * @return the window into which the URI was opened. |
michael@0 | 77 | */ |
michael@0 | 78 | nsIDOMWindow openURI(in nsIURI aURI, in nsIDOMWindow aOpener, |
michael@0 | 79 | in short aWhere, in short aContext); |
michael@0 | 80 | |
michael@0 | 81 | /** |
michael@0 | 82 | * As above, but return the nsIFrameLoaderOwner for the new window. |
michael@0 | 83 | // XXXbz is this the right API? Do we really need the opener here? |
michael@0 | 84 | // See bug 537428 |
michael@0 | 85 | */ |
michael@0 | 86 | nsIFrameLoaderOwner openURIInFrame(in nsIURI aURI, in nsIDOMWindow aOpener, |
michael@0 | 87 | in short aWhere, in short aContext); |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * @param aWindow the window to test. |
michael@0 | 91 | * @return whether the window is the main content window for any |
michael@0 | 92 | * currently open tab in this toplevel browser window. |
michael@0 | 93 | */ |
michael@0 | 94 | boolean isTabContentWindow(in nsIDOMWindow aWindow); |
michael@0 | 95 | |
michael@0 | 96 | /** |
michael@0 | 97 | * The contentWindow property of the currently selected browser. |
michael@0 | 98 | * This is used to implement .content in remote-Firefox. |
michael@0 | 99 | */ |
michael@0 | 100 | |
michael@0 | 101 | readonly attribute jsval contentWindow; |
michael@0 | 102 | }; |
michael@0 | 103 |