|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 /** |
|
9 * This interface is implemented by channels which support overriding the |
|
10 * privacy state of the channel. |
|
11 * |
|
12 * This interface must be used only from the XPCOM main thread. |
|
13 */ |
|
14 [scriptable, uuid(df702bb0-55b8-11e2-bcfd-0800200c9a66)] |
|
15 interface nsIPrivateBrowsingChannel : nsISupports |
|
16 { |
|
17 /** |
|
18 * Determine whether the channel is tied to a private browsing window. |
|
19 * |
|
20 * This value can be set only before the channel is opened. Setting it |
|
21 * after that does not have any effect. This value overrides the privacy |
|
22 * state of the channel, which means that if you call this method, then |
|
23 * the loadGroup and load context will no longer be consulted when we |
|
24 * need to know the private mode status for a channel. |
|
25 * |
|
26 * Note that this value is only meant to be used when the channel's privacy |
|
27 * status cannot be obtained from the loadGroup or load context (for |
|
28 * example, when the channel is not associated with any loadGroup or load |
|
29 * context.) Setting this value directly should be avoided if possible. |
|
30 * |
|
31 * Implementations must enforce the ordering semantics of this function by |
|
32 * raising errors if setPrivate is called on a channel which has a loadGroup |
|
33 * and/or callbacks that implement nsILoadContext, or if the loadGroup |
|
34 * or notificationCallbacks are set after setPrivate has been called. |
|
35 * |
|
36 * @param aPrivate whether the channel should be opened in private mode. |
|
37 */ |
|
38 void setPrivate(in boolean aPrivate); |
|
39 |
|
40 /** |
|
41 * States whether the channel is in private browsing mode. This may either |
|
42 * happen because the channel is opened from a private mode context or |
|
43 * when the mode is explicitly set with ::setPrivate(). |
|
44 * |
|
45 * This attribute is equivalent to NS_UsePrivateBrowsing(), but scriptable. |
|
46 */ |
|
47 readonly attribute boolean isChannelPrivate; |
|
48 |
|
49 /* |
|
50 * This function is used to determine whether the channel's private mode |
|
51 * has been overridden by a call to setPrivate. It is intended to be used |
|
52 * by NS_UsePrivateBrowsing(), and you should not call it directly. |
|
53 * |
|
54 * @param aValue the overridden value. This will only be set if the function |
|
55 * returns true. |
|
56 */ |
|
57 [noscript] boolean isPrivateModeOverriden(out boolean aValue); |
|
58 }; |