nsPIWindowWatcher.idl 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. /* Private "control" methods on the Window Watcher. These are annoying
  7. bookkeeping methods, not part of the public (embedding) interface.
  8. */
  9. #include "nsISupports.idl"
  10. interface mozIDOMWindowProxy;
  11. interface nsIDOMWindow;
  12. interface nsISimpleEnumerator;
  13. interface nsIWebBrowserChrome;
  14. interface nsIDocShellTreeItem;
  15. interface nsIArray;
  16. interface nsITabParent;
  17. interface nsIDocShellLoadInfo;
  18. [uuid(d162f9c4-19d5-4723-931f-f1e51bfa9f68)]
  19. interface nsPIWindowWatcher : nsISupports
  20. {
  21. /** A window has been created. Add it to our list.
  22. @param aWindow the window to add
  23. @param aChrome the corresponding chrome window. The DOM window
  24. and chrome will be mapped together, and the corresponding
  25. chrome can be retrieved using the (not private)
  26. method getChromeForWindow. If null, any extant mapping
  27. will be cleared.
  28. */
  29. void addWindow(in mozIDOMWindowProxy aWindow,
  30. in nsIWebBrowserChrome aChrome);
  31. /** A window has been closed. Remove it from our list.
  32. @param aWindow the window to remove
  33. */
  34. void removeWindow(in mozIDOMWindowProxy aWindow);
  35. /** Like the public interface's open(), but can handle openDialog-style
  36. arguments and calls which shouldn't result in us navigating the window.
  37. @param aParent parent window, if any. Null if no parent. If it is
  38. impossible to get to an nsIWebBrowserChrome from aParent, this
  39. method will effectively act as if aParent were null.
  40. @param aURL url to which to open the new window. Must already be
  41. escaped, if applicable. can be null.
  42. @param aName window name from JS window.open. can be null. If a window
  43. with this name already exists, the openWindow call may just load
  44. aUrl in it (if aUrl is not null) and return it.
  45. @param aFeatures window features from JS window.open. can be null.
  46. @param aCalledFromScript true if we were called from script.
  47. @param aDialog use dialog defaults (see nsIDOMWindow::openDialog)
  48. @param aNavigate true if we should navigate the new window to the
  49. specified URL.
  50. @param aArgs Window argument
  51. @param aIsPopupSpam true if the window is a popup spam window; used for
  52. popup blocker internals.
  53. @param aForceNoOpener If true, force noopener behavior. This means not
  54. looking for existing windows with the given name,
  55. not setting an opener on the newly opened window,
  56. and returning null from this method.
  57. @param aLoadInfo if aNavigate is true, this allows the caller to pass in
  58. an nsIDocShellLoadInfo to use for the navigation.
  59. Callers can pass in null if they want the windowwatcher
  60. to just construct a loadinfo itself. If aNavigate is
  61. false, this argument is ignored.
  62. @return the new window
  63. @note This method may examine the JS context stack for purposes of
  64. determining the security context to use for the search for a given
  65. window named aName.
  66. @note This method should try to set the default charset for the new
  67. window to the default charset of the document in the calling window
  68. (which is determined based on the JS stack and the value of
  69. aParent). This is not guaranteed, however.
  70. */
  71. mozIDOMWindowProxy openWindow2(in mozIDOMWindowProxy aParent, in string aUrl,
  72. in string aName, in string aFeatures,
  73. in boolean aCalledFromScript,
  74. in boolean aDialog,
  75. in boolean aNavigate,
  76. in nsISupports aArgs,
  77. in boolean aIsPopupSpam,
  78. in boolean aForceNoOpener,
  79. in nsIDocShellLoadInfo aLoadInfo);
  80. /**
  81. * Opens a new window using the most recent non-private browser
  82. * window as its parent.
  83. *
  84. * @return the nsITabParent of the initial browser for the newly opened
  85. * window.
  86. */
  87. nsITabParent openWindowWithoutParent();
  88. /**
  89. * Opens a new window so that the window that aOpeningTab belongs to
  90. * is set as the parent window. The newly opened window will also
  91. * inherit load context information from aOpeningTab.
  92. *
  93. * @param aOpeningTab
  94. * The nsITabParent that is requesting the new window be opened.
  95. * @param aFeatures
  96. * Window features if called with window.open or similar.
  97. * @param aCalledFromJS
  98. * True if called via window.open or similar.
  99. * @param aOpenerFullZoom
  100. * The current zoom multiplier for the opener tab. This is then
  101. * applied to the newly opened window.
  102. *
  103. * @return the nsITabParent of the initial browser for the newly opened
  104. * window.
  105. */
  106. nsITabParent openWindowWithTabParent(in nsITabParent aOpeningTab,
  107. in ACString aFeatures,
  108. in boolean aCalledFromJS,
  109. in float aOpenerFullZoom);
  110. /**
  111. * Find a named docshell tree item amongst all windows registered
  112. * with the window watcher. This may be a subframe in some window,
  113. * for example.
  114. *
  115. * @param aName the name of the window. Must not be null.
  116. * @param aRequestor the tree item immediately making the request.
  117. * We should make sure to not recurse down into its findItemWithName
  118. * method.
  119. * @param aOriginalRequestor the original treeitem that made the request.
  120. * Used for security checks.
  121. * @return the tree item with aName as the name, or null if there
  122. * isn't one. "Special" names, like _self, _top, etc, will be
  123. * treated specially only if aRequestor is null; in that case they
  124. * will be resolved relative to the first window the windowwatcher
  125. * knows about.
  126. * @see findItemWithName methods on nsIDocShellTreeItem and
  127. * nsIDocShellTreeOwner
  128. */
  129. nsIDocShellTreeItem findItemWithName(in AString aName,
  130. in nsIDocShellTreeItem aRequestor,
  131. in nsIDocShellTreeItem aOriginalRequestor);
  132. };