Back to index

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

#include <nsDetectionAdaptor.h>

Inheritance diagram for nsMyObserver:
Inheritance graph
Collaboration diagram for nsMyObserver:
Collaboration graph

List of all members.

Public Member Functions

 nsMyObserver (void)
virtual ~nsMyObserver (void)
NS_IMETHOD Init (nsIWebShellServices *aWebShellSvc, nsIDocument *aDocument, nsIParser *aParser, const char *aCharset, const char *aCommand)
NS_IMETHOD Notify (const char *aCharset, nsDetectionConfident aConf)
void SetNotifyByReload (PRBool aByReload)

Private Attributes

nsCOMPtr< nsIWebShellServicesmWebShellSvc
PRBool mNotifyByReload
nsCAutoString mCharset
nsCAutoString mCommand

Detailed Description

Definition at line 50 of file nsDetectionAdaptor.h.

Constructor & Destructor Documentation

virtual nsMyObserver::~nsMyObserver ( void  ) [inline, virtual]

Definition at line 63 of file nsDetectionAdaptor.h.

     // do not release nor delete mWeakRefDocument
     // do not release nor delete mWeakRefParser

Member Function Documentation

NS_IMETHODIMP nsMyObserver::Init ( nsIWebShellServices aWebShellSvc,
nsIDocument aDocument,
nsIParser aParser,
const char *  aCharset,
const char *  aCommand 

Definition at line 83 of file nsDetectionAdaptor.cpp.

    if(aCommand) {
        mCommand = aCommand;
    if(aCharset) {
        mCharset = aCharset;
    if(aDocument) {
        mWeakRefDocument = aDocument;
    if(aParser) {
        mWeakRefParser = aParser;
    if(nsnull != aWebShellSvc)
        mWebShellSvc = aWebShellSvc;
        return NS_OK;
NS_IMETHODIMP nsMyObserver::Notify ( const char *  aCharset,
nsDetectionConfident  aConf 
) [virtual]

Implements nsICharsetDetectionObserver.

Definition at line 50 of file nsDetectionAdaptor.cpp.

    nsresult rv = NS_OK;

    if(mWeakRefParser) {
      nsCAutoString existingCharset;
      PRInt32 existingSource;
      mWeakRefParser->GetDocumentCharset(existingCharset, existingSource);  
      if (existingSource >= kCharsetFromAutoDetection) 
        return NS_OK;
    if(!mCharset.Equals(aCharset)) {
      if(mNotifyByReload) {
        rv = mWebShellSvc->SetRendering( PR_FALSE);
        rv = mWebShellSvc->StopDocumentLoad();
        rv = mWebShellSvc->ReloadDocument(aCharset, kCharsetFromAutoDetection);
      } else {
        nsDependentCString newcharset(aCharset);
        if (mWeakRefParser) {
          mWeakRefParser->SetDocumentCharset(newcharset, kCharsetFromAutoDetection);
          nsCOMPtr<nsIContentSink> contentSink = mWeakRefParser->GetContentSink();
          if (contentSink)
    return NS_OK;

Here is the call graph for this function:

void nsMyObserver::SetNotifyByReload ( PRBool  aByReload) [inline]

Definition at line 79 of file nsDetectionAdaptor.h.

{ mNotifyByReload = aByReload; };

Member Data Documentation

Definition at line 94 of file nsDetectionAdaptor.h.

Definition at line 95 of file nsDetectionAdaptor.h.

Definition at line 82 of file nsDetectionAdaptor.h.

Definition at line 92 of file nsDetectionAdaptor.h.

Definition at line 93 of file nsDetectionAdaptor.h.

Definition at line 79 of file nsDetectionAdaptor.h.

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