no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / xpfe / appshell / nsIWindowMediator.idl
blob12f71a4763e16841dc908eb2794df517d687999e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/. */
6 #include "nsISupports.idl"
7 #include "nsISimpleEnumerator.idl"
9 %{C++
10 #define NS_WINDOWMEDIATOR_CID \
11 { 0x79a2b7cc, 0xf05b, 0x4605, \
12 { 0xbf, 0xa0, 0xfa, 0xc5, 0x4f, 0x27, 0xee, 0xc8 } }
14 #define NS_WINDOWMEDIATOR_CONTRACTID \
15 "@mozilla.org/appshell/window-mediator;1"
18 interface mozIDOMWindow;
19 interface mozIDOMWindowProxy;
20 interface nsIAppWindow;
21 interface nsIWidget;
22 interface nsIWindowMediatorListener;
24 [scriptable, uuid(df0da056-357d-427f-bafd-e6cbf19c9381)]
25 interface nsIWindowMediator: nsISupports
27 /** Return an enumerator which iterates over all windows of type aWindowType
28 * from the oldest window to the youngest.
29 * @param aWindowType the returned enumerator will enumerate only
30 * windows of this type. ("type" is the
31 * |windowtype| attribute of the XML <window> element.)
32 * If null, all windows will be enumerated.
33 * @return an enumerator of nsIDOMWindows. Note that windows close
34 * asynchronously in many cases, so windows returned from this
35 * enumerator can have .closed set to true. Caveat enumerator!
37 nsISimpleEnumerator getEnumerator(in wstring aWindowType);
39 /** Identical to getEnumerator except:
40 * @return an enumerator of nsIAppWindows
42 nsISimpleEnumerator getAppWindowEnumerator(in wstring aWindowType);
44 /** Return an enumerator which iterates over all windows of type aWindowType
45 * in their z (front-to-back) order. Note this interface makes
46 * no requirement that a window couldn't be revisited if windows
47 * are re-ordered while z-order enumerators are active.
48 * @param aWindowType the returned enumerator will enumerate only
49 * windows of this type. ("type" is the
50 * |windowtype| attribute of the XML <window> element.)
51 * If null, all windows will be enumerated.
52 * @param aFrontToBack if true, the enumerator enumerates windows in order
53 * from front to back. back to front if false.
54 * @return an enumerator of nsIAppWindows
56 nsISimpleEnumerator getZOrderAppWindowEnumerator(in wstring aWindowType,
57 in boolean aFrontToBack);
59 /** This is a shortcut for simply fetching the first window in
60 * front to back order.
61 * @param aWindowType return the topmost window of this type.
62 * ("type" is the |windowtype| attribute of
63 * the XML <window> element.)
64 * If null, return the topmost window of any type.
65 * @return the topmost window
67 mozIDOMWindowProxy getMostRecentWindow(in wstring aWindowType);
69 /** This is a shortcut for getMostRecentWindow('navigator:browser'), but
70 * if that fails it also tries 'navigator:geckoview' and 'mail:3pane'.
72 * @return the topmost browser window
74 mozIDOMWindowProxy getMostRecentBrowserWindow();
76 /**
77 * Same as getMostRecentWindow, but ignores private browsing
78 * windows.
80 mozIDOMWindowProxy getMostRecentNonPBWindow(in wstring aWindowType);
82 /**
83 * Return the outer window with the given ID, if any. Can return null.
85 mozIDOMWindowProxy getOuterWindowWithId(in unsigned long long aOuterWindowID);
87 /**
88 * Return the inner window with the given current window ID, if any.
89 * Can return null if no inner window with the ID exists or if it's not
90 * a current inner anymore.
92 mozIDOMWindow getCurrentInnerWindowWithId(in unsigned long long aInnerWindowID);
94 /** Add the window to the list of known windows. Listeners (see
95 * addListener) will be notified through their onOpenWindow method.
96 * @param aWindow the window to add
98 [noscript] void registerWindow(in nsIAppWindow aWindow);
100 /** Remove the window from the list of known windows. Listeners (see
101 * addListener) will be be notified through their onCloseWindow method.
102 * @param aWindow the window to remove
104 [noscript] void unregisterWindow(in nsIAppWindow aWindow);
106 /** Call this method when a window gains focus. It's a primitive means of
107 * determining the most recent window. It's no longer necessary and it
108 * really should be removed.
109 * @param aWindow the window which has gained focus
111 [noscript] void updateWindowTimeStamp(in nsIAppWindow aWindow);
113 /** Register a listener for window status changes.
114 * keeps strong ref? (to be decided)
115 * @param aListener the listener to register
117 void addListener(in nsIWindowMediatorListener aListener);
119 /** Unregister a listener of window status changes.
120 * @param aListener the listener to unregister
122 void removeListener(in nsIWindowMediatorListener aListener);