nsIParentalControlsService

This interface provides access to the operating system's parental controls feature, allowing code to detect whether such a service is enabled and to request overrides to bypass the feature.
1.0
66
Introduced
Gecko 1.9
Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Note: Currently, this interface is only supported on Microsoft Windows Vista and newer as well as Android 4.3 and newer.

Implemented by: @mozilla.org/parental-controls-service;1. To create an instance, use:

var parentalControlsService = Components.classes["@mozilla.org/parental-controls-service;1"]
                              .createInstance(Components.interfaces.nsIParentalControlsService);

Method overview

void log(in short aEntryType, in boolean aFlag, in nsIURI aSource, [optional] in nsIFile aTarget);
boolean requestURIOverride(in nsIURI aTarget, [optional] in nsIInterfaceRequestor aWindowContext);
boolean requestURIOverrides(in nsIArray aTargets, [optional] in nsIInterfaceRequestor aWindowContext);

Attributes

Attribute Type Description
blockFileDownloadsEnabled boolean true if the current user account's parental controls restrictions include the blocking of all file downloads. Read only.
loggingEnabled boolean true if the current user account has parental controls logging enabled. If this is true, applications should log relevant events using log() method. Read only.
parentalControlsEnabled boolean true if the current user account has parental controls restrictions enabled. Read only.

Constants

Constant Value Description
ePCLog_URIVisit 1 This log entry type represents an access to web content.
ePCLog_FileDownload 2 This log entry type represents a file download.

Methods

log()

Logs an application specific parental controls event.

void log(
  in short aEntryType,
  in boolean aFlag,
  in nsIURI aSource,
  in nsIFile aTarget Optional
);
Parameters
aEntryType
The type of event to log. See the constants for allowed values.
aFlag
Pass true if the event was blocked or false if it was allowed.
aSource
The URI source of the subject content.
aTarget Optional
The location to which the content was saved if it was not blocked.

requestURIOverride()

Requests that a blocked URI be allowed through parental control filters.

This method may block while the operating system presents user interface to handle the override request (such as an "enter an administrator's password" dialog box).

boolean requestURIOverride(
  in nsIURI aTarget,
  in nsIInterfaceRequestor aWindowContext Optional
);
Parameters
aTarget
The URI to be overridden.
aWindowContext Optional
The window generating the event.
Return value

true if the block was successfully overridden, otherwise false.

requestURIOverrides()

Requests that a set of URIs be allowed through the parental control filters.

This method may block while the operating system presents user interface to handle the override request (such as an "enter an administrator's password" dialog box).

boolean requestURIOverrides(
  in nsIArray aTargets,
  in nsIInterfaceRequestor aWindowContext Optional
);
Parameters
aTargets
An array of nsIURI objects, each representing a URI for which an override is desired.
aWindowContext Optional
The window generating the event.
Return value

true if the block was successfully overridden, otherwise false.