PageRenderTime 205ms CodeModel.GetById 121ms app.highlight 9ms RepoModel.GetById 71ms app.codeStats 1ms

/gecko_api/include/nsIWindowWatcher.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 337 lines | 138 code | 51 blank | 148 comment | 0 complexity | 51fcd2d5d42afa9be9e903ad6d80ffd2 MD5 | raw file
  1/*
  2 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/embedding/components/windowwatcher/public/nsIWindowWatcher.idl
  3 */
  4
  5#ifndef __gen_nsIWindowWatcher_h__
  6#define __gen_nsIWindowWatcher_h__
  7
  8
  9#ifndef __gen_nsISupports_h__
 10#include "nsISupports.h"
 11#endif
 12
 13/* For IDL files that don't want to include root IDL files. */
 14#ifndef NS_NO_VTABLE
 15#define NS_NO_VTABLE
 16#endif
 17class nsIDOMWindow; /* forward declaration */
 18
 19class nsIObserver; /* forward declaration */
 20
 21class nsIPrompt; /* forward declaration */
 22
 23class nsIAuthPrompt; /* forward declaration */
 24
 25class nsISimpleEnumerator; /* forward declaration */
 26
 27class nsIWebBrowserChrome; /* forward declaration */
 28
 29class nsIWindowCreator; /* forward declaration */
 30
 31
 32/* starting interface:    nsIWindowWatcher */
 33#define NS_IWINDOWWATCHER_IID_STR "002286a8-494b-43b3-8ddd-49e3fc50622b"
 34
 35#define NS_IWINDOWWATCHER_IID \
 36  {0x002286a8, 0x494b, 0x43b3, \
 37    { 0x8d, 0xdd, 0x49, 0xe3, 0xfc, 0x50, 0x62, 0x2b }}
 38
 39/**
 40 * nsIWindowWatcher is the keeper of Gecko/DOM Windows. It maintains
 41 * a list of open top-level windows, and allows some operations on them.
 42
 43 * Usage notes:
 44
 45 *   This component has an |activeWindow| property. Clients may expect
 46 * this property to be always current, so to properly integrate this component
 47 * the application will need to keep it current by setting the property
 48 * as the active window changes.
 49 *   This component should not keep a (XPCOM) reference to any windows;
 50 * the implementation will claim no ownership. Windows must notify
 51 * this component when they are created or destroyed, so only a weak
 52 * reference is kept. Note that there is no interface for such notifications
 53 * (not a public one, anyway). This is taken care of both in Mozilla and
 54 * by common embedding code. Embedding clients need do nothing special
 55 * about that requirement.
 56 *   This component must be initialized at application startup by calling
 57 * setWindowCreator.
 58 *
 59 * @status FROZEN
 60 */
 61class NS_NO_VTABLE NS_SCRIPTABLE nsIWindowWatcher : public nsISupports {
 62 public: 
 63
 64  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWINDOWWATCHER_IID)
 65
 66  /** Create a new window. It will automatically be added to our list
 67      (via addWindow()).
 68      @param aParent parent window, if any. Null if no parent.  If it is
 69             impossible to get to an nsIWebBrowserChrome from aParent, this
 70             method will effectively act as if aParent were null.
 71      @param aURL url to which to open the new window. Must already be
 72             escaped, if applicable. can be null.
 73      @param aName window name from JS window.open. can be null.  If a window
 74             with this name already exists, the openWindow call may just load
 75             aUrl in it (if aUrl is not null) and return it.
 76      @param aFeatures window features from JS window.open. can be null.
 77      @param aArguments extra argument(s) to the new window, to be attached
 78             as the |arguments| property. An nsISupportsArray will be
 79             unwound into multiple arguments (but not recursively!).
 80             can be null.
 81      @return the new window
 82
 83      @note This method may examine the JS context stack for purposes of
 84            determining the security context to use for the search for a given
 85            window named aName.
 86      @note This method should try to set the default charset for the new
 87            window to the default charset of aParent.  This is not guaranteed,
 88            however.
 89      @note This method may dispatch a "toplevel-window-ready" notification
 90            via nsIObserverService if the window did not already exist.
 91  */
 92  /* nsIDOMWindow openWindow (in nsIDOMWindow aParent, in string aUrl, in string aName, in string aFeatures, in nsISupports aArguments); */
 93  NS_SCRIPTABLE NS_IMETHOD OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval) = 0;
 94
 95  /** Clients of this service can register themselves to be notified
 96      when a window is opened or closed (added to or removed from this
 97      service). This method adds an aObserver to the list of objects
 98      to be notified.
 99      @param aObserver the object to be notified when windows are
100                       opened or closed. Its Observe method will be
101                       called with the following parameters:
102
103      aObserver::Observe interprets its parameters so:
104      aSubject the window being opened or closed, sent as an nsISupports
105               which can be QIed to an nsIDOMWindow.
106      aTopic   a wstring, either "domwindowopened" or "domwindowclosed".
107      someData not used.
108  */
109  /* void registerNotification (in nsIObserver aObserver); */
110  NS_SCRIPTABLE NS_IMETHOD RegisterNotification(nsIObserver *aObserver) = 0;
111
112  /** Clients of this service can register themselves to be notified
113      when a window is opened or closed (added to or removed from this
114      service). This method removes an aObserver from the list of objects
115      to be notified.
116      @param aObserver the observer to be removed.
117  */
118  /* void unregisterNotification (in nsIObserver aObserver); */
119  NS_SCRIPTABLE NS_IMETHOD UnregisterNotification(nsIObserver *aObserver) = 0;
120
121  /** Get an iterator for currently open windows in the order they were opened,
122      guaranteeing that each will be visited exactly once.
123      @return an enumerator which will itself return nsISupports objects which
124              can be QIed to an nsIDOMWindow
125  */
126  /* nsISimpleEnumerator getWindowEnumerator (); */
127  NS_SCRIPTABLE NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval) = 0;
128
129  /** Return a newly created nsIPrompt implementation.
130      @param aParent the parent window used for posing alerts. can be null.
131      @return a new nsIPrompt object
132  */
133  /* nsIPrompt getNewPrompter (in nsIDOMWindow aParent); */
134  NS_SCRIPTABLE NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval) = 0;
135
136  /** Return a newly created nsIAuthPrompt implementation.
137      @param aParent the parent window used for posing alerts. can be null.
138      @return a new nsIAuthPrompt object
139  */
140  /* nsIAuthPrompt getNewAuthPrompter (in nsIDOMWindow aParent); */
141  NS_SCRIPTABLE NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval) = 0;
142
143  /** Set the window creator callback. It must be filled in by the app.
144      openWindow will use it to create new windows.
145      @param creator the callback. if null, the callback will be cleared
146                     and window creation capabilities lost.
147  */
148  /* void setWindowCreator (in nsIWindowCreator creator); */
149  NS_SCRIPTABLE NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator) = 0;
150
151  /** Retrieve the chrome window mapped to the given DOM window. Window
152      Watcher keeps a list of all top-level DOM windows currently open,
153      along with their corresponding chrome interfaces. Since DOM Windows
154      lack a (public) means of retrieving their corresponding chrome,
155      this method will do that.
156      @param aWindow the DOM window whose chrome window the caller needs
157      @return the corresponding chrome window
158  */
159  /* nsIWebBrowserChrome getChromeForWindow (in nsIDOMWindow aWindow); */
160  NS_SCRIPTABLE NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval) = 0;
161
162  /**
163      Retrieve an existing window (or frame).
164      @param aTargetName the window name
165      @param aCurrentWindow a starting point in the window hierarchy to
166                            begin the search.  If null, each toplevel window
167                            will be searched.
168
169      Note: This method will search all open windows for any window or
170      frame with the given window name. Make sure you understand the
171      security implications of this before using this method!
172  */
173  /* nsIDOMWindow getWindowByName (in wstring aTargetName, in nsIDOMWindow aCurrentWindow); */
174  NS_SCRIPTABLE NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval) = 0;
175
176  /** The Watcher serves as a global storage facility for the current active
177      (frontmost non-floating-palette-type) window, storing and returning
178      it on demand. Users must keep this attribute current, including after
179      the topmost window is closed. This attribute obviously can return null
180      if no windows are open, but should otherwise always return a valid
181      window.
182  */
183  /* attribute nsIDOMWindow activeWindow; */
184  NS_SCRIPTABLE NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow) = 0;
185  NS_SCRIPTABLE NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow) = 0;
186
187};
188
189  NS_DEFINE_STATIC_IID_ACCESSOR(nsIWindowWatcher, NS_IWINDOWWATCHER_IID)
190
191/* Use this macro when declaring classes that implement this interface. */
192#define NS_DECL_NSIWINDOWWATCHER \
193  NS_SCRIPTABLE NS_IMETHOD OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval); \
194  NS_SCRIPTABLE NS_IMETHOD RegisterNotification(nsIObserver *aObserver); \
195  NS_SCRIPTABLE NS_IMETHOD UnregisterNotification(nsIObserver *aObserver); \
196  NS_SCRIPTABLE NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval); \
197  NS_SCRIPTABLE NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval); \
198  NS_SCRIPTABLE NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval); \
199  NS_SCRIPTABLE NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator); \
200  NS_SCRIPTABLE NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval); \
201  NS_SCRIPTABLE NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval); \
202  NS_SCRIPTABLE NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow); \
203  NS_SCRIPTABLE NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow); 
204
205/* Use this macro to declare functions that forward the behavior of this interface to another object. */
206#define NS_FORWARD_NSIWINDOWWATCHER(_to) \
207  NS_SCRIPTABLE NS_IMETHOD OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval) { return _to OpenWindow(aParent, aUrl, aName, aFeatures, aArguments, _retval); } \
208  NS_SCRIPTABLE NS_IMETHOD RegisterNotification(nsIObserver *aObserver) { return _to RegisterNotification(aObserver); } \
209  NS_SCRIPTABLE NS_IMETHOD UnregisterNotification(nsIObserver *aObserver) { return _to UnregisterNotification(aObserver); } \
210  NS_SCRIPTABLE NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval) { return _to GetWindowEnumerator(_retval); } \
211  NS_SCRIPTABLE NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval) { return _to GetNewPrompter(aParent, _retval); } \
212  NS_SCRIPTABLE NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval) { return _to GetNewAuthPrompter(aParent, _retval); } \
213  NS_SCRIPTABLE NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator) { return _to SetWindowCreator(creator); } \
214  NS_SCRIPTABLE NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval) { return _to GetChromeForWindow(aWindow, _retval); } \
215  NS_SCRIPTABLE NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval) { return _to GetWindowByName(aTargetName, aCurrentWindow, _retval); } \
216  NS_SCRIPTABLE NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow) { return _to GetActiveWindow(aActiveWindow); } \
217  NS_SCRIPTABLE NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow) { return _to SetActiveWindow(aActiveWindow); } 
218
219/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
220#define NS_FORWARD_SAFE_NSIWINDOWWATCHER(_to) \
221  NS_SCRIPTABLE NS_IMETHOD OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->OpenWindow(aParent, aUrl, aName, aFeatures, aArguments, _retval); } \
222  NS_SCRIPTABLE NS_IMETHOD RegisterNotification(nsIObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterNotification(aObserver); } \
223  NS_SCRIPTABLE NS_IMETHOD UnregisterNotification(nsIObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterNotification(aObserver); } \
224  NS_SCRIPTABLE NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowEnumerator(_retval); } \
225  NS_SCRIPTABLE NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNewPrompter(aParent, _retval); } \
226  NS_SCRIPTABLE NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNewAuthPrompter(aParent, _retval); } \
227  NS_SCRIPTABLE NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetWindowCreator(creator); } \
228  NS_SCRIPTABLE NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetChromeForWindow(aWindow, _retval); } \
229  NS_SCRIPTABLE NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowByName(aTargetName, aCurrentWindow, _retval); } \
230  NS_SCRIPTABLE NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetActiveWindow(aActiveWindow); } \
231  NS_SCRIPTABLE NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetActiveWindow(aActiveWindow); } 
232
233#if 0
234/* Use the code below as a template for the implementation class for this interface. */
235
236/* Header file */
237class nsWindowWatcher : public nsIWindowWatcher
238{
239public:
240  NS_DECL_ISUPPORTS
241  NS_DECL_NSIWINDOWWATCHER
242
243  nsWindowWatcher();
244
245private:
246  ~nsWindowWatcher();
247
248protected:
249  /* additional members */
250};
251
252/* Implementation file */
253NS_IMPL_ISUPPORTS1(nsWindowWatcher, nsIWindowWatcher)
254
255nsWindowWatcher::nsWindowWatcher()
256{
257  /* member initializers and constructor code */
258}
259
260nsWindowWatcher::~nsWindowWatcher()
261{
262  /* destructor code */
263}
264
265/* nsIDOMWindow openWindow (in nsIDOMWindow aParent, in string aUrl, in string aName, in string aFeatures, in nsISupports aArguments); */
266NS_IMETHODIMP nsWindowWatcher::OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval)
267{
268    return NS_ERROR_NOT_IMPLEMENTED;
269}
270
271/* void registerNotification (in nsIObserver aObserver); */
272NS_IMETHODIMP nsWindowWatcher::RegisterNotification(nsIObserver *aObserver)
273{
274    return NS_ERROR_NOT_IMPLEMENTED;
275}
276
277/* void unregisterNotification (in nsIObserver aObserver); */
278NS_IMETHODIMP nsWindowWatcher::UnregisterNotification(nsIObserver *aObserver)
279{
280    return NS_ERROR_NOT_IMPLEMENTED;
281}
282
283/* nsISimpleEnumerator getWindowEnumerator (); */
284NS_IMETHODIMP nsWindowWatcher::GetWindowEnumerator(nsISimpleEnumerator **_retval)
285{
286    return NS_ERROR_NOT_IMPLEMENTED;
287}
288
289/* nsIPrompt getNewPrompter (in nsIDOMWindow aParent); */
290NS_IMETHODIMP nsWindowWatcher::GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval)
291{
292    return NS_ERROR_NOT_IMPLEMENTED;
293}
294
295/* nsIAuthPrompt getNewAuthPrompter (in nsIDOMWindow aParent); */
296NS_IMETHODIMP nsWindowWatcher::GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval)
297{
298    return NS_ERROR_NOT_IMPLEMENTED;
299}
300
301/* void setWindowCreator (in nsIWindowCreator creator); */
302NS_IMETHODIMP nsWindowWatcher::SetWindowCreator(nsIWindowCreator *creator)
303{
304    return NS_ERROR_NOT_IMPLEMENTED;
305}
306
307/* nsIWebBrowserChrome getChromeForWindow (in nsIDOMWindow aWindow); */
308NS_IMETHODIMP nsWindowWatcher::GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval)
309{
310    return NS_ERROR_NOT_IMPLEMENTED;
311}
312
313/* nsIDOMWindow getWindowByName (in wstring aTargetName, in nsIDOMWindow aCurrentWindow); */
314NS_IMETHODIMP nsWindowWatcher::GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval)
315{
316    return NS_ERROR_NOT_IMPLEMENTED;
317}
318
319/* attribute nsIDOMWindow activeWindow; */
320NS_IMETHODIMP nsWindowWatcher::GetActiveWindow(nsIDOMWindow * *aActiveWindow)
321{
322    return NS_ERROR_NOT_IMPLEMENTED;
323}
324NS_IMETHODIMP nsWindowWatcher::SetActiveWindow(nsIDOMWindow * aActiveWindow)
325{
326    return NS_ERROR_NOT_IMPLEMENTED;
327}
328
329/* End of implementation class template. */
330#endif
331
332// {002286a8-494b-43b3-8ddd-49e3fc50622b}
333#define NS_WINDOWWATCHER_IID \
334 {0x002286a8, 0x494b, 0x43b3, {0x8d, 0xdd, 0x49, 0xe3, 0xfc, 0x50, 0x62, 0x2b}}
335#define NS_WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"
336
337#endif /* __gen_nsIWindowWatcher_h__ */