/embedding/base/nsIWindowProvider.idl

http://github.com/zpao/v8monkey · IDL · 124 lines · 16 code · 4 blank · 104 comment · 0 complexity · 8e94c38e84b57bddfc7a0e5cda16ba2c MD5 · raw file

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is Mozilla.com.
  18. * Portions created by the Initial Developer are Copyright (C) 2006
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. * Boris Zbarsky <bzbarsky@mit.edu> (Original Author)
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /**
  38. * nsIWindowProvider is a callback interface used by Gecko when it needs to
  39. * open a new window. This interface can be implemented by Gecko consumers who
  40. * wish to provide a custom "new window" of their own (for example by returning
  41. * a new tab, an existing window, etc) instead of just having a real new
  42. * toplevel window open.
  43. */
  44. #include "nsISupports.idl"
  45. interface nsIDOMWindow;
  46. interface nsIURI;
  47. /**
  48. * The nsIWindowProvider interface exists so that the window watcher's default
  49. * behavior of opening a new window can be easly modified. When the window
  50. * watcher needs to open a new window, it will first check with the
  51. * nsIWindowProvider it gets from the parent window. If there is no provider
  52. * or the provider does not provide a window, the window watcher will proceed
  53. * to actually open a new window.
  54. */
  55. [scriptable, uuid(f607bd66-08e5-4d2e-ad83-9f9f3ca17658)]
  56. interface nsIWindowProvider : nsISupports
  57. {
  58. /**
  59. * A method to request that this provider provide a window. The window
  60. * returned need not to have the right name or parent set on it; setting
  61. * those is the caller's responsibility. The provider can always return null
  62. * to have the caller create a brand-new window.
  63. *
  64. * @param aParent Must not be null. This is the window that the caller wants
  65. * to use as the parent for the new window. Generally,
  66. * nsIWindowProvider implementors can expect to be somehow
  67. * related to aParent; the relationship may depend on the
  68. * nsIWindowProvider implementation.
  69. * @param aChromeFlags The chrome flags the caller will use to create a new
  70. * window if this provider returns null. See
  71. * nsIWebBrowserChrome for the possible values of this
  72. * field.
  73. * @param aPositionSpecified Whether the attempt to create a window is trying
  74. * to specify a position for the new window.
  75. * @param aSizeSpecified Whether the attempt to create a window is trying to
  76. * specify a size for the new window.
  77. * @param aURI The URI to be loaded in the new window. The nsIWindowProvider
  78. * implementation MUST NOT load this URI in the window it
  79. * returns. This URI is provided solely to help the
  80. * nsIWindowProvider implementation make decisions; the caller
  81. * will handle loading the URI in the window returned if
  82. * provideWindow returns a window. Note that the URI may be null
  83. * if the load cannot be represented by a single URI (e.g. if
  84. * the load has extra load flags, POST data, etc).
  85. * @param aName The name of the window being opened. Setting the name on the
  86. * return value of provideWindow will be handled by the caller;
  87. * aName is provided solely to help the nsIWindowProvider
  88. * implementation make decisions.
  89. * @param aFeatures The feature string for the window being opened. This may
  90. * be empty. The nsIWindowProvider implementation is
  91. * allowed to apply the feature string to the window it
  92. * returns in any way it sees fit. See the nsIWindowWatcher
  93. * interface for details on feature strings.
  94. * @param aWindowIsNew [out] Whether the window being returned was just
  95. * created by the window provider implementation.
  96. * This can be used by callers to keep track of which
  97. * windows were opened by the user as opposed to
  98. * being opened programmatically. This should be set
  99. * to false if the window being returned existed
  100. * before the provideWindow() call. The value of this
  101. * out parameter is meaningless if provideWindow()
  102. * returns null.
  103. * @return A window the caller should use or null if the caller should just
  104. * create a new window. The returned window may be newly opened by
  105. * the nsIWindowProvider implementation or may be a window that
  106. * already existed.
  107. *
  108. * @see nsIWindowWatcher for more information on aFeatures.
  109. * @see nsIWebBrowserChrome for more information on aChromeFlags.
  110. */
  111. nsIDOMWindow provideWindow(in nsIDOMWindow aParent,
  112. in unsigned long aChromeFlags,
  113. in boolean aCalledFromJS,
  114. in boolean aPositionSpecified,
  115. in boolean aSizeSpecified,
  116. in nsIURI aURI,
  117. in AString aName,
  118. in AUTF8String aFeatures,
  119. out boolean aWindowIsNew);
  120. };