summaryrefslogtreecommitdiffstats
path: root/xpfe/appshell/nsIAppShellService.idl
blob: e7d96a5d18eb89d544b50640ccd4a18f338f923b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIXULWindow;
interface nsIWindowlessBrowser;
interface nsIURI;
interface mozIDOMWindowProxy;
interface nsIAppShell;
interface nsITabParent;

[ptr] native JSContext(JSContext);

%{C++
#include "js/TypeDecls.h"
%}

[scriptable, uuid(19266025-354c-4bb9-986b-3483b2b1cdef)]
interface nsIAppShellService : nsISupports
{
  /**
   * Create a window, which will be initially invisible.
   * @param aParent the parent window.  Can be null.
   * @param aUrl the contents of the new window.
   * @param aChromeMask chrome flags affecting the kind of OS border
   *                    given to the window. see nsIBrowserWindow for
   *                    bit/flag definitions.
   * @param aCallbacks interface providing C++ hooks for window initialization
   *                   before the window is made visible.  Can be null.
   *                   Deprecated.
   * @param aInitialWidth width, in pixels, of the window.  Width of window
   *                      at creation.  Can be overridden by the "width"
   *                      tag in the XUL.  Set to NS_SIZETOCONTENT to force
   *                      the window to wrap to its contents.
   * @param aInitialHeight like aInitialWidth, but subtly different.
   * @param aOpeningTab The TabParent that requested that this window be opened.
   *                    Can be left null.
   * @param aOpenerWindow The Window Proxy which requested that this window be opened.
   *                      Can be left null.
   */
  const long SIZE_TO_CONTENT = -1;
  nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent,
                                    in nsIURI aUrl, 
                                    in uint32_t aChromeMask,
                                    in long aInitialWidth,
                                    in long aInitialHeight,
                                    in nsITabParent aOpeningTab,
                                    in mozIDOMWindowProxy aOpenerWindow);

  /**
   * This is the constructor for creating an invisible DocShell.
   * It is used to simulate DOM windows without an actual physical
   * representation.
   * @param aIsChrome Set true if you want to use it for chrome content.
   */
  nsIWindowlessBrowser createWindowlessBrowser([optional] in bool aIsChrome);

  [noscript]
  void createHiddenWindow();

  void destroyHiddenWindow();

  /**
   * B2G multi-screen support. When open another top-level window on b2g,
   * a screen ID is needed for identifying which screen this window is
   * opened to.
   * @param aScreenId Differentiate screens of windows. It is platform-
   *                  specific due to the hardware limitation for now.
   */
  [noscript]
  void setScreenId(in uint32_t aScreenId);

  /**
   * Return the (singleton) application hidden window, automatically created
   * and maintained by this AppShellService.
   * @param aResult the hidden window.  Do not unhide hidden window.
   *                Do not taunt hidden window.
   */
  readonly attribute nsIXULWindow hiddenWindow;

  /**
   * Return the (singleton) application hidden window, automatically created
   * and maintained by this AppShellService.
   * @param aResult the hidden window.  Do not unhide hidden window.
   *                Do not taunt hidden window.
   */
  readonly attribute mozIDOMWindowProxy hiddenDOMWindow;

  /**
   * Return the (singleton) application hidden private window, automatically
   * created and maintained by this AppShellService.  This window is created
   * in private browsing mode.
   * @param aResult the hidden private window.  Do not unhide hidden window.
   *                Do not taunt hidden window.
   */
  readonly attribute nsIXULWindow hiddenPrivateWindow;

  /**
   * Return the (singleton) application hidden private window, automatically
   * created and maintained by this AppShellService.  This window is created
   * in private browsing mode.
   * @param aResult the hidden private window.  Do not unhide hidden window.
   *                Do not taunt hidden window.
   */
  readonly attribute mozIDOMWindowProxy hiddenPrivateDOMWindow;

  /**
   * Return true if the application hidden window was provided by the
   * application. If it wasn't, the default hidden window was used. This will
   * usually be false on all non-mac platforms.
   */
  readonly attribute boolean applicationProvidedHiddenWindow;

  /**
   * Add a window to the application's registry of windows.  These windows
   * are generally shown in the Windows taskbar, and the application
   * knows it can't quit until it's out of registered windows.
   * @param aWindow the window to register
   * @note When this method is successful, it fires the global notification
   *       "xul-window-registered"
   */
  void registerTopLevelWindow(in nsIXULWindow aWindow);

  /**
   * Remove a window from the application's window registry. Note that
   * this method won't automatically attempt to quit the app when
   * the last window is unregistered. For that, see Quit().
   * @param aWindow you see the pattern
   */
  void unregisterTopLevelWindow(in nsIXULWindow aWindow);

  /**
   * Whether the hidden private window has been lazily created.
   */
  [noscript]
  readonly attribute boolean hasHiddenPrivateWindow;

  /**
   * Start/stop tracking lags in the event loop.
   * If the event loop gets unresponsive, a "event-loop-lag" notification
   * is sent. Note that calling `startEventLoopLagTracking` when tracking
   * is already enabled has no effect.
   * @return true if tracking succeeded.
   */
  bool startEventLoopLagTracking();
  void stopEventLoopLagTracking();
};