2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-05-29 05:30:27 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2001-10-20 00:52:59 +04:00
|
|
|
|
|
|
|
interface nsIObserver;
|
|
|
|
interface nsISimpleEnumerator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nsIObserverService
|
|
|
|
*
|
|
|
|
* Service allows a client listener (nsIObserver) to register and unregister for
|
|
|
|
* notifications of specific string referenced topic. Service also provides a
|
|
|
|
* way to notify registered listeners and a way to enumerate registered client
|
|
|
|
* listeners.
|
|
|
|
*/
|
1999-05-29 05:30:27 +04:00
|
|
|
|
|
|
|
[scriptable, uuid(D07F5192-E3D1-11d2-8ACD-00105A1B8860)]
|
2001-10-20 00:52:59 +04:00
|
|
|
interface nsIObserverService : nsISupports
|
|
|
|
{
|
1999-05-29 05:30:27 +04:00
|
|
|
|
2001-10-20 00:52:59 +04:00
|
|
|
/**
|
|
|
|
* AddObserver
|
|
|
|
*
|
|
|
|
* Registers a given listener for a notifications regarding the specified
|
|
|
|
* topic.
|
|
|
|
*
|
|
|
|
* @param anObserve : The interface pointer which will receive notifications.
|
|
|
|
* @param aTopic : The notification topic or subject.
|
|
|
|
* @param ownsWeak : If set to false, the nsIObserverService will hold a
|
2001-11-23 18:11:37 +03:00
|
|
|
* strong reference to |anObserver|. If set to true and
|
2001-10-20 00:52:59 +04:00
|
|
|
* |anObserver| supports the nsIWeakReference interface,
|
|
|
|
* a weak reference will be held. Otherwise an error will be
|
|
|
|
* returned.
|
|
|
|
*/
|
|
|
|
void addObserver( in nsIObserver anObserver, in string aTopic, in boolean ownsWeak);
|
1999-05-29 05:30:27 +04:00
|
|
|
|
2001-10-20 00:52:59 +04:00
|
|
|
/**
|
|
|
|
* removeObserver
|
|
|
|
*
|
|
|
|
* Unregisters a given listener from notifications regarding the specified
|
|
|
|
* topic.
|
|
|
|
*
|
|
|
|
* @param anObserver : The interface pointer which will stop recieving
|
|
|
|
* notifications.
|
|
|
|
* @param aTopic : The notification topic or subject.
|
|
|
|
*/
|
|
|
|
void removeObserver( in nsIObserver anObserver, in string aTopic );
|
1999-05-29 05:30:27 +04:00
|
|
|
|
2001-10-20 00:52:59 +04:00
|
|
|
/**
|
|
|
|
* notifyObservers
|
|
|
|
*
|
|
|
|
* Notifies all registered listeners of the given topic.
|
|
|
|
*
|
|
|
|
* @param aSubject : Notification specific interface pointer.
|
|
|
|
* @param aTopic : The notification topic or subject.
|
|
|
|
* @param someData : Notification specific wide string.
|
|
|
|
*/
|
|
|
|
void notifyObservers( in nsISupports aSubject,
|
|
|
|
in string aTopic,
|
|
|
|
in wstring someData );
|
1999-05-29 05:30:27 +04:00
|
|
|
|
2001-10-20 00:52:59 +04:00
|
|
|
/**
|
|
|
|
* enumerateObservers
|
|
|
|
*
|
|
|
|
* Returns an enumeration of all registered listeners.
|
|
|
|
*
|
|
|
|
* @param aTopic : The notification topic or subject.
|
|
|
|
*/
|
|
|
|
nsISimpleEnumerator enumerateObservers( in string aTopic );
|
|
|
|
|
|
|
|
|
|
|
|
};
|
1999-05-29 05:30:27 +04:00
|
|
|
|
|
|
|
|