michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * Helper interface to carry informatin about the load context michael@0: * encapsulating an AppID, IsInBrowser and IsPrivite properties. michael@0: * It shall be used where nsILoadContext cannot be used or is not michael@0: * available. michael@0: */ michael@0: [scriptable, uuid(1ea9cbdb-9df4-46a0-8c45-f4091aad9459)] michael@0: interface nsILoadContextInfo : nsISupports michael@0: { michael@0: /** michael@0: * Whether the context is in a Private Browsing mode michael@0: */ michael@0: readonly attribute boolean isPrivate; michael@0: michael@0: /** michael@0: * Whether the context belongs under an App michael@0: */ michael@0: const unsigned long NO_APP_ID = 0; michael@0: const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX michael@0: readonly attribute uint32_t appId; michael@0: michael@0: /** michael@0: * Whether the context is in a browser tag michael@0: */ michael@0: readonly attribute boolean isInBrowserElement; michael@0: michael@0: /** michael@0: * Whether the load is initiated as anonymous michael@0: */ michael@0: readonly attribute boolean isAnonymous; michael@0: michael@0: %{C++ michael@0: /** michael@0: * De-XPCOMed getters michael@0: */ michael@0: bool IsPrivate() michael@0: { michael@0: bool pb; michael@0: GetIsPrivate(&pb); michael@0: return pb; michael@0: } michael@0: michael@0: uint32_t AppId() michael@0: { michael@0: uint32_t appId; michael@0: GetAppId(&appId); michael@0: return appId; michael@0: } michael@0: michael@0: bool IsInBrowserElement() michael@0: { michael@0: bool ib; michael@0: GetIsInBrowserElement(&ib); michael@0: return ib; michael@0: } michael@0: michael@0: bool IsAnonymous() michael@0: { michael@0: bool anon; michael@0: GetIsAnonymous(&anon); michael@0: return anon; michael@0: } michael@0: michael@0: bool Equals(nsILoadContextInfo *aOther) michael@0: { michael@0: return (IsPrivate() == aOther->IsPrivate() && michael@0: AppId() == aOther->AppId() && michael@0: IsInBrowserElement() == aOther->IsInBrowserElement() && michael@0: IsAnonymous() == aOther->IsAnonymous()); michael@0: } michael@0: %} michael@0: };