PageRenderTime 17ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

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