docshell/base/nsIContentViewer.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsISupports.idl"
michael@0 6
michael@0 7 interface nsIDocShell;
michael@0 8 interface nsIDocument;
michael@0 9 interface nsIDOMDocument;
michael@0 10 interface nsISHEntry;
michael@0 11 interface nsIPrintSettings;
michael@0 12
michael@0 13
michael@0 14 %{ C++
michael@0 15 class nsIWidget;
michael@0 16 struct nsIntRect;
michael@0 17 class nsIPresShell;
michael@0 18 class nsPresContext;
michael@0 19 class nsView;
michael@0 20 class nsDOMNavigationTiming;
michael@0 21 %}
michael@0 22
michael@0 23 [ptr] native nsIWidgetPtr(nsIWidget);
michael@0 24 [ref] native nsIntRectRef(nsIntRect);
michael@0 25 [ptr] native nsIPresShellPtr(nsIPresShell);
michael@0 26 [ptr] native nsPresContextPtr(nsPresContext);
michael@0 27 [ptr] native nsViewPtr(nsView);
michael@0 28 [ptr] native nsDOMNavigationTimingPtr(nsDOMNavigationTiming);
michael@0 29
michael@0 30 [scriptable, builtinclass, uuid(0cb321bd-5b38-4586-8fcd-d43b366886fb)]
michael@0 31 interface nsIContentViewer : nsISupports
michael@0 32 {
michael@0 33
michael@0 34 [noscript] void init(in nsIWidgetPtr aParentWidget,
michael@0 35 [const] in nsIntRectRef aBounds);
michael@0 36
michael@0 37 attribute nsIDocShell container;
michael@0 38
michael@0 39 [noscript,notxpcom,nostdcall] void loadStart(in nsIDocument aDoc);
michael@0 40 void loadComplete(in nsresult aStatus);
michael@0 41
michael@0 42 /**
michael@0 43 * Checks if the document wants to prevent unloading by firing beforeunload on
michael@0 44 * the document, and if it does, prompts the user. The result is returned.
michael@0 45 *
michael@0 46 * @param aCallerClosesWindow indicates that the current caller will close the
michael@0 47 * window. If the method returns true, all subsequent calls will be
michael@0 48 * ignored.
michael@0 49 */
michael@0 50 boolean permitUnload([optional] in boolean aCallerClosesWindow);
michael@0 51
michael@0 52 /**
michael@0 53 * Exposes whether we're blocked in a call to permitUnload.
michael@0 54 */
michael@0 55 readonly attribute boolean inPermitUnload;
michael@0 56
michael@0 57 /**
michael@0 58 * As above, but this passes around the aShouldPrompt argument to keep
michael@0 59 * track of whether the user has responded to a prompt.
michael@0 60 * Used internally by the scriptable version to ensure we only prompt once.
michael@0 61 */
michael@0 62 [noscript,nostdcall] boolean permitUnloadInternal(in boolean aCallerClosesWindow,
michael@0 63 inout boolean aShouldPrompt);
michael@0 64
michael@0 65 /**
michael@0 66 * Exposes whether we're in the process of firing the beforeunload event.
michael@0 67 * In this case, the corresponding docshell will not allow navigation.
michael@0 68 */
michael@0 69 readonly attribute boolean beforeUnloadFiring;
michael@0 70
michael@0 71 /**
michael@0 72 * Works in tandem with permitUnload, if the caller decides not to close the
michael@0 73 * window it indicated it will, it is the caller's responsibility to reset
michael@0 74 * that with this method.
michael@0 75 *
michael@0 76 * @Note this method is only meant to be called on documents for which the
michael@0 77 * caller has indicated that it will close the window. If that is not the case
michael@0 78 * the behavior of this method is undefined.
michael@0 79 */
michael@0 80 void resetCloseWindow();
michael@0 81 void pageHide(in boolean isUnload);
michael@0 82
michael@0 83 /**
michael@0 84 * All users of a content viewer are responsible for calling both
michael@0 85 * close() and destroy(), in that order.
michael@0 86 *
michael@0 87 * close() should be called when the load of a new page for the next
michael@0 88 * content viewer begins, and destroy() should be called when the next
michael@0 89 * content viewer replaces this one.
michael@0 90 *
michael@0 91 * |historyEntry| sets the session history entry for the content viewer. If
michael@0 92 * this is null, then Destroy() will be called on the document by close().
michael@0 93 * If it is non-null, the document will not be destroyed, and the following
michael@0 94 * actions will happen when destroy() is called (*):
michael@0 95 * - Sanitize() will be called on the viewer's document
michael@0 96 * - The content viewer will set the contentViewer property on the
michael@0 97 * history entry, and release its reference (ownership reversal).
michael@0 98 * - hide() will be called, and no further destruction will happen.
michael@0 99 *
michael@0 100 * (*) unless the document is currently being printed, in which case
michael@0 101 * it will never be saved in session history.
michael@0 102 *
michael@0 103 */
michael@0 104 void close(in nsISHEntry historyEntry);
michael@0 105 void destroy();
michael@0 106
michael@0 107 void stop();
michael@0 108
michael@0 109 attribute nsIDOMDocument DOMDocument;
michael@0 110
michael@0 111 /**
michael@0 112 * Returns DOMDocument as nsIDocument and without addrefing.
michael@0 113 */
michael@0 114 [noscript,notxpcom] nsIDocument getDocument();
michael@0 115
michael@0 116 [noscript] void getBounds(in nsIntRectRef aBounds);
michael@0 117 [noscript] void setBounds([const] in nsIntRectRef aBounds);
michael@0 118
michael@0 119 /**
michael@0 120 * The previous content viewer, which has been |close|d but not
michael@0 121 * |destroy|ed.
michael@0 122 */
michael@0 123 [noscript] attribute nsIContentViewer previousViewer;
michael@0 124
michael@0 125 void move(in long aX, in long aY);
michael@0 126
michael@0 127 void show();
michael@0 128 void hide();
michael@0 129
michael@0 130 attribute boolean sticky;
michael@0 131
michael@0 132 /*
michael@0 133 * This is called when the DOM window wants to be closed. Returns true
michael@0 134 * if the window can close immediately. Otherwise, returns false and will
michael@0 135 * close the DOM window as soon as practical.
michael@0 136 */
michael@0 137
michael@0 138 boolean requestWindowClose();
michael@0 139
michael@0 140 /**
michael@0 141 * Attach the content viewer to its DOM window and docshell.
michael@0 142 * @param aState A state object that might be useful in attaching the DOM
michael@0 143 * window.
michael@0 144 * @param aSHEntry The history entry that the content viewer was stored in.
michael@0 145 * The entry must have the docshells for all of the child
michael@0 146 * documents stored in its child shell list.
michael@0 147 */
michael@0 148 void open(in nsISupports aState, in nsISHEntry aSHEntry);
michael@0 149
michael@0 150 /**
michael@0 151 * Clears the current history entry. This is used if we need to clear out
michael@0 152 * the saved presentation state.
michael@0 153 */
michael@0 154 void clearHistoryEntry();
michael@0 155
michael@0 156 /**
michael@0 157 * Change the layout to view the document with page layout (like print preview), but
michael@0 158 * dynamic and editable (like Galley layout).
michael@0 159 */
michael@0 160 void setPageMode(in boolean aPageMode, in nsIPrintSettings aPrintSettings);
michael@0 161
michael@0 162 /**
michael@0 163 * Get the history entry that this viewer will save itself into when
michael@0 164 * destroyed. Can return null
michael@0 165 */
michael@0 166 readonly attribute nsISHEntry historyEntry;
michael@0 167
michael@0 168 /**
michael@0 169 * Indicates when we're in a state where content shouldn't be allowed to
michael@0 170 * trigger a tab-modal prompt (as opposed to a window-modal prompt) because
michael@0 171 * we're part way through some operation (eg beforeunload) that shouldn't be
michael@0 172 * rentrant if the user closes the tab while the prompt is showing.
michael@0 173 * See bug 613800.
michael@0 174 */
michael@0 175 readonly attribute boolean isTabModalPromptAllowed;
michael@0 176
michael@0 177 /**
michael@0 178 * Returns whether this content viewer is in a hidden state.
michael@0 179 */
michael@0 180 readonly attribute boolean isHidden;
michael@0 181
michael@0 182 [noscript] readonly attribute nsIPresShellPtr presShell;
michael@0 183 [noscript] readonly attribute nsPresContextPtr presContext;
michael@0 184 // aDocument must not be null.
michael@0 185 [noscript] void setDocumentInternal(in nsIDocument aDocument,
michael@0 186 in boolean aForceReuseInnerWindow);
michael@0 187 /**
michael@0 188 * Find the view to use as the container view for MakeWindow. Returns
michael@0 189 * null if this will be the root of a view manager hierarchy. In that
michael@0 190 * case, if mParentWidget is null then this document should not even
michael@0 191 * be displayed.
michael@0 192 */
michael@0 193 [noscript,notxpcom,nostdcall] nsViewPtr findContainerView();
michael@0 194 /**
michael@0 195 * Set collector for navigation timing data (load, unload events).
michael@0 196 */
michael@0 197 [noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming);
michael@0 198 };

mercurial