Back to index

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

#include <nsContentDLF.h>

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

List of all members.

Public Member Functions

 nsContentDLF ()
virtual ~nsContentDLF ()
NS_DECL_ISUPPORTS
NS_DECL_NSIDOCUMENTLOADERFACTORY
nsresult 
InitUAStyleSheet ()
nsresult CreateDocument (const char *aCommand, nsIChannel *aChannel, nsILoadGroup *aLoadGroup, nsISupports *aContainer, const nsCID &aDocumentCID, nsIStreamListener **aDocListener, nsIContentViewer **aDocViewer)
nsresult CreateRDFDocument (const char *aCommand, nsIChannel *aChannel, nsILoadGroup *aLoadGroup, const char *aContentType, nsISupports *aContainer, nsISupports *aExtraInfo, nsIStreamListener **aDocListener, nsIContentViewer **aDocViewer)
nsresult CreateRDFDocument (nsISupports *, nsCOMPtr< nsIDocument > *, nsCOMPtr< nsIDocumentViewer > *)
nsIContentViewer createInstance (in string aCommand, in nsIChannel aChannel, in nsILoadGroup aLoadGroup, in string aContentType, in nsISupports aContainer, in nsISupports aExtraInfo, out nsIStreamListener aDocListenerResult)
nsIContentViewer createInstanceForDocument (in nsISupports aContainer, in nsIDocument aDocument, in string aCommand)
nsIDocument createBlankDocument (in nsILoadGroup aLoadGroup)

Static Public Member Functions

static NS_IMETHODIMP RegisterDocumentFactories (nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLocation, const char *aType, const nsModuleComponentInfo *aInfo)
static NS_IMETHODIMP UnregisterDocumentFactories (nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aRegistryLocation, const nsModuleComponentInfo *aInfo)

Static Public Attributes

static nsICSSStyleSheetgUAStyleSheet

Static Private Member Functions

static nsresult EnsureUAStyleSheet ()

Detailed Description

Definition at line 56 of file nsContentDLF.h.


Constructor & Destructor Documentation

Definition at line 148 of file nsContentDLF.cpp.

{
}

Definition at line 152 of file nsContentDLF.cpp.

{
}

Member Function Documentation

nsresult nsContentDLF::CreateDocument ( const char *  aCommand,
nsIChannel aChannel,
nsILoadGroup aLoadGroup,
nsISupports *  aContainer,
const nsCID aDocumentCID,
nsIStreamListener **  aDocListener,
nsIContentViewer **  aDocViewer 
)

Definition at line 396 of file nsContentDLF.cpp.

{
  nsresult rv = NS_ERROR_FAILURE;

  nsCOMPtr<nsIURI> aURL;
  rv = aChannel->GetURI(getter_AddRefs(aURL));
  if (NS_FAILED(rv)) return rv;

#ifdef NOISY_CREATE_DOC
  if (nsnull != aURL) {
    nsAutoString tmp;
    aURL->ToString(tmp);
    fputs(NS_LossyConvertUCS2toASCII(tmp).get(), stdout);
    printf(": creating document\n");
  }
#endif

  nsCOMPtr<nsIDocument> doc;
  nsCOMPtr<nsIDocumentViewer> docv;
  do {
    // Create the document
    doc = do_CreateInstance(aDocumentCID, &rv);
    if (NS_FAILED(rv))
      break;

    // Create the document viewer  XXX: could reuse document viewer here!
    rv = NS_NewDocumentViewer(getter_AddRefs(docv));
    if (NS_FAILED(rv))
      break;
    docv->SetUAStyleSheet(gUAStyleSheet);

    doc->SetContainer(aContainer);

    // Initialize the document to begin loading the data.  An
    // nsIStreamListener connected to the parser is returned in
    // aDocListener.
    rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
    if (NS_FAILED(rv))
      break;

    // Bind the document to the Content Viewer
    rv = docv->LoadStart(doc);
    *aDocViewer = docv;
    NS_IF_ADDREF(*aDocViewer);
  } while (PR_FALSE);

  return rv;
}

Here is the call graph for this function:

nsIContentViewer nsIDocumentLoaderFactory::createInstance ( in string  aCommand,
in nsIChannel  aChannel,
in nsILoadGroup  aLoadGroup,
in string  aContentType,
in nsISupports  aContainer,
in nsISupports  aExtraInfo,
out nsIStreamListener  aDocListenerResult 
) [inherited]
nsIContentViewer nsIDocumentLoaderFactory::createInstanceForDocument ( in nsISupports  aContainer,
in nsIDocument  aDocument,
in string  aCommand 
) [inherited]
nsresult nsContentDLF::CreateRDFDocument ( const char *  aCommand,
nsIChannel aChannel,
nsILoadGroup aLoadGroup,
const char *  aContentType,
nsISupports *  aContainer,
nsISupports *  aExtraInfo,
nsIStreamListener **  aDocListener,
nsIContentViewer **  aDocViewer 
)

Definition at line 475 of file nsContentDLF.cpp.

{
  nsCOMPtr<nsIDocument> doc;
  nsCOMPtr<nsIDocumentViewer> docv;
  nsresult rv = CreateRDFDocument(aExtraInfo, address_of(doc), address_of(docv));
  if (NS_FAILED(rv)) {
    return rv;
  }

  nsCOMPtr<nsIURI> aURL;
  rv = aChannel->GetURI(getter_AddRefs(aURL));
  if (NS_FAILED(rv)) return rv;

  /* 
   * Initialize the document to begin loading the data...
   *
   * An nsIStreamListener connected to the parser is returned in
   * aDocListener.
   */

  doc->SetContainer(aContainer);

  rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
  if (NS_SUCCEEDED(rv)) {
    /*
     * Bind the document to the Content Viewer...
     */
    rv = docv->LoadStart(doc);
    *aDocViewer = docv;
    NS_IF_ADDREF(*aDocViewer);
  }
   
  return rv;
}

Here is the call graph for this function:

nsresult nsContentDLF::CreateRDFDocument ( nsISupports *  aExtraInfo,
nsCOMPtr< nsIDocument > *  doc,
nsCOMPtr< nsIDocumentViewer > *  docv 
)

Definition at line 453 of file nsContentDLF.cpp.

{
  nsresult rv = NS_ERROR_FAILURE;
    
  // Create the XUL document
  *doc = do_CreateInstance(kXULDocumentCID, &rv);
  if (NS_FAILED(rv)) return rv;

  // Create the image content viewer...
  rv = NS_NewDocumentViewer(getter_AddRefs(*docv));
  if (NS_FAILED(rv)) return rv;

  // Load the UA style sheet if we haven't already done that
  (*docv)->SetUAStyleSheet(gUAStyleSheet);

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 631 of file nsContentDLF.cpp.

{
  if (gUAStyleSheet)
    return NS_OK;

  // Load the UA style sheet
  nsCOMPtr<nsIURI> uri;
  nsresult rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING(UA_CSS_URL));
  if (NS_FAILED(rv)) {
#ifdef DEBUG
    printf("*** open of %s failed: error=%x\n", UA_CSS_URL, rv);
#endif
    return rv;
  }
  nsCOMPtr<nsICSSLoader> cssLoader;
  NS_NewCSSLoader(getter_AddRefs(cssLoader));
  if (!cssLoader)
    return NS_ERROR_OUT_OF_MEMORY;
  nsCOMPtr<nsICSSLoader_MOZILLA_1_8_BRANCH> loader = do_QueryInterface(cssLoader);
  rv = loader->LoadSheetSync(uri, PR_TRUE, &gUAStyleSheet);
#ifdef DEBUG
  if (NS_FAILED(rv))
    printf("*** open of %s failed: error=%x\n", UA_CSS_URL, rv);
#endif
  return rv;
}

Here is the call graph for this function:

NS_DECL_ISUPPORTS NS_DECL_NSIDOCUMENTLOADERFACTORY nsresult nsContentDLF::InitUAStyleSheet ( )
NS_IMETHODIMP nsContentDLF::RegisterDocumentFactories ( nsIComponentManager aCompMgr,
nsIFile aPath,
const char *  aLocation,
const char *  aType,
const nsModuleComponentInfo aInfo 
) [static]

Definition at line 575 of file nsContentDLF.cpp.

{
  nsresult rv;

  nsCOMPtr<nsICategoryManager> catmgr(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
  if (NS_FAILED(rv)) return rv;

  do {
    rv = RegisterTypes(catmgr, gHTMLTypes);
    if (NS_FAILED(rv))
      break;
    rv = RegisterTypes(catmgr, gXMLTypes);
    if (NS_FAILED(rv))
      break;
    rv = RegisterTypes(catmgr, gRDFTypes);
    if (NS_FAILED(rv))
      break;
  } while (PR_FALSE);
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsContentDLF::UnregisterDocumentFactories ( nsIComponentManager aCompMgr,
nsIFile aPath,
const char *  aRegistryLocation,
const nsModuleComponentInfo aInfo 
) [static]

Definition at line 601 of file nsContentDLF.cpp.

{
  nsresult rv;
  nsCOMPtr<nsICategoryManager> catmgr(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
  if (NS_FAILED(rv)) return rv;

  do {
    rv = UnregisterTypes(catmgr, gHTMLTypes);
    if (NS_FAILED(rv))
      break;
    rv = UnregisterTypes(catmgr, gXMLTypes);
    if (NS_FAILED(rv))
      break;
#ifdef MOZ_SVG
    rv = UnregisterTypes(catmgr, gSVGTypes);
    if (NS_FAILED(rv))
      break;
#endif
    rv = UnregisterTypes(catmgr, gRDFTypes);
    if (NS_FAILED(rv))
      break;
  } while (PR_FALSE);

  return rv;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 88 of file nsContentDLF.h.


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