1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 2001
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 /* Private "control" methods on the Window Watcher. These are annoying
40 bookkeeping methods, not part of the public (embedding) interface.
41 */
42
43 #include "nsISupports.idl"
44
45 interface nsIDOMWindow;
46 interface nsISimpleEnumerator;
47 interface nsIWebBrowserChrome;
48 interface nsIDocShellTreeItem;
49 interface nsIArray;
50
51 %{C++
52 #include "jspubtd.h"
53 %}
54
55 [ptr] native jsvalptr(jsval);
56
57 [uuid(3aaad312-e09d-4010-a013-78ef653dac99)]
58
59 interface nsPIWindowWatcher : nsISupports
60 {
61 /** A window has been created. Add it to our list.
62 @param aWindow the window to add
63 @param aChrome the corresponding chrome window. The DOM window
64 and chrome will be mapped together, and the corresponding
65 chrome can be retrieved using the (not private)
66 method getChromeForWindow. If null, any extant mapping
67 will be cleared.
68 */
69 void addWindow(in nsIDOMWindow aWindow, in nsIWebBrowserChrome aChrome);
70
71 /** A window has been closed. Remove it from our list.
72 @param aWindow the window to remove
73 */
74 void removeWindow(in nsIDOMWindow aWindow);
75
76 /** Like the public interface's open(), but can deal with openDialog
77 style arguments.
78 @param aParent parent window, if any. Null if no parent. If it is
79 impossible to get to an nsIWebBrowserChrome from aParent, this
80 method will effectively act as if aParent were null.
81 @param aURL url to which to open the new window. Must already be
82 escaped, if applicable. can be null.
83 @param aName window name from JS window.open. can be null. If a window
84 with this name already exists, the openWindow call may just load
85 aUrl in it (if aUrl is not null) and return it.
86 @param aFeatures window features from JS window.open. can be null.
87 @param aDialog use dialog defaults (see nsIDOMWindowInternal::openDialog)
88 @param aArgs Window argument
89 @return the new window
90
91 @note This method may examine the JS context stack for purposes of
92 determining the security context to use for the search for a given
93 window named aName.
94 @note This method should try to set the default charset for the new
95 window to the default charset of the document in the calling window
96 (which is determined based on the JS stack and the value of
97 aParent). This is not guaranteed, however.
98 */
99 nsIDOMWindow openWindowJS(in nsIDOMWindow aParent, in string aUrl,
100 in string aName, in string aFeatures, in boolean aDialog,
101 in nsIArray aArgs);
102
103 /**
104 * Find a named docshell tree item amongst all windows registered
105 * with the window watcher. This may be a subframe in some window,
106 * for example.
107 *
108 * @param aName the name of the window. Must not be null.
109 * @param aRequestor the tree item immediately making the request.
110 * We should make sure to not recurse down into its findItemWithName
111 * method.
112 * @param aOriginalRequestor the original treeitem that made the request.
113 * Used for security checks.
114 * @return the tree item with aName as the name, or null if there
115 * isn't one. "Special" names, like _self, _top, etc, will be
116 * treated specially only if aRequestor is null; in that case they
117 * will be resolved relative to the first window the windowwatcher
118 * knows about.
119 * @see findItemWithName methods on nsIDocShellTreeItem and
120 * nsIDocShellTreeOwner
121 */
122 nsIDocShellTreeItem findItemWithName(in wstring aName,
123 in nsIDocShellTreeItem aRequestor,
124 in nsIDocShellTreeItem aOriginalRequestor);
125 };