Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
nsGlobalHistoryAdapter Class Reference

#include <nsGlobalHistoryAdapter.h>

Inheritance diagram for nsGlobalHistoryAdapter:
Inheritance graph
[legend]
Collaboration diagram for nsGlobalHistoryAdapter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NS_DEFINE_STATIC_CID_ACCESSOR (NS_GLOBALHISTORYADAPTER_CID)
void addURI (in nsIURI aURI, in boolean aRedirect, in boolean aToplevel, in nsIURI aReferrer)
 Add a URI to global history.
boolean isVisited (in nsIURI aURI)
 Checks to see whether the given URI is in history.
void setPageTitle (in nsIURI aURI, in AString aTitle)
 Set the page title for the given uri.

Static Public Member Functions

NS_DECL_ISUPPORTS static
NS_DECL_NSIGLOBALHISTORY2
NS_METHOD 
Create (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_METHOD RegisterSelf (nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)

Private Member Functions

 nsGlobalHistoryAdapter ()
 ~nsGlobalHistoryAdapter ()
nsresult Init ()

Private Attributes

nsCOMPtr< nsIGlobalHistorymHistory

Detailed Description

Definition at line 53 of file nsGlobalHistoryAdapter.h.


Constructor & Destructor Documentation

Definition at line 106 of file nsGlobalHistoryAdapter.cpp.

{ }

Here is the caller graph for this function:

Definition at line 109 of file nsGlobalHistoryAdapter.cpp.

{ }

Member Function Documentation

void nsIGlobalHistory2::addURI ( in nsIURI  aURI,
in boolean  aRedirect,
in boolean  aToplevel,
in nsIURI  aReferrer 
) [inherited]

Add a URI to global history.

Parameters:
aURIthe URI of the page
aRedirectwhether the URI was redirected to another location; this is 'true' for the original URI which is redirected.
aToplevelwhether the URI is loaded in a top-level window
aReferrerthe URI of the referring page
Note:
Docshell will not filter out URI schemes like chrome: data: about: and view-source:. Embedders should consider filtering out these schemes and others, e.g. mailbox: for the main URI and the referrer.
nsresult nsGlobalHistoryAdapter::Create ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 48 of file nsGlobalHistoryAdapter.cpp.

{
  nsresult rv;

  if (aOuter) {
    rv = NS_ERROR_NO_AGGREGATION;
    return rv;
  }

  nsGlobalHistoryAdapter* adapter = new nsGlobalHistoryAdapter();
  if (!adapter) {
    rv = NS_ERROR_OUT_OF_MEMORY;
    return rv;
  }

  NS_ADDREF(adapter);
  rv = adapter->Init();
  if (NS_SUCCEEDED(rv)) {
    rv = adapter->QueryInterface(aIID, aResult);
  }
  NS_RELEASE(adapter);

  return rv;
}

Here is the call graph for this function:

Definition at line 113 of file nsGlobalHistoryAdapter.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIComponentRegistrar> compReg;
  rv = NS_GetComponentRegistrar(getter_AddRefs(compReg));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCID *cid;
  rv = compReg->ContractIDToCID(NS_GLOBALHISTORY_CONTRACTID, &cid);
  if (NS_FAILED(rv)) {
    rv = NS_ERROR_FACTORY_NOT_REGISTERED;
    return rv;
  }

  if (cid->Equals(nsGlobalHistory2Adapter::GetCID())) {
    rv = NS_ERROR_FACTORY_NOT_REGISTERED;
    return rv;
  }

  NS_WARNING("Using nsIGlobalHistory2->nsIGlobalHistory adapter.");
  mHistory = do_GetService(NS_GLOBALHISTORY_CONTRACTID, &rv);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Checks to see whether the given URI is in history.

Parameters:
aURIthe uri to the page
Returns:
true if a URI has been visited
nsresult nsGlobalHistoryAdapter::RegisterSelf ( nsIComponentManager aCompMgr,
nsIFile aPath,
const char *  aLoaderStr,
const char *  aType,
const nsModuleComponentInfo aInfo 
) [static]

Definition at line 76 of file nsGlobalHistoryAdapter.cpp.

{
  nsresult rv;
  PRBool registered;
  nsCOMPtr<nsIComponentRegistrar> compReg( do_QueryInterface(aCompMgr) );
  if (!compReg) {
    rv = NS_ERROR_UNEXPECTED;
    return rv;
  }

  rv = compReg->IsContractIDRegistered(NS_GLOBALHISTORY2_CONTRACTID, &registered);
  if (NS_FAILED(rv)) return rv;

  // If the embedder has already registered the contractID, we don't want to
  // register ourself. Ideally the component manager would handle this for us.
  if (registered) {
    rv = NS_OK;
    return rv;
  }

  return compReg->RegisterFactoryLocation(GetCID(),
                                          "nsGlobalHistoryAdapter",
                                          NS_GLOBALHISTORY2_CONTRACTID,
                                          aPath, aLoaderStr, aType);
}                                     

Here is the call graph for this function:

void nsIGlobalHistory2::setPageTitle ( in nsIURI  aURI,
in AString  aTitle 
) [inherited]

Set the page title for the given uri.

URIs that are not already in global history will not be added.

Parameters:
aURIthe URI for which to set to the title
aTitlethe page title

Member Data Documentation

Definition at line 76 of file nsGlobalHistoryAdapter.h.


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