2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2001-03-23 02:34:41 +03:00
|
|
|
#include "nsIPrefBranch.idl"
|
2001-07-16 06:40:48 +04:00
|
|
|
|
|
|
|
interface nsIFile;
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* The nsIPrefService interface is the main entry point into the back end
|
|
|
|
* preferences management library. The preference service is directly
|
|
|
|
* responsible for the management of the preferences files and also facilitates
|
|
|
|
* access to the preference branch object which allows the direct manipulation
|
|
|
|
* of the preferences themselves.
|
|
|
|
*
|
|
|
|
* @see nsIPrefBranch
|
|
|
|
*/
|
|
|
|
|
2014-09-04 17:52:28 +04:00
|
|
|
[scriptable, uuid(1f84fd56-3956-40df-b86a-1ea01402ee96)]
|
2001-02-15 01:04:26 +03:00
|
|
|
interface nsIPrefService : nsISupports
|
|
|
|
{
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* Called to completely flush and re-initialize the preferences system.
|
|
|
|
*
|
2013-05-16 16:26:55 +04:00
|
|
|
* @throws Error The preference service failed to restart correctly.
|
2001-02-15 01:04:26 +03:00
|
|
|
*/
|
|
|
|
void resetPrefs();
|
|
|
|
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* Called to reset all preferences with user set values back to the
|
|
|
|
* application default values.
|
2001-02-15 01:04:26 +03:00
|
|
|
*/
|
|
|
|
void resetUserPrefs();
|
|
|
|
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* Called to write current preferences state to a file.
|
|
|
|
*
|
|
|
|
* @param aFile The file to be written.
|
|
|
|
*
|
|
|
|
* @note
|
2012-07-30 18:20:58 +04:00
|
|
|
* If nullptr is passed in for the aFile parameter the preference data is
|
2001-10-08 23:52:17 +04:00
|
|
|
* written out to the current preferences file (usually prefs.js.)
|
|
|
|
*
|
2013-05-16 16:26:55 +04:00
|
|
|
* @throws Error File failed to write.
|
2001-10-08 23:52:17 +04:00
|
|
|
*
|
2018-03-02 07:31:40 +03:00
|
|
|
* @see readUserPrefsFromFile
|
2001-10-08 23:52:17 +04:00
|
|
|
* @see nsIFile
|
2001-02-15 01:04:26 +03:00
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void savePrefFile(in nsIFile aFile);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* Call to get a Preferences "Branch" which accesses user preference data.
|
|
|
|
* Using a Set method on this object will always create or set a user
|
|
|
|
* preference value. When using a Get method a user set value will be
|
|
|
|
* returned if one exists, otherwise a default value will be returned.
|
|
|
|
*
|
|
|
|
* @param aPrefRoot The preference "root" on which to base this "branch".
|
|
|
|
* For example, if the root "browser.startup." is used, the
|
|
|
|
* branch will be able to easily access the preferences
|
|
|
|
* "browser.startup.page", "browser.startup.homepage", or
|
|
|
|
* "browser.startup.homepage_override" by simply requesting
|
2012-07-30 18:20:58 +04:00
|
|
|
* "page", "homepage", or "homepage_override". nullptr or ""
|
2001-10-08 23:52:17 +04:00
|
|
|
* may be used to access to the entire preference "tree".
|
|
|
|
*
|
|
|
|
* @return nsIPrefBranch The object representing the requested branch.
|
|
|
|
*
|
|
|
|
* @see getDefaultBranch
|
2001-04-18 09:16:47 +04:00
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
nsIPrefBranch getBranch(in string aPrefRoot);
|
2001-04-18 09:16:47 +04:00
|
|
|
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* Call to get a Preferences "Branch" which accesses only the default
|
|
|
|
* preference data. Using a Set method on this object will always create or
|
|
|
|
* set a default preference value. When using a Get method a default value
|
|
|
|
* will always be returned.
|
|
|
|
*
|
|
|
|
* @param aPrefRoot The preference "root" on which to base this "branch".
|
|
|
|
* For example, if the root "browser.startup." is used, the
|
|
|
|
* branch will be able to easily access the preferences
|
|
|
|
* "browser.startup.page", "browser.startup.homepage", or
|
|
|
|
* "browser.startup.homepage_override" by simply requesting
|
2012-07-30 18:20:58 +04:00
|
|
|
* "page", "homepage", or "homepage_override". nullptr or ""
|
2001-10-08 23:52:17 +04:00
|
|
|
* may be used to access to the entire preference "tree".
|
|
|
|
*
|
|
|
|
* @note
|
|
|
|
* Few consumers will want to create default branch objects. Many of the
|
|
|
|
* branch methods do nothing on a default branch because the operations only
|
|
|
|
* make sense when applied to user set preferences.
|
|
|
|
*
|
|
|
|
* @return nsIPrefBranch The object representing the requested default branch.
|
|
|
|
*
|
|
|
|
* @see getBranch
|
2001-04-18 09:16:47 +04:00
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
nsIPrefBranch getDefaultBranch(in string aPrefRoot);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2014-09-04 17:52:28 +04:00
|
|
|
/**
|
|
|
|
* The preference service is 'dirty' if there are changes to user preferences
|
|
|
|
* that have not been written to disk
|
|
|
|
*/
|
|
|
|
readonly attribute boolean dirty;
|
2017-06-21 22:26:10 +03:00
|
|
|
|
|
|
|
/**
|
2018-03-02 07:31:40 +03:00
|
|
|
* Read in the preferences specified in a default preference file. This
|
|
|
|
* method does not clear preferences that were already set, but it may
|
|
|
|
* overwrite existing preferences.
|
2017-06-21 22:26:10 +03:00
|
|
|
*
|
|
|
|
* @param aFile The file to be read.
|
|
|
|
*
|
|
|
|
* @throws Error File failed to read or contained invalid data.
|
|
|
|
* @note This method is intended for internal unit testing only!
|
|
|
|
*/
|
2018-03-02 07:31:40 +03:00
|
|
|
void readDefaultPrefsFromFile(in nsIFile aFile);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like readDefaultPrefsFromFile, but for a user prefs file.
|
|
|
|
*/
|
2017-06-21 22:26:10 +03:00
|
|
|
void readUserPrefsFromFile(in nsIFile aFile);
|
2001-02-15 01:04:26 +03:00
|
|
|
};
|
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
%{C++
|
|
|
|
|
2001-03-29 04:48:30 +04:00
|
|
|
#define NS_PREFSERVICE_CID \
|
2014-09-04 11:40:01 +04:00
|
|
|
{ /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */ \
|
|
|
|
0x91ca2441, \
|
|
|
|
0x050f, \
|
|
|
|
0x4f7c, \
|
|
|
|
{ 0x9d, 0xf8, 0x75, 0xb4, 0x0e, 0xa4, 0x01, 0x56 } \
|
2001-03-29 04:48:30 +04:00
|
|
|
}
|
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
#define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1"
|
|
|
|
|
2001-10-08 23:52:17 +04:00
|
|
|
/**
|
|
|
|
* Notification sent before reading the default user preferences files.
|
|
|
|
*/
|
2001-10-23 00:54:48 +04:00
|
|
|
#define NS_PREFSERVICE_READ_TOPIC_ID "prefservice:before-read-userprefs"
|
2001-10-08 23:52:17 +04:00
|
|
|
|
2007-09-01 06:16:47 +04:00
|
|
|
/**
|
|
|
|
* Notification sent when after reading app-provided default
|
2017-10-31 08:34:57 +03:00
|
|
|
* preferences, but before user profile override defaults are loaded.
|
2007-09-01 06:16:47 +04:00
|
|
|
*/
|
|
|
|
#define NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID "prefservice:after-app-defaults"
|
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
%}
|