Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | interface nsIDOMWindow; |
michael@0 | 10 | interface nsIDOMElement; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * An nsILoadContext represents the context of a load. This interface |
michael@0 | 14 | * can be queried for various information about where the load is |
michael@0 | 15 | * happening. |
michael@0 | 16 | */ |
michael@0 | 17 | [scriptable, uuid(852ed1f0-8ec0-11e3-baa8-0800200c9a66)] |
michael@0 | 18 | interface nsILoadContext : nsISupports |
michael@0 | 19 | { |
michael@0 | 20 | /** |
michael@0 | 21 | * associatedWindow is the window with which the load is associated, if any. |
michael@0 | 22 | * Note that the load may be triggered by a document which is different from |
michael@0 | 23 | * the document in associatedWindow, and in fact the source of the load need |
michael@0 | 24 | * not be same-origin with the document in associatedWindow. This attribute |
michael@0 | 25 | * may be null if there is no associated window. |
michael@0 | 26 | */ |
michael@0 | 27 | readonly attribute nsIDOMWindow associatedWindow; |
michael@0 | 28 | |
michael@0 | 29 | /** |
michael@0 | 30 | * topWindow is the top window which is of same type as associatedWindow. |
michael@0 | 31 | * This is equivalent to associatedWindow.top, but is provided here as a |
michael@0 | 32 | * convenience. All the same caveats as associatedWindow of apply, of |
michael@0 | 33 | * course. This attribute may be null if there is no associated window. |
michael@0 | 34 | */ |
michael@0 | 35 | readonly attribute nsIDOMWindow topWindow; |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * topFrameElement is the <iframe> or <frame> element which contains the |
michael@0 | 39 | * topWindow with which the load is associated. |
michael@0 | 40 | * |
michael@0 | 41 | * Note that we may have a topFrameElement even when we don't have an |
michael@0 | 42 | * associatedWindow, if the topFrameElement's content lives out of process. |
michael@0 | 43 | */ |
michael@0 | 44 | readonly attribute nsIDOMElement topFrameElement; |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * Check whether the load is happening in a particular type of application. |
michael@0 | 48 | * |
michael@0 | 49 | * @param an application type. For now, the constants to be passed here are |
michael@0 | 50 | * the nsIDocShell APP_TYPE_* constants. |
michael@0 | 51 | * |
michael@0 | 52 | * @return whether there is some ancestor of the associatedWindow that is of |
michael@0 | 53 | * the given app type. |
michael@0 | 54 | */ |
michael@0 | 55 | boolean isAppOfType(in unsigned long appType); |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * True if the load context is content (as opposed to chrome). This is |
michael@0 | 59 | * determined based on the type of window the load is performed in, NOT based |
michael@0 | 60 | * on any URIs that might be around. |
michael@0 | 61 | */ |
michael@0 | 62 | readonly attribute boolean isContent; |
michael@0 | 63 | |
michael@0 | 64 | /* |
michael@0 | 65 | * Attribute that determines if private browsing should be used. |
michael@0 | 66 | */ |
michael@0 | 67 | attribute boolean usePrivateBrowsing; |
michael@0 | 68 | |
michael@0 | 69 | /** |
michael@0 | 70 | * Attribute that determines if remote (out-of-process) tabs should be used. |
michael@0 | 71 | */ |
michael@0 | 72 | readonly attribute boolean useRemoteTabs; |
michael@0 | 73 | |
michael@0 | 74 | %{C++ |
michael@0 | 75 | /** |
michael@0 | 76 | * De-XPCOMed getter to make call-sites cleaner. |
michael@0 | 77 | */ |
michael@0 | 78 | bool UsePrivateBrowsing() { |
michael@0 | 79 | bool usingPB; |
michael@0 | 80 | GetUsePrivateBrowsing(&usingPB); |
michael@0 | 81 | return usingPB; |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | bool UseRemoteTabs() { |
michael@0 | 85 | bool usingRT; |
michael@0 | 86 | GetUseRemoteTabs(&usingRT); |
michael@0 | 87 | return usingRT; |
michael@0 | 88 | } |
michael@0 | 89 | %} |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | * Set the private browsing state of the load context, meant to be used internally. |
michael@0 | 93 | */ |
michael@0 | 94 | [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing); |
michael@0 | 95 | |
michael@0 | 96 | /** |
michael@0 | 97 | * Set the remote tabs state of the load context, meant to be used internally. |
michael@0 | 98 | */ |
michael@0 | 99 | [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs); |
michael@0 | 100 | |
michael@0 | 101 | /** |
michael@0 | 102 | * Returns true iff the load is occurring inside a browser element. |
michael@0 | 103 | */ |
michael@0 | 104 | readonly attribute boolean isInBrowserElement; |
michael@0 | 105 | |
michael@0 | 106 | /** |
michael@0 | 107 | * Returns the app id of the app the load is occurring is in. Returns |
michael@0 | 108 | * nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app. |
michael@0 | 109 | */ |
michael@0 | 110 | readonly attribute unsigned long appId; |
michael@0 | 111 | |
michael@0 | 112 | }; |