Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsP3PService Class Reference

#include <nsP3PService.h>

Inheritance diagram for nsP3PService:
Inheritance graph
Collaboration diagram for nsP3PService:
Collaboration graph

List of all members.

Public Member Functions

nsP3PService ()
virtual ~nsP3PService ()
nsCookieStatus getConsent (in nsIURI uri, in nsIHttpChannel httpChannel, in boolean isForeign, out nsCookiePolicy policy)
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.

Protected Member Functions

void PrefChanged (nsIPrefBranch *aPrefBranch)
nsresult ProcessResponseHeader (nsIHttpChannel *aHttpChannel)

Protected Attributes

nsAutoPtr< nsCompactPolicymCompactPolicy
nsXPIDLCString mCookiesP3PString

Detailed Description

Definition at line 49 of file nsP3PService.h.

Constructor & Destructor Documentation

Definition at line 58 of file nsP3PService.cpp.

  // we can live without a prefservice, so errors here aren't fatal
  nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
  if (prefBranch) {
    prefBranch->AddObserver(kCookiesP3PStringPref, this, PR_FALSE);

Here is the call graph for this function:

Definition at line 68 of file nsP3PService.cpp.


Member Function Documentation

nsCookieStatus nsICookieConsent::getConsent ( in nsIURI  uri,
in nsIHttpChannel  httpChannel,
in boolean  isForeign,
out nsCookiePolicy  policy 
) [inherited]


gives a decision on what should be done with a cookie, based on a site's p3p policy and the user's preferences. the policy for the given URI and channel is also returned.

urithe URI to find the policy for
httpChannelthe channel to extract the p3p headers from
isForeigntrue if the cookie originates from a third-party site. this is used to decide the cookie status based on user preferences.
policythe policy for the given URI, or nsICookie::POLICY_UNKNOWN if one cannot be found. valid values are defined in nsICookie.idl.
nsCookieStatus value. valid values are defined in nsICookie.idl.
void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.
void nsP3PService::PrefChanged ( nsIPrefBranch aPrefBranch) [protected]

Definition at line 73 of file nsP3PService.cpp.

  nsresult rv;
  if (aPrefBranch) {
    rv = aPrefBranch->GetCharPref(kCookiesP3PStringPref, getter_Copies(mCookiesP3PString));

  // check for a malformed string, or no prefbranch
  if (!aPrefBranch || NS_FAILED(rv) || mCookiesP3PString.Length() != 8) {
    // reassign to default string

Here is the call graph for this function:

Definition at line 101 of file nsP3PService.cpp.

  nsresult result = NS_OK;
  nsCAutoString p3pHeader;
  aHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING("P3P"), p3pHeader);

  if (!p3pHeader.IsEmpty()) {
    nsCOMPtr<nsIURI> uri;
    if (uri) {
      if (!mCompactPolicy) {
        mCompactPolicy = new nsCompactPolicy();

      nsCAutoString spec;

      result = mCompactPolicy->OnHeaderAvailable(p3pHeader.get(), spec.get());

  return result;

Here is the call graph for this function:

Member Data Documentation

Definition at line 66 of file nsP3PService.h.

Definition at line 86 of file nsP3PService.h.

The documentation for this class was generated from the following files: