Back to index

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

#include <nsDocLoadObserver.h>

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

List of all members.

Public Member Functions

 nsDocLoadObserver ()
virtual ~nsDocLoadObserver ()
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER void 
AddEchoRequester (OSType appSignature)
void RemoveEchoRequester (OSType appSignature)
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 Register ()
void Unregister ()

Private Attributes

PRBool mRegistered
nsVoidArray mEchoRequesters

Detailed Description

Definition at line 62 of file nsDocLoadObserver.h.


Constructor & Destructor Documentation

Definition at line 50 of file nsDocLoadObserver.cpp.

Definition at line 55 of file nsDocLoadObserver.cpp.

{
}

Member Function Documentation

Definition at line 95 of file nsDocLoadObserver.cpp.

{
  // make sure an application is only in the list once
  mEchoRequesters.RemoveElement((void*)appSignature);
  
       mEchoRequesters.AppendElement((void*)appSignature);
       Register();     // ensure we are registered
}

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.

Definition at line 62 of file nsDocLoadObserver.cpp.

{
       if (!mRegistered)
       {
              nsresult rv;
              nsCOMPtr<nsIObserverService> anObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
              if (NS_SUCCEEDED(rv))
              {
                     if (NS_SUCCEEDED(anObserverService->AddObserver(this, "EndDocumentLoad", PR_FALSE)))
                     {
                            mRegistered = PR_TRUE;
                     }
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 104 of file nsDocLoadObserver.cpp.

{
       mEchoRequesters.RemoveElement((void*)appSignature);
       if (mEchoRequesters.Count() == 0)
         Unregister();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file nsDocLoadObserver.cpp.

{
       if (mRegistered)
       {
              nsresult rv;
              nsCOMPtr<nsIObserverService> anObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
              if (NS_SUCCEEDED(rv))
              {
                     if (NS_SUCCEEDED(anObserverService->RemoveObserver(this, 
                            "EndDocumentLoad")))
                     {
                            mRegistered = PR_FALSE;
                     }
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 88 of file nsDocLoadObserver.h.

Definition at line 86 of file nsDocLoadObserver.h.


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