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