michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDocShell; michael@0: interface nsIDocument; michael@0: interface nsIDOMDocument; michael@0: interface nsISHEntry; michael@0: interface nsIPrintSettings; michael@0: michael@0: michael@0: %{ C++ michael@0: class nsIWidget; michael@0: struct nsIntRect; michael@0: class nsIPresShell; michael@0: class nsPresContext; michael@0: class nsView; michael@0: class nsDOMNavigationTiming; michael@0: %} michael@0: michael@0: [ptr] native nsIWidgetPtr(nsIWidget); michael@0: [ref] native nsIntRectRef(nsIntRect); michael@0: [ptr] native nsIPresShellPtr(nsIPresShell); michael@0: [ptr] native nsPresContextPtr(nsPresContext); michael@0: [ptr] native nsViewPtr(nsView); michael@0: [ptr] native nsDOMNavigationTimingPtr(nsDOMNavigationTiming); michael@0: michael@0: [scriptable, builtinclass, uuid(0cb321bd-5b38-4586-8fcd-d43b366886fb)] michael@0: interface nsIContentViewer : nsISupports michael@0: { michael@0: michael@0: [noscript] void init(in nsIWidgetPtr aParentWidget, michael@0: [const] in nsIntRectRef aBounds); michael@0: michael@0: attribute nsIDocShell container; michael@0: michael@0: [noscript,notxpcom,nostdcall] void loadStart(in nsIDocument aDoc); michael@0: void loadComplete(in nsresult aStatus); michael@0: michael@0: /** michael@0: * Checks if the document wants to prevent unloading by firing beforeunload on michael@0: * the document, and if it does, prompts the user. The result is returned. michael@0: * michael@0: * @param aCallerClosesWindow indicates that the current caller will close the michael@0: * window. If the method returns true, all subsequent calls will be michael@0: * ignored. michael@0: */ michael@0: boolean permitUnload([optional] in boolean aCallerClosesWindow); michael@0: michael@0: /** michael@0: * Exposes whether we're blocked in a call to permitUnload. michael@0: */ michael@0: readonly attribute boolean inPermitUnload; michael@0: michael@0: /** michael@0: * As above, but this passes around the aShouldPrompt argument to keep michael@0: * track of whether the user has responded to a prompt. michael@0: * Used internally by the scriptable version to ensure we only prompt once. michael@0: */ michael@0: [noscript,nostdcall] boolean permitUnloadInternal(in boolean aCallerClosesWindow, michael@0: inout boolean aShouldPrompt); michael@0: michael@0: /** michael@0: * Exposes whether we're in the process of firing the beforeunload event. michael@0: * In this case, the corresponding docshell will not allow navigation. michael@0: */ michael@0: readonly attribute boolean beforeUnloadFiring; michael@0: michael@0: /** michael@0: * Works in tandem with permitUnload, if the caller decides not to close the michael@0: * window it indicated it will, it is the caller's responsibility to reset michael@0: * that with this method. michael@0: * michael@0: * @Note this method is only meant to be called on documents for which the michael@0: * caller has indicated that it will close the window. If that is not the case michael@0: * the behavior of this method is undefined. michael@0: */ michael@0: void resetCloseWindow(); michael@0: void pageHide(in boolean isUnload); michael@0: michael@0: /** michael@0: * All users of a content viewer are responsible for calling both michael@0: * close() and destroy(), in that order. michael@0: * michael@0: * close() should be called when the load of a new page for the next michael@0: * content viewer begins, and destroy() should be called when the next michael@0: * content viewer replaces this one. michael@0: * michael@0: * |historyEntry| sets the session history entry for the content viewer. If michael@0: * this is null, then Destroy() will be called on the document by close(). michael@0: * If it is non-null, the document will not be destroyed, and the following michael@0: * actions will happen when destroy() is called (*): michael@0: * - Sanitize() will be called on the viewer's document michael@0: * - The content viewer will set the contentViewer property on the michael@0: * history entry, and release its reference (ownership reversal). michael@0: * - hide() will be called, and no further destruction will happen. michael@0: * michael@0: * (*) unless the document is currently being printed, in which case michael@0: * it will never be saved in session history. michael@0: * michael@0: */ michael@0: void close(in nsISHEntry historyEntry); michael@0: void destroy(); michael@0: michael@0: void stop(); michael@0: michael@0: attribute nsIDOMDocument DOMDocument; michael@0: michael@0: /** michael@0: * Returns DOMDocument as nsIDocument and without addrefing. michael@0: */ michael@0: [noscript,notxpcom] nsIDocument getDocument(); michael@0: michael@0: [noscript] void getBounds(in nsIntRectRef aBounds); michael@0: [noscript] void setBounds([const] in nsIntRectRef aBounds); michael@0: michael@0: /** michael@0: * The previous content viewer, which has been |close|d but not michael@0: * |destroy|ed. michael@0: */ michael@0: [noscript] attribute nsIContentViewer previousViewer; michael@0: michael@0: void move(in long aX, in long aY); michael@0: michael@0: void show(); michael@0: void hide(); michael@0: michael@0: attribute boolean sticky; michael@0: michael@0: /* michael@0: * This is called when the DOM window wants to be closed. Returns true michael@0: * if the window can close immediately. Otherwise, returns false and will michael@0: * close the DOM window as soon as practical. michael@0: */ michael@0: michael@0: boolean requestWindowClose(); michael@0: michael@0: /** michael@0: * Attach the content viewer to its DOM window and docshell. michael@0: * @param aState A state object that might be useful in attaching the DOM michael@0: * window. michael@0: * @param aSHEntry The history entry that the content viewer was stored in. michael@0: * The entry must have the docshells for all of the child michael@0: * documents stored in its child shell list. michael@0: */ michael@0: void open(in nsISupports aState, in nsISHEntry aSHEntry); michael@0: michael@0: /** michael@0: * Clears the current history entry. This is used if we need to clear out michael@0: * the saved presentation state. michael@0: */ michael@0: void clearHistoryEntry(); michael@0: michael@0: /** michael@0: * Change the layout to view the document with page layout (like print preview), but michael@0: * dynamic and editable (like Galley layout). michael@0: */ michael@0: void setPageMode(in boolean aPageMode, in nsIPrintSettings aPrintSettings); michael@0: michael@0: /** michael@0: * Get the history entry that this viewer will save itself into when michael@0: * destroyed. Can return null michael@0: */ michael@0: readonly attribute nsISHEntry historyEntry; michael@0: michael@0: /** michael@0: * Indicates when we're in a state where content shouldn't be allowed to michael@0: * trigger a tab-modal prompt (as opposed to a window-modal prompt) because michael@0: * we're part way through some operation (eg beforeunload) that shouldn't be michael@0: * rentrant if the user closes the tab while the prompt is showing. michael@0: * See bug 613800. michael@0: */ michael@0: readonly attribute boolean isTabModalPromptAllowed; michael@0: michael@0: /** michael@0: * Returns whether this content viewer is in a hidden state. michael@0: */ michael@0: readonly attribute boolean isHidden; michael@0: michael@0: [noscript] readonly attribute nsIPresShellPtr presShell; michael@0: [noscript] readonly attribute nsPresContextPtr presContext; michael@0: // aDocument must not be null. michael@0: [noscript] void setDocumentInternal(in nsIDocument aDocument, michael@0: in boolean aForceReuseInnerWindow); michael@0: /** michael@0: * Find the view to use as the container view for MakeWindow. Returns michael@0: * null if this will be the root of a view manager hierarchy. In that michael@0: * case, if mParentWidget is null then this document should not even michael@0: * be displayed. michael@0: */ michael@0: [noscript,notxpcom,nostdcall] nsViewPtr findContainerView(); michael@0: /** michael@0: * Set collector for navigation timing data (load, unload events). michael@0: */ michael@0: [noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming); michael@0: };