Public Member Functions | Public Attributes

nsIContentPrefService Interface Reference

import "nsIContentPrefService.idl";

Collaboration diagram for nsIContentPrefService:

List of all members.

Public Member Functions

nsIVariant getPref (in nsIVariant aGroup, in AString aName)
 Get a pref.
void setPref (in nsIVariant aGroup, in AString aName, in nsIVariant aValue)
 Set a pref.
boolean hasPref (in nsIVariant aGroup, in AString aName)
 Check whether or not a pref exists.
void removePref (in nsIVariant aGroup, in AString aName)
 Remove a pref.
void removeGroupedPrefs ()
 Remove all grouped prefs.
void removePrefsByName (in AString aName)
 Remove all prefs with the given name.
nsIPropertyBag2 getPrefs (in nsIVariant aGroup)
 Get the prefs that apply to the given site.
nsIPropertyBag2 getPrefsByName (in AString aName)
 Get the prefs with the given name.
void addObserver (in AString aName, in nsIContentPrefObserver aObserver)
 Add an observer.
void removeObserver (in AString aName, in nsIContentPrefObserver aObserver)
 Remove an observer.

Public Attributes

readonly attribute
nsIContentURIGrouper 
grouper
 The component that the service uses to determine the groups to which URIs belong.
readonly attribute
mozIStorageConnection 
DBConnection
 The database connection to the content preferences database.

Member Function Documentation

void nsIContentPrefService::addObserver ( in AString  aName,
in nsIContentPrefObserver  aObserver 
)

Add an observer.

Parameters:
aName the setting to observe, or null to add a generic observer that observes all settings
aObserver the observer to add
nsIVariant nsIContentPrefService::getPref ( in nsIVariant  aGroup,
in AString  aName 
)

Get a pref.

Besides the regular string, integer, boolean, etc. values, this method may return null (nsIDataType::VTYPE_EMPTY), which means the pref is set to NULL in the database, as well as undefined (nsIDataType::VTYPE_VOID), which means there is no record for this pref in the database.

Parameters:
aGroup the group for which to get the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to get the global pref (applies to all sites)
aName the name of the pref to get
Returns:
the value of the pref
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null
NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string
nsIPropertyBag2 nsIContentPrefService::getPrefs ( in nsIVariant  aGroup  ) 

Get the prefs that apply to the given site.

Parameters:
aGroup the group for which to retrieve prefs, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to get the global prefs (apply to all sites)
Returns:
a property bag of prefs
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null
nsIPropertyBag2 nsIContentPrefService::getPrefsByName ( in AString  aName  ) 

Get the prefs with the given name.

Parameters:
aName the setting name for which to retrieve prefs
Returns:
a property bag of prefs
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string
boolean nsIContentPrefService::hasPref ( in nsIVariant  aGroup,
in AString  aName 
)

Check whether or not a pref exists.

Parameters:
aGroup the group for which to check for the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to check for the global pref (applies to all sites)
aName the name of the pref to check for
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null
NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string
void nsIContentPrefService::removeGroupedPrefs (  ) 

Remove all grouped prefs.

Useful for removing references to the sites the user has visited when the user clears their private data.

void nsIContentPrefService::removeObserver ( in AString  aName,
in nsIContentPrefObserver  aObserver 
)

Remove an observer.

Parameters:
aName the setting being observed, or null to remove a generic observer that observes all settings
aObserver the observer to remove
void nsIContentPrefService::removePref ( in nsIVariant  aGroup,
in AString  aName 
)

Remove a pref.

Parameters:
aGroup the group for which to remove the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to remove the global pref (applies to all sites)
aName the name of the pref to remove
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null
NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string
void nsIContentPrefService::removePrefsByName ( in AString  aName  ) 

Remove all prefs with the given name.

Parameters:
aName the setting name for which to remove prefs
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string
void nsIContentPrefService::setPref ( in nsIVariant  aGroup,
in AString  aName,
in nsIVariant  aValue 
)

Set a pref.

Parameters:
aGroup the group for which to set the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to set the global pref (applies to all sites)
aName the name of the pref to set
aValue the new value of the pref
Exceptions:
NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null
NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string

Member Data Documentation

The database connection to the content preferences database.

Useful for accessing and manipulating preferences in ways that are caller- specific or for which there is not yet a generic method, although generic functionality useful to multiple callers should generally be added to this unfrozen interface. Also useful for testing the database creation and migration code.

The component that the service uses to determine the groups to which URIs belong.

By default this is the "hostname grouper", which groups URIs by full hostname (a.k.a. site).


The documentation for this interface was generated from the following file: