1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/base/nsIContentViewer.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,198 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIDocShell; 1.11 +interface nsIDocument; 1.12 +interface nsIDOMDocument; 1.13 +interface nsISHEntry; 1.14 +interface nsIPrintSettings; 1.15 + 1.16 + 1.17 +%{ C++ 1.18 +class nsIWidget; 1.19 +struct nsIntRect; 1.20 +class nsIPresShell; 1.21 +class nsPresContext; 1.22 +class nsView; 1.23 +class nsDOMNavigationTiming; 1.24 +%} 1.25 + 1.26 +[ptr] native nsIWidgetPtr(nsIWidget); 1.27 +[ref] native nsIntRectRef(nsIntRect); 1.28 +[ptr] native nsIPresShellPtr(nsIPresShell); 1.29 +[ptr] native nsPresContextPtr(nsPresContext); 1.30 +[ptr] native nsViewPtr(nsView); 1.31 +[ptr] native nsDOMNavigationTimingPtr(nsDOMNavigationTiming); 1.32 + 1.33 +[scriptable, builtinclass, uuid(0cb321bd-5b38-4586-8fcd-d43b366886fb)] 1.34 +interface nsIContentViewer : nsISupports 1.35 +{ 1.36 + 1.37 + [noscript] void init(in nsIWidgetPtr aParentWidget, 1.38 + [const] in nsIntRectRef aBounds); 1.39 + 1.40 + attribute nsIDocShell container; 1.41 + 1.42 + [noscript,notxpcom,nostdcall] void loadStart(in nsIDocument aDoc); 1.43 + void loadComplete(in nsresult aStatus); 1.44 + 1.45 + /** 1.46 + * Checks if the document wants to prevent unloading by firing beforeunload on 1.47 + * the document, and if it does, prompts the user. The result is returned. 1.48 + * 1.49 + * @param aCallerClosesWindow indicates that the current caller will close the 1.50 + * window. If the method returns true, all subsequent calls will be 1.51 + * ignored. 1.52 + */ 1.53 + boolean permitUnload([optional] in boolean aCallerClosesWindow); 1.54 + 1.55 + /** 1.56 + * Exposes whether we're blocked in a call to permitUnload. 1.57 + */ 1.58 + readonly attribute boolean inPermitUnload; 1.59 + 1.60 + /** 1.61 + * As above, but this passes around the aShouldPrompt argument to keep 1.62 + * track of whether the user has responded to a prompt. 1.63 + * Used internally by the scriptable version to ensure we only prompt once. 1.64 + */ 1.65 + [noscript,nostdcall] boolean permitUnloadInternal(in boolean aCallerClosesWindow, 1.66 + inout boolean aShouldPrompt); 1.67 + 1.68 + /** 1.69 + * Exposes whether we're in the process of firing the beforeunload event. 1.70 + * In this case, the corresponding docshell will not allow navigation. 1.71 + */ 1.72 + readonly attribute boolean beforeUnloadFiring; 1.73 + 1.74 + /** 1.75 + * Works in tandem with permitUnload, if the caller decides not to close the 1.76 + * window it indicated it will, it is the caller's responsibility to reset 1.77 + * that with this method. 1.78 + * 1.79 + * @Note this method is only meant to be called on documents for which the 1.80 + * caller has indicated that it will close the window. If that is not the case 1.81 + * the behavior of this method is undefined. 1.82 + */ 1.83 + void resetCloseWindow(); 1.84 + void pageHide(in boolean isUnload); 1.85 + 1.86 + /** 1.87 + * All users of a content viewer are responsible for calling both 1.88 + * close() and destroy(), in that order. 1.89 + * 1.90 + * close() should be called when the load of a new page for the next 1.91 + * content viewer begins, and destroy() should be called when the next 1.92 + * content viewer replaces this one. 1.93 + * 1.94 + * |historyEntry| sets the session history entry for the content viewer. If 1.95 + * this is null, then Destroy() will be called on the document by close(). 1.96 + * If it is non-null, the document will not be destroyed, and the following 1.97 + * actions will happen when destroy() is called (*): 1.98 + * - Sanitize() will be called on the viewer's document 1.99 + * - The content viewer will set the contentViewer property on the 1.100 + * history entry, and release its reference (ownership reversal). 1.101 + * - hide() will be called, and no further destruction will happen. 1.102 + * 1.103 + * (*) unless the document is currently being printed, in which case 1.104 + * it will never be saved in session history. 1.105 + * 1.106 + */ 1.107 + void close(in nsISHEntry historyEntry); 1.108 + void destroy(); 1.109 + 1.110 + void stop(); 1.111 + 1.112 + attribute nsIDOMDocument DOMDocument; 1.113 + 1.114 + /** 1.115 + * Returns DOMDocument as nsIDocument and without addrefing. 1.116 + */ 1.117 + [noscript,notxpcom] nsIDocument getDocument(); 1.118 + 1.119 + [noscript] void getBounds(in nsIntRectRef aBounds); 1.120 + [noscript] void setBounds([const] in nsIntRectRef aBounds); 1.121 + 1.122 + /** 1.123 + * The previous content viewer, which has been |close|d but not 1.124 + * |destroy|ed. 1.125 + */ 1.126 + [noscript] attribute nsIContentViewer previousViewer; 1.127 + 1.128 + void move(in long aX, in long aY); 1.129 + 1.130 + void show(); 1.131 + void hide(); 1.132 + 1.133 + attribute boolean sticky; 1.134 + 1.135 + /* 1.136 + * This is called when the DOM window wants to be closed. Returns true 1.137 + * if the window can close immediately. Otherwise, returns false and will 1.138 + * close the DOM window as soon as practical. 1.139 + */ 1.140 + 1.141 + boolean requestWindowClose(); 1.142 + 1.143 + /** 1.144 + * Attach the content viewer to its DOM window and docshell. 1.145 + * @param aState A state object that might be useful in attaching the DOM 1.146 + * window. 1.147 + * @param aSHEntry The history entry that the content viewer was stored in. 1.148 + * The entry must have the docshells for all of the child 1.149 + * documents stored in its child shell list. 1.150 + */ 1.151 + void open(in nsISupports aState, in nsISHEntry aSHEntry); 1.152 + 1.153 + /** 1.154 + * Clears the current history entry. This is used if we need to clear out 1.155 + * the saved presentation state. 1.156 + */ 1.157 + void clearHistoryEntry(); 1.158 + 1.159 + /** 1.160 + * Change the layout to view the document with page layout (like print preview), but 1.161 + * dynamic and editable (like Galley layout). 1.162 + */ 1.163 + void setPageMode(in boolean aPageMode, in nsIPrintSettings aPrintSettings); 1.164 + 1.165 + /** 1.166 + * Get the history entry that this viewer will save itself into when 1.167 + * destroyed. Can return null 1.168 + */ 1.169 + readonly attribute nsISHEntry historyEntry; 1.170 + 1.171 + /** 1.172 + * Indicates when we're in a state where content shouldn't be allowed to 1.173 + * trigger a tab-modal prompt (as opposed to a window-modal prompt) because 1.174 + * we're part way through some operation (eg beforeunload) that shouldn't be 1.175 + * rentrant if the user closes the tab while the prompt is showing. 1.176 + * See bug 613800. 1.177 + */ 1.178 + readonly attribute boolean isTabModalPromptAllowed; 1.179 + 1.180 + /** 1.181 + * Returns whether this content viewer is in a hidden state. 1.182 + */ 1.183 + readonly attribute boolean isHidden; 1.184 + 1.185 + [noscript] readonly attribute nsIPresShellPtr presShell; 1.186 + [noscript] readonly attribute nsPresContextPtr presContext; 1.187 + // aDocument must not be null. 1.188 + [noscript] void setDocumentInternal(in nsIDocument aDocument, 1.189 + in boolean aForceReuseInnerWindow); 1.190 + /** 1.191 + * Find the view to use as the container view for MakeWindow. Returns 1.192 + * null if this will be the root of a view manager hierarchy. In that 1.193 + * case, if mParentWidget is null then this document should not even 1.194 + * be displayed. 1.195 + */ 1.196 + [noscript,notxpcom,nostdcall] nsViewPtr findContainerView(); 1.197 + /** 1.198 + * Set collector for navigation timing data (load, unload events). 1.199 + */ 1.200 + [noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming); 1.201 +};