dom/base/nsIFrameLoader.idl
author Oleg Romashin <romaxa@gmail.com>
Sat, 22 Nov 2014 12:15:00 +0100
changeset 219062 cadfee0aa2af0fa0c5d3e192423024d417b3183a
parent 212358 2db29c0ae60b6eb0e196165631127d195fe2ef0b
child 222174 75a20fb5f86430a9dc8ef49a6cdd0aa7bea9d50c
permissions -rw-r--r--
Bug 1103412 - Gecko does not compile with printing disabled. r=mconley

/* -*- Mode: IDL; 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 nsFrameLoader;
interface nsIDocShell;
interface nsIURI;
interface nsIFrame;
interface nsSubDocumentFrame;
interface nsIMessageSender;
interface nsIVariant;
interface nsIDOMElement;
interface nsITabParent;
interface nsILoadContext;

[scriptable, builtinclass, uuid(7600aa92-88dc-491c-896d-0564159b6a66)]
interface nsIFrameLoader : nsISupports
{
  /**
   * Get the docshell from the frame loader.
   */
  readonly attribute nsIDocShell docShell;

  /**
   * Get this frame loader's TabParent, if it has a remote frame.  Otherwise,
   * returns null.
   */
  readonly attribute nsITabParent tabParent;

  /**
   * Get an nsILoadContext for the top-level docshell. For remote
   * frames, a shim is returned that contains private browsing and app
   * information.
   */
  readonly attribute nsILoadContext loadContext;

  /**
   * Start loading the frame. This method figures out what to load
   * from the owner content in the frame loader.
   */
  void loadFrame();

  /**
   * Loads the specified URI in this frame. Behaves identically to loadFrame,
   * except that this method allows specifying the URI to load.
   */
  void loadURI(in nsIURI aURI);

  /**
   * Destroy the frame loader and everything inside it. This will
   * clear the weak owner content reference.
   */
  void destroy();

  /**
   * Find out whether the loader's frame is at too great a depth in
   * the frame tree.  This can be used to decide what operations may
   * or may not be allowed on the loader's docshell.
   */
  readonly attribute boolean depthTooGreat;

  /**
   * Updates the position and size of the subdocument loaded by this frameloader.
   *
   *  @param aIFrame The nsIFrame for the content node that owns this frameloader
   */
  [noscript] void updatePositionAndSize(in nsSubDocumentFrame aIFrame);

  /**
   * Activate remote frame.
   * Throws an exception with non-remote frames.
   */
  void activateRemoteFrame();

  /**
   * Deactivate remote frame.
   * Throws an exception with non-remote frames.
   */
  void deactivateRemoteFrame();

  /**
   * @see nsIDOMWindowUtils sendMouseEvent.
   */
  void sendCrossProcessMouseEvent(in AString aType,
                                  in float aX,
                                  in float aY,
                                  in long aButton,
                                  in long aClickCount,
                                  in long aModifiers,
                                  [optional] in boolean aIgnoreRootScrollFrame);

  /**
   * Activate event forwarding from client (remote frame) to parent.
   */
  void activateFrameEvent(in AString aType, in boolean capture);

  // Note, when frameloaders are swapped, also messageManagers are swapped.
  readonly attribute nsIMessageSender messageManager;

  /**
   * @see nsIDOMWindowUtils sendKeyEvent.
   */
  void sendCrossProcessKeyEvent(in AString aType,
                                in long aKeyCode,
                                in long aCharCode,
                                in long aModifiers,
                                [optional] in boolean aPreventDefault);

  /**
   * Request that the next time a remote layer transaction has been
   * received by the Compositor, a MozAfterRemoteFrame event be sent
   * to the window.
   */
  void requestNotifyAfterRemotePaint();

  /**
   * The default event mode automatically forwards the events
   * handled in EventStateManager::HandleCrossProcessEvent to
   * the child content process when these events are targeted to
   * the remote browser element.
   *
   * Used primarly for input events (mouse, keyboard)
   */
  const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000;

  /**
   * With this event mode, it's the application's responsability to 
   * convert and forward events to the content process
   */
  const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;

  attribute unsigned long eventMode;

  /**
   * If false, then the subdocument is not clipped to its CSS viewport, and the
   * subdocument's viewport scrollbar(s) are not rendered.
   * Defaults to true.
   */
  attribute boolean clipSubdocument;

  /**
   * If false, then the subdocument's scroll coordinates will not be clamped
   * to their scroll boundaries.
   * Defaults to true.
   */
  attribute boolean clampScrollPosition;

  /**
   * The element which owns this frame loader.
   *
   * For example, if this is a frame loader for an <iframe>, this attribute
   * returns the iframe element.
   */
  readonly attribute nsIDOMElement ownerElement;


  /**
   * Cached childID of the ContentParent owning the TabParent in this frame
   * loader. This can be used to obtain the childID after the TabParent died.
   */
  readonly attribute unsigned long long childID;

  /**
   * Get or set this frame loader's visibility.
   *
   * The notion of "visibility" here is separate from the notion of a
   * window/docshell's visibility.  This field is mostly here so that we can
   * have a notion of visibility in the parent process when frames are OOP.
   */
  [infallible] attribute boolean visible;

  /**
   * Find out whether the owner content really is a browser or app frame
   * Especially, a widget frame is regarded as an app frame.
   */
  readonly attribute boolean ownerIsBrowserOrAppFrame;

  /**
   * Find out whether the owner content really is a widget. If this attribute
   * returns true, |ownerIsBrowserOrAppFrame| must return true.
   */
  readonly attribute boolean ownerIsWidget;

};

%{C++
class nsFrameLoader;
%}

native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);

[scriptable, uuid(5879040e-83e9-40e3-b2bb-5ddf43b76e47)]
interface nsIFrameLoaderOwner : nsISupports
{
  /**
   * The frame loader owned by this nsIFrameLoaderOwner
   */
  readonly attribute nsIFrameLoader frameLoader;
  [noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader();

  /**
   * Swap frame loaders with the given nsIFrameLoaderOwner.  This may
   * only be posible in a very limited range of circumstances, or
   * never, depending on the object implementing this interface.
   *
   * @throws NS_ERROR_NOT_IMPLEMENTED if the swapping logic is not
   *   implemented for the two given frame loader owners.
   * @throws NS_ERROR_DOM_SECURITY_ERR if the swap is not allowed on
   *   security grounds.
   */
  void swapFrameLoaders(in nsIFrameLoaderOwner aOtherOwner);
};