|
1 /* -*- Mode: C++; tab-width: 2; 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 * Helper interface to carry informatin about the load context |
|
10 * encapsulating an AppID, IsInBrowser and IsPrivite properties. |
|
11 * It shall be used where nsILoadContext cannot be used or is not |
|
12 * available. |
|
13 */ |
|
14 [scriptable, uuid(1ea9cbdb-9df4-46a0-8c45-f4091aad9459)] |
|
15 interface nsILoadContextInfo : nsISupports |
|
16 { |
|
17 /** |
|
18 * Whether the context is in a Private Browsing mode |
|
19 */ |
|
20 readonly attribute boolean isPrivate; |
|
21 |
|
22 /** |
|
23 * Whether the context belongs under an App |
|
24 */ |
|
25 const unsigned long NO_APP_ID = 0; |
|
26 const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX |
|
27 readonly attribute uint32_t appId; |
|
28 |
|
29 /** |
|
30 * Whether the context is in a browser tag |
|
31 */ |
|
32 readonly attribute boolean isInBrowserElement; |
|
33 |
|
34 /** |
|
35 * Whether the load is initiated as anonymous |
|
36 */ |
|
37 readonly attribute boolean isAnonymous; |
|
38 |
|
39 %{C++ |
|
40 /** |
|
41 * De-XPCOMed getters |
|
42 */ |
|
43 bool IsPrivate() |
|
44 { |
|
45 bool pb; |
|
46 GetIsPrivate(&pb); |
|
47 return pb; |
|
48 } |
|
49 |
|
50 uint32_t AppId() |
|
51 { |
|
52 uint32_t appId; |
|
53 GetAppId(&appId); |
|
54 return appId; |
|
55 } |
|
56 |
|
57 bool IsInBrowserElement() |
|
58 { |
|
59 bool ib; |
|
60 GetIsInBrowserElement(&ib); |
|
61 return ib; |
|
62 } |
|
63 |
|
64 bool IsAnonymous() |
|
65 { |
|
66 bool anon; |
|
67 GetIsAnonymous(&anon); |
|
68 return anon; |
|
69 } |
|
70 |
|
71 bool Equals(nsILoadContextInfo *aOther) |
|
72 { |
|
73 return (IsPrivate() == aOther->IsPrivate() && |
|
74 AppId() == aOther->AppId() && |
|
75 IsInBrowserElement() == aOther->IsInBrowserElement() && |
|
76 IsAnonymous() == aOther->IsAnonymous()); |
|
77 } |
|
78 %} |
|
79 }; |