Back to index

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

#include <nsCompactPolicy.h>

List of all members.

Public Member Functions

 nsCompactPolicy ()
 ~nsCompactPolicy ()
nsresult OnHeaderAvailable (const char *aP3PHeader, const char *aURI)
nsresult GetConsent (const char *aURI, PRInt32 &aConsent)

Static Public Member Functions

static nsresult InitTokenTable (void)
static void DestroyTokenTable (void)

Protected Attributes

nsHashtable mPolicyTable

Detailed Description

Definition at line 64 of file nsCompactPolicy.h.


Constructor & Destructor Documentation

Definition at line 253 of file nsCompactPolicy.cpp.

                                  {
}

Definition at line 256 of file nsCompactPolicy.cpp.

                                   {
}

Member Function Documentation

Definition at line 273 of file nsCompactPolicy.cpp.

{
  delete gTokenTable;
}

Here is the caller graph for this function:

nsresult nsCompactPolicy::GetConsent ( const char *  aURI,
PRInt32 aConsent 
)

Definition at line 305 of file nsCompactPolicy.cpp.

{
  NS_ENSURE_ARG_POINTER(aURI);

  nsresult result = NS_OK;

  nsCStringKey key(aURI, -1, nsCStringKey::NEVER_OWN);
  if (mPolicyTable.Exists(&key)) {
    aConsent = NS_PTR_TO_INT32(mPolicyTable.Get(&key));
  }
  
  return result;
}

Definition at line 260 of file nsCompactPolicy.cpp.

{
  gTokenTable = new nsHashtable();
  NS_ENSURE_TRUE(gTokenTable, NS_ERROR_OUT_OF_MEMORY);

  for (PRInt32 i = 0; i < NS_CP_TOKEN_MAX; i++) {
    nsCStringKey key(kTokens[i], -1, nsCStringKey::NEVER_OWN);
    gTokenTable->Put(&key, (void*)(i+1));
  }
  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsCompactPolicy::OnHeaderAvailable ( const char *  aP3PHeader,
const char *  aURI 
)

Definition at line 279 of file nsCompactPolicy.cpp.

{
  NS_ENSURE_ARG_POINTER(aP3PHeader);
  NS_ENSURE_ARG_POINTER(aSpec);

  nsresult result = NS_OK;
    
  nsDependentCString header(aP3PHeader);
  nsACString::const_iterator begin, end;

  header.BeginReading(begin);
  header.EndReading(end);

  if (FindCompactPolicy(begin,end)) {
    nsCStringKey key(aSpec);
    if (!mPolicyTable.Exists(&key)) {
      PRInt32 consent =  ParsePolicy(begin,end);
      mPolicyTable.Put(&key, NS_INT32_TO_PTR(consent));
    }
  }
  
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

nsHashtable nsCompactPolicy::mPolicyTable [protected]

Definition at line 80 of file nsCompactPolicy.h.


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