netwerk/base/public/nsILoadContextInfo.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsILoadContextInfo.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +/**
    1.12 + * Helper interface to carry informatin about the load context
    1.13 + * encapsulating an AppID, IsInBrowser and IsPrivite properties.
    1.14 + * It shall be used where nsILoadContext cannot be used or is not
    1.15 + * available.
    1.16 + */
    1.17 +[scriptable, uuid(1ea9cbdb-9df4-46a0-8c45-f4091aad9459)]
    1.18 +interface nsILoadContextInfo : nsISupports
    1.19 +{
    1.20 +  /**
    1.21 +   * Whether the context is in a Private Browsing mode
    1.22 +   */
    1.23 +  readonly attribute boolean isPrivate;
    1.24 +
    1.25 +  /**
    1.26 +   * Whether the context belongs under an App
    1.27 +   */
    1.28 +  const unsigned long NO_APP_ID = 0;
    1.29 +  const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX
    1.30 +  readonly attribute uint32_t appId;
    1.31 +
    1.32 +  /**
    1.33 +   * Whether the context is in a browser tag
    1.34 +   */
    1.35 +  readonly attribute boolean isInBrowserElement;
    1.36 +
    1.37 +  /**
    1.38 +   * Whether the load is initiated as anonymous
    1.39 +   */
    1.40 +  readonly attribute boolean isAnonymous;
    1.41 +
    1.42 +%{C++
    1.43 +  /**
    1.44 +   * De-XPCOMed getters
    1.45 +   */
    1.46 +  bool IsPrivate()
    1.47 +  {
    1.48 +    bool pb;
    1.49 +    GetIsPrivate(&pb);
    1.50 +    return pb;
    1.51 +  }
    1.52 +
    1.53 +  uint32_t AppId()
    1.54 +  {
    1.55 +    uint32_t appId;
    1.56 +    GetAppId(&appId);
    1.57 +    return appId;
    1.58 +  }
    1.59 +
    1.60 +  bool IsInBrowserElement()
    1.61 +  {
    1.62 +    bool ib;
    1.63 +    GetIsInBrowserElement(&ib);
    1.64 +    return ib;
    1.65 +  }
    1.66 +
    1.67 +  bool IsAnonymous()
    1.68 +  {
    1.69 +    bool anon;
    1.70 +    GetIsAnonymous(&anon);
    1.71 +    return anon;
    1.72 +  }
    1.73 +
    1.74 +  bool Equals(nsILoadContextInfo *aOther)
    1.75 +  {
    1.76 +    return (IsPrivate() == aOther->IsPrivate() &&
    1.77 +            AppId() == aOther->AppId() &&
    1.78 +            IsInBrowserElement() == aOther->IsInBrowserElement() &&
    1.79 +            IsAnonymous() == aOther->IsAnonymous());
    1.80 +  }
    1.81 +%}
    1.82 +};

mercurial