netwerk/base/public/nsILoadContextInfo.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 /**
michael@0 9 * Helper interface to carry informatin about the load context
michael@0 10 * encapsulating an AppID, IsInBrowser and IsPrivite properties.
michael@0 11 * It shall be used where nsILoadContext cannot be used or is not
michael@0 12 * available.
michael@0 13 */
michael@0 14 [scriptable, uuid(1ea9cbdb-9df4-46a0-8c45-f4091aad9459)]
michael@0 15 interface nsILoadContextInfo : nsISupports
michael@0 16 {
michael@0 17 /**
michael@0 18 * Whether the context is in a Private Browsing mode
michael@0 19 */
michael@0 20 readonly attribute boolean isPrivate;
michael@0 21
michael@0 22 /**
michael@0 23 * Whether the context belongs under an App
michael@0 24 */
michael@0 25 const unsigned long NO_APP_ID = 0;
michael@0 26 const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX
michael@0 27 readonly attribute uint32_t appId;
michael@0 28
michael@0 29 /**
michael@0 30 * Whether the context is in a browser tag
michael@0 31 */
michael@0 32 readonly attribute boolean isInBrowserElement;
michael@0 33
michael@0 34 /**
michael@0 35 * Whether the load is initiated as anonymous
michael@0 36 */
michael@0 37 readonly attribute boolean isAnonymous;
michael@0 38
michael@0 39 %{C++
michael@0 40 /**
michael@0 41 * De-XPCOMed getters
michael@0 42 */
michael@0 43 bool IsPrivate()
michael@0 44 {
michael@0 45 bool pb;
michael@0 46 GetIsPrivate(&pb);
michael@0 47 return pb;
michael@0 48 }
michael@0 49
michael@0 50 uint32_t AppId()
michael@0 51 {
michael@0 52 uint32_t appId;
michael@0 53 GetAppId(&appId);
michael@0 54 return appId;
michael@0 55 }
michael@0 56
michael@0 57 bool IsInBrowserElement()
michael@0 58 {
michael@0 59 bool ib;
michael@0 60 GetIsInBrowserElement(&ib);
michael@0 61 return ib;
michael@0 62 }
michael@0 63
michael@0 64 bool IsAnonymous()
michael@0 65 {
michael@0 66 bool anon;
michael@0 67 GetIsAnonymous(&anon);
michael@0 68 return anon;
michael@0 69 }
michael@0 70
michael@0 71 bool Equals(nsILoadContextInfo *aOther)
michael@0 72 {
michael@0 73 return (IsPrivate() == aOther->IsPrivate() &&
michael@0 74 AppId() == aOther->AppId() &&
michael@0 75 IsInBrowserElement() == aOther->IsInBrowserElement() &&
michael@0 76 IsAnonymous() == aOther->IsAnonymous());
michael@0 77 }
michael@0 78 %}
michael@0 79 };

mercurial