nsIWindowProvider.idl 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. * nsIWindowProvider is a callback interface used by Gecko when it needs to
  7. * open a new window. This interface can be implemented by Gecko consumers who
  8. * wish to provide a custom "new window" of their own (for example by returning
  9. * a new tab, an existing window, etc) instead of just having a real new
  10. * toplevel window open.
  11. */
  12. #include "nsISupports.idl"
  13. interface mozIDOMWindowProxy;
  14. interface nsIURI;
  15. /**
  16. * The nsIWindowProvider interface exists so that the window watcher's default
  17. * behavior of opening a new window can be easly modified. When the window
  18. * watcher needs to open a new window, it will first check with the
  19. * nsIWindowProvider it gets from the parent window. If there is no provider
  20. * or the provider does not provide a window, the window watcher will proceed
  21. * to actually open a new window.
  22. */
  23. [scriptable, uuid(e97a3830-15ef-499b-8372-c22d128091c1)]
  24. interface nsIWindowProvider : nsISupports
  25. {
  26. /**
  27. * A method to request that this provider provide a window. The window
  28. * returned need not to have the right name or parent set on it; setting
  29. * those is the caller's responsibility. The provider can always return null
  30. * to have the caller create a brand-new window.
  31. *
  32. * @param aParent Must not be null. This is the window that the caller wants
  33. * to use as the parent for the new window. Generally,
  34. * nsIWindowProvider implementors can expect to be somehow related to
  35. * aParent; the relationship may depend on the nsIWindowProvider
  36. * implementation.
  37. *
  38. * @param aChromeFlags The chrome flags the caller will use to create a new
  39. * window if this provider returns null. See nsIWebBrowserChrome for
  40. * the possible values of this field.
  41. *
  42. * @param aPositionSpecified Whether the attempt to create a window is trying
  43. * to specify a position for the new window.
  44. *
  45. * @param aSizeSpecified Whether the attempt to create a window is trying to
  46. * specify a size for the new window.
  47. *
  48. * @param aURI The URI to be loaded in the new window (may be NULL). The
  49. * nsIWindowProvider implementation must not load this URI into the
  50. * window it returns. This URI is provided solely to help the
  51. * nsIWindowProvider implementation make decisions; the caller will
  52. * handle loading the URI in the window returned if provideWindow
  53. * returns a window.
  54. *
  55. * When making decisions based on aURI, note that even when it's not
  56. * null, aURI may not represent all relevant information about the
  57. * load. For example, the load may have extra load flags, POST data,
  58. * etc.
  59. *
  60. * @param aName The name of the window being opened. Setting the name on the
  61. * return value of provideWindow will be handled by the caller; aName
  62. * is provided solely to help the nsIWindowProvider implementation
  63. * make decisions.
  64. *
  65. * @param aFeatures The feature string for the window being opened. This may
  66. * be empty. The nsIWindowProvider implementation is allowed to apply
  67. * the feature string to the window it returns in any way it sees fit.
  68. * See the nsIWindowWatcher interface for details on feature strings.
  69. *
  70. * @param aWindowIsNew [out] Whether the window being returned was just
  71. * created by the window provider implementation. This can be used by
  72. * callers to keep track of which windows were opened by the user as
  73. * opposed to being opened programmatically. This should be set to
  74. * false if the window being returned existed before the
  75. * provideWindow() call. The value of this out parameter is
  76. * meaningless if provideWindow() returns null.
  77. * @return A window the caller should use or null if the caller should just
  78. * create a new window. The returned window may be newly opened by
  79. * the nsIWindowProvider implementation or may be a window that
  80. * already existed.
  81. *
  82. * @throw NS_ERROR_ABORT if the caller should cease its attempt to open a new
  83. * window.
  84. *
  85. * @see nsIWindowWatcher for more information on aFeatures.
  86. * @see nsIWebBrowserChrome for more information on aChromeFlags.
  87. */
  88. mozIDOMWindowProxy provideWindow(in mozIDOMWindowProxy aParent,
  89. in unsigned long aChromeFlags,
  90. in boolean aCalledFromJS,
  91. in boolean aPositionSpecified,
  92. in boolean aSizeSpecified,
  93. in nsIURI aURI,
  94. in AString aName,
  95. in AUTF8String aFeatures,
  96. in boolean aForceNoOpener,
  97. out boolean aWindowIsNew);
  98. };