1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/base/nsILoadContext.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,112 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsIDOMWindow; 1.13 +interface nsIDOMElement; 1.14 + 1.15 +/** 1.16 + * An nsILoadContext represents the context of a load. This interface 1.17 + * can be queried for various information about where the load is 1.18 + * happening. 1.19 + */ 1.20 +[scriptable, uuid(852ed1f0-8ec0-11e3-baa8-0800200c9a66)] 1.21 +interface nsILoadContext : nsISupports 1.22 +{ 1.23 + /** 1.24 + * associatedWindow is the window with which the load is associated, if any. 1.25 + * Note that the load may be triggered by a document which is different from 1.26 + * the document in associatedWindow, and in fact the source of the load need 1.27 + * not be same-origin with the document in associatedWindow. This attribute 1.28 + * may be null if there is no associated window. 1.29 + */ 1.30 + readonly attribute nsIDOMWindow associatedWindow; 1.31 + 1.32 + /** 1.33 + * topWindow is the top window which is of same type as associatedWindow. 1.34 + * This is equivalent to associatedWindow.top, but is provided here as a 1.35 + * convenience. All the same caveats as associatedWindow of apply, of 1.36 + * course. This attribute may be null if there is no associated window. 1.37 + */ 1.38 + readonly attribute nsIDOMWindow topWindow; 1.39 + 1.40 + /** 1.41 + * topFrameElement is the <iframe> or <frame> element which contains the 1.42 + * topWindow with which the load is associated. 1.43 + * 1.44 + * Note that we may have a topFrameElement even when we don't have an 1.45 + * associatedWindow, if the topFrameElement's content lives out of process. 1.46 + */ 1.47 + readonly attribute nsIDOMElement topFrameElement; 1.48 + 1.49 + /** 1.50 + * Check whether the load is happening in a particular type of application. 1.51 + * 1.52 + * @param an application type. For now, the constants to be passed here are 1.53 + * the nsIDocShell APP_TYPE_* constants. 1.54 + * 1.55 + * @return whether there is some ancestor of the associatedWindow that is of 1.56 + * the given app type. 1.57 + */ 1.58 + boolean isAppOfType(in unsigned long appType); 1.59 + 1.60 + /** 1.61 + * True if the load context is content (as opposed to chrome). This is 1.62 + * determined based on the type of window the load is performed in, NOT based 1.63 + * on any URIs that might be around. 1.64 + */ 1.65 + readonly attribute boolean isContent; 1.66 + 1.67 + /* 1.68 + * Attribute that determines if private browsing should be used. 1.69 + */ 1.70 + attribute boolean usePrivateBrowsing; 1.71 + 1.72 + /** 1.73 + * Attribute that determines if remote (out-of-process) tabs should be used. 1.74 + */ 1.75 + readonly attribute boolean useRemoteTabs; 1.76 + 1.77 +%{C++ 1.78 + /** 1.79 + * De-XPCOMed getter to make call-sites cleaner. 1.80 + */ 1.81 + bool UsePrivateBrowsing() { 1.82 + bool usingPB; 1.83 + GetUsePrivateBrowsing(&usingPB); 1.84 + return usingPB; 1.85 + } 1.86 + 1.87 + bool UseRemoteTabs() { 1.88 + bool usingRT; 1.89 + GetUseRemoteTabs(&usingRT); 1.90 + return usingRT; 1.91 + } 1.92 +%} 1.93 + 1.94 + /** 1.95 + * Set the private browsing state of the load context, meant to be used internally. 1.96 + */ 1.97 + [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing); 1.98 + 1.99 + /** 1.100 + * Set the remote tabs state of the load context, meant to be used internally. 1.101 + */ 1.102 + [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs); 1.103 + 1.104 + /** 1.105 + * Returns true iff the load is occurring inside a browser element. 1.106 + */ 1.107 + readonly attribute boolean isInBrowserElement; 1.108 + 1.109 + /** 1.110 + * Returns the app id of the app the load is occurring is in. Returns 1.111 + * nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app. 1.112 + */ 1.113 + readonly attribute unsigned long appId; 1.114 + 1.115 +};