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.

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

mercurial