1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla.org code.
17 * The Initial Developer of the Original Code is Mozilla.com.
18 * Portions created by the Initial Developer are Copyright (C) 2006
19 * the Initial Developer. All Rights Reserved.
22 * Boris Zbarsky <bzbarsky@mit.edu> (Original Author)
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 * nsIWindowProvider is a callback interface used by Gecko when it needs to
40 * open a new window. This interface can be implemented by Gecko consumers who
41 * wish to provide a custom "new window" of their own (for example by returning
42 * a new tab, an existing window, etc) instead of just having a real new
43 * toplevel window open.
45 * @status UNDER_REVIEW
48 #include
"nsISupports.idl"
50 interface nsIDOMWindow
;
54 * The nsIWindowProvider interface exists so that the window watcher's default
55 * behavior of opening a new window can be easly modified. When the window
56 * watcher needs to open a new window, it will first check with the
57 * nsIWindowProvider it gets from the parent window. If there is no provider
58 * or the provider does not provide a window, the window watcher will proceed
59 * to actually open a new window.
61 [scriptable
, uuid(5119ac7f
-81dd
-4061-96a7
-71f2cf5efee4
)]
62 interface nsIWindowProvider
: nsISupports
65 * A method to request that this provider provide a window. The window
66 * returned need not to have the right name or parent set on it; setting
67 * those is the caller's responsibility. The provider can always return null
68 * to have the caller create a brand-new window.
70 * @param aParent Must not be null. This is the window that the caller wants
71 * to use as the parent for the new window. Generally,
72 * nsIWindowProvider implementors can expect to be somehow
73 * related to aParent; the relationship may depend on the
74 * nsIWindowProvider implementation.
75 * @param aChromeFlags The chrome flags the caller will use to create a new
76 * window if this provider returns null. See
77 * nsIWebBrowserChrome for the possible values of this
79 * @param aPositionSpecified Whether the attempt to create a window is trying
80 * to specify a position for the new window.
81 * @param aSizeSpecified Whether the attempt to create a window is trying to
82 * specify a size for the new window.
83 * @param aURI The URI to be loaded in the new window. The nsIWindowProvider
84 * implementation MUST NOT load this URI in the window it
85 * returns. This URI is provided solely to help the
86 * nsIWindowProvider implenentation make decisions; the caller
87 * will handle loading the URI in the window returned if
88 * provideWindow returns a window. Note that the URI may be null
89 * if the load cannot be represented by a single URI (e.g. if
90 * the load has extra load flags, POST data, etc).
91 * @param aName The name of the window being opened. Setting the name on the
92 * return value of provideWindow will be handled by the caller;
93 * aName is provided solely to help the nsIWindowProvider
94 * implementation make decisions.
95 * @param aFeatures The feature string for the window being opened. This may
96 * be empty. The nsIWindowProvider implementation is
97 * allowed to apply the feature string to the window it
98 * returns in any way it sees fit. See the nsIWindowWatcher
99 * interface for details on feature strings.
100 * @param aWindowIsNew [out] Whether the window being returned was just
101 * created by the window provider implementation.
102 * This can be used by callers to keep track of which
103 * windows were opened by the user as opposed to
104 * being opened programmatically. This should be set
105 * to false if the window being returned existed
106 * before the provideWindow() call. The value of this
107 * out parameter is meaningless if provideWindow()
109 * @return A window the caller should use or null if the caller should just
110 * create a new window. The returned window may be newly opened by
111 * the nsIWindowProvider implementation or may be a window that
114 * @see nsIWindowWatcher for more information on aFeatures.
115 * @see nsIWebBrowserChrome for more information on aChromeFlags.
117 nsIDOMWindow provideWindow
(in nsIDOMWindow aParent
,
118 in unsigned long aChromeFlags
,
119 in boolean aPositionSpecified
,
120 in boolean aSizeSpecified
,
123 in AUTF8String aFeatures
,
124 out boolean aWindowIsNew
);