nsIWindowWatcher.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/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. class NS_NO_VTABLE nsIWindowWatcher : public nsISupports {
  26. public:
  27. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWINDOWWATCHER_IID)
  28. /** Create a new window. It will automatically be added to our list
  29. (via addWindow()).
  30. @param aParent parent window, if any. Null if no parent. If it is
  31. impossible to get to an nsIWebBrowserChrome from aParent, this
  32. method will effectively act as if aParent were null.
  33. @param aURL url to which to open the new window. Must already be
  34. escaped, if applicable. can be null.
  35. @param aName window name from JS window.open. can be null.
  36. @param aFeatures window features from JS window.open. can be null.
  37. @param aArguments extra argument(s) to the new window, to be attached
  38. as the |arguments| property. An nsISupportsArray will be
  39. unwound into multiple arguments (but not recursively!).
  40. can be null.
  41. @return the new window
  42. */
  43. /* nsIDOMWindow openWindow (in nsIDOMWindow aParent, in string aUrl, in string aName, in string aFeatures, in nsISupports aArguments); */
  44. NS_IMETHOD OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval) = 0;
  45. /** Clients of this service can register themselves to be notified
  46. when a window is opened or closed (added to or removed from this
  47. service). This method adds an aObserver to the list of objects
  48. to be notified.
  49. @param aObserver the object to be notified when windows are
  50. opened or closed. Its Observe method will be
  51. called with the following parameters:
  52. aObserver::Observe interprets its parameters so:
  53. aSubject the window being opened or closed, sent as an nsISupports
  54. which can be QIed to an nsIDOMWindow.
  55. aTopic a wstring, either "domwindowopened" or "domwindowclosed".
  56. someData not used.
  57. */
  58. /* void registerNotification (in nsIObserver aObserver); */
  59. NS_IMETHOD RegisterNotification(nsIObserver *aObserver) = 0;
  60. /** Clients of this service can register themselves to be notified
  61. when a window is opened or closed (added to or removed from this
  62. service). This method removes an aObserver from the list of objects
  63. to be notified.
  64. @param aObserver the observer to be removed.
  65. */
  66. /* void unregisterNotification (in nsIObserver aObserver); */
  67. NS_IMETHOD UnregisterNotification(nsIObserver *aObserver) = 0;
  68. /** Get an iterator for currently open windows in the order they were opened,
  69. guaranteeing that each will be visited exactly once.
  70. @return an enumerator which will itself return nsISupports objects which
  71. can be QIed to an nsIDOMWindow
  72. */
  73. /* nsISimpleEnumerator getWindowEnumerator (); */
  74. NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval) = 0;
  75. /** Return a newly created nsIPrompt implementation.
  76. @param aParent the parent window used for posing alerts. can be null.
  77. @return a new nsIPrompt object
  78. */
  79. /* nsIPrompt getNewPrompter (in nsIDOMWindow aParent); */
  80. NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval) = 0;
  81. /** Return a newly created nsIAuthPrompt implementation.
  82. @param aParent the parent window used for posing alerts. can be null.
  83. @return a new nsIAuthPrompt object
  84. */
  85. /* nsIAuthPrompt getNewAuthPrompter (in nsIDOMWindow aParent); */
  86. NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval) = 0;
  87. /** Set the window creator callback. It must be filled in by the app.
  88. openWindow will use it to create new windows.
  89. @param creator the callback. if null, the callback will be cleared
  90. and window creation capabilities lost.
  91. */
  92. /* void setWindowCreator (in nsIWindowCreator creator); */
  93. NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator) = 0;
  94. /** Retrieve the chrome window mapped to the given DOM window. Window
  95. Watcher keeps a list of all top-level DOM windows currently open,
  96. along with their corresponding chrome interfaces. Since DOM Windows
  97. lack a (public) means of retrieving their corresponding chrome,
  98. this method will do that.
  99. @param aWindow the DOM window whose chrome window the caller needs
  100. @return the corresponding chrome window
  101. */
  102. /* nsIWebBrowserChrome getChromeForWindow (in nsIDOMWindow aWindow); */
  103. NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval) = 0;
  104. /**
  105. Retrieve an existing window (or frame).
  106. @param aTargetName the window name
  107. @param aCurrentWindow a starting point in the window hierarchy to
  108. begin the search. If null, each toplevel window
  109. will be searched.
  110. Note: This method will search all open windows for any window or
  111. frame with the given window name. Make sure you understand the
  112. security implications of this before using this method!
  113. */
  114. /* nsIDOMWindow getWindowByName (in wstring aTargetName, in nsIDOMWindow aCurrentWindow); */
  115. NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval) = 0;
  116. /** The Watcher serves as a global storage facility for the current active
  117. (frontmost non-floating-palette-type) window, storing and returning
  118. it on demand. Users must keep this attribute current, including after
  119. the topmost window is closed. This attribute obviously can return null
  120. if no windows are open, but should otherwise always return a valid
  121. window.
  122. */
  123. /* attribute nsIDOMWindow activeWindow; */
  124. NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow) = 0;
  125. NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow) = 0;
  126. };
  127. /* Use this macro when declaring classes that implement this interface. */
  128. #define NS_DECL_NSIWINDOWWATCHER \
  129. NS_IMETHOD OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval); \
  130. NS_IMETHOD RegisterNotification(nsIObserver *aObserver); \
  131. NS_IMETHOD UnregisterNotification(nsIObserver *aObserver); \
  132. NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval); \
  133. NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval); \
  134. NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval); \
  135. NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator); \
  136. NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval); \
  137. NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval); \
  138. NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow); \
  139. NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow);
  140. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  141. #define NS_FORWARD_NSIWINDOWWATCHER(_to) \
  142. 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); } \
  143. NS_IMETHOD RegisterNotification(nsIObserver *aObserver) { return _to RegisterNotification(aObserver); } \
  144. NS_IMETHOD UnregisterNotification(nsIObserver *aObserver) { return _to UnregisterNotification(aObserver); } \
  145. NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval) { return _to GetWindowEnumerator(_retval); } \
  146. NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval) { return _to GetNewPrompter(aParent, _retval); } \
  147. NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval) { return _to GetNewAuthPrompter(aParent, _retval); } \
  148. NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator) { return _to SetWindowCreator(creator); } \
  149. NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval) { return _to GetChromeForWindow(aWindow, _retval); } \
  150. NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval) { return _to GetWindowByName(aTargetName, aCurrentWindow, _retval); } \
  151. NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow) { return _to GetActiveWindow(aActiveWindow); } \
  152. NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow) { return _to SetActiveWindow(aActiveWindow); }
  153. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  154. #define NS_FORWARD_SAFE_NSIWINDOWWATCHER(_to) \
  155. 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); } \
  156. NS_IMETHOD RegisterNotification(nsIObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterNotification(aObserver); } \
  157. NS_IMETHOD UnregisterNotification(nsIObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterNotification(aObserver); } \
  158. NS_IMETHOD GetWindowEnumerator(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowEnumerator(_retval); } \
  159. NS_IMETHOD GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNewPrompter(aParent, _retval); } \
  160. NS_IMETHOD GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNewAuthPrompter(aParent, _retval); } \
  161. NS_IMETHOD SetWindowCreator(nsIWindowCreator *creator) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetWindowCreator(creator); } \
  162. NS_IMETHOD GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetChromeForWindow(aWindow, _retval); } \
  163. NS_IMETHOD GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowByName(aTargetName, aCurrentWindow, _retval); } \
  164. NS_IMETHOD GetActiveWindow(nsIDOMWindow * *aActiveWindow) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetActiveWindow(aActiveWindow); } \
  165. NS_IMETHOD SetActiveWindow(nsIDOMWindow * aActiveWindow) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetActiveWindow(aActiveWindow); }
  166. #if 0
  167. /* Use the code below as a template for the implementation class for this interface. */
  168. /* Header file */
  169. class nsWindowWatcher : public nsIWindowWatcher
  170. {
  171. public:
  172. NS_DECL_ISUPPORTS
  173. NS_DECL_NSIWINDOWWATCHER
  174. nsWindowWatcher();
  175. private:
  176. ~nsWindowWatcher();
  177. protected:
  178. /* additional members */
  179. };
  180. /* Implementation file */
  181. NS_IMPL_ISUPPORTS1(nsWindowWatcher, nsIWindowWatcher)
  182. nsWindowWatcher::nsWindowWatcher()
  183. {
  184. /* member initializers and constructor code */
  185. }
  186. nsWindowWatcher::~nsWindowWatcher()
  187. {
  188. /* destructor code */
  189. }
  190. /* nsIDOMWindow openWindow (in nsIDOMWindow aParent, in string aUrl, in string aName, in string aFeatures, in nsISupports aArguments); */
  191. NS_IMETHODIMP nsWindowWatcher::OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval)
  192. {
  193. return NS_ERROR_NOT_IMPLEMENTED;
  194. }
  195. /* void registerNotification (in nsIObserver aObserver); */
  196. NS_IMETHODIMP nsWindowWatcher::RegisterNotification(nsIObserver *aObserver)
  197. {
  198. return NS_ERROR_NOT_IMPLEMENTED;
  199. }
  200. /* void unregisterNotification (in nsIObserver aObserver); */
  201. NS_IMETHODIMP nsWindowWatcher::UnregisterNotification(nsIObserver *aObserver)
  202. {
  203. return NS_ERROR_NOT_IMPLEMENTED;
  204. }
  205. /* nsISimpleEnumerator getWindowEnumerator (); */
  206. NS_IMETHODIMP nsWindowWatcher::GetWindowEnumerator(nsISimpleEnumerator **_retval)
  207. {
  208. return NS_ERROR_NOT_IMPLEMENTED;
  209. }
  210. /* nsIPrompt getNewPrompter (in nsIDOMWindow aParent); */
  211. NS_IMETHODIMP nsWindowWatcher::GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval)
  212. {
  213. return NS_ERROR_NOT_IMPLEMENTED;
  214. }
  215. /* nsIAuthPrompt getNewAuthPrompter (in nsIDOMWindow aParent); */
  216. NS_IMETHODIMP nsWindowWatcher::GetNewAuthPrompter(nsIDOMWindow *aParent, nsIAuthPrompt **_retval)
  217. {
  218. return NS_ERROR_NOT_IMPLEMENTED;
  219. }
  220. /* void setWindowCreator (in nsIWindowCreator creator); */
  221. NS_IMETHODIMP nsWindowWatcher::SetWindowCreator(nsIWindowCreator *creator)
  222. {
  223. return NS_ERROR_NOT_IMPLEMENTED;
  224. }
  225. /* nsIWebBrowserChrome getChromeForWindow (in nsIDOMWindow aWindow); */
  226. NS_IMETHODIMP nsWindowWatcher::GetChromeForWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome **_retval)
  227. {
  228. return NS_ERROR_NOT_IMPLEMENTED;
  229. }
  230. /* nsIDOMWindow getWindowByName (in wstring aTargetName, in nsIDOMWindow aCurrentWindow); */
  231. NS_IMETHODIMP nsWindowWatcher::GetWindowByName(const PRUnichar *aTargetName, nsIDOMWindow *aCurrentWindow, nsIDOMWindow **_retval)
  232. {
  233. return NS_ERROR_NOT_IMPLEMENTED;
  234. }
  235. /* attribute nsIDOMWindow activeWindow; */
  236. NS_IMETHODIMP nsWindowWatcher::GetActiveWindow(nsIDOMWindow * *aActiveWindow)
  237. {
  238. return NS_ERROR_NOT_IMPLEMENTED;
  239. }
  240. NS_IMETHODIMP nsWindowWatcher::SetActiveWindow(nsIDOMWindow * aActiveWindow)
  241. {
  242. return NS_ERROR_NOT_IMPLEMENTED;
  243. }
  244. /* End of implementation class template. */
  245. #endif
  246. // {002286a8-494b-43b3-8ddd-49e3fc50622b}
  247. #define NS_WINDOWWATCHER_IID \
  248. {0x002286a8, 0x494b, 0x43b3, {0x8d, 0xdd, 0x49, 0xe3, 0xfc, 0x50, 0x62, 0x2b}}
  249. #define NS_WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"
  250. #endif /* __gen_nsIWindowWatcher_h__ */