PageRenderTime 22ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/modules/libpref/public/nsIPrefService.idl

http://github.com/zpao/v8monkey
IDL | 197 lines | 36 code | 19 blank | 142 comment | 0 complexity | 39500cf2becdaa4b6710cbb1fa7a4e61 MD5 | raw file
  1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2/* ***** BEGIN LICENSE BLOCK *****
  3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4 *
  5 * The contents of this file are subject to the Mozilla Public License Version
  6 * 1.1 (the "License"); you may not use this file except in compliance with
  7 * the License. You may obtain a copy of the License at
  8 * http://www.mozilla.org/MPL/
  9 *
 10 * Software distributed under the License is distributed on an "AS IS" basis,
 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 12 * for the specific language governing rights and limitations under the
 13 * License.
 14 *
 15 * The Original Code is Mozilla Communicator client code.
 16 *
 17 * The Initial Developer of the Original Code is
 18 * Netscape Communications Corporation.
 19 * Portions created by the Initial Developer are Copyright (C) 1998
 20 * the Initial Developer. All Rights Reserved.
 21 *
 22 * Contributor(s):
 23 *   Alec Flett <alecf@netscape.com>
 24 *   Brian Nesse <bnesse@netscape.com>
 25 *
 26 * Alternatively, the contents of this file may be used under the terms of
 27 * either the GNU General Public License Version 2 or later (the "GPL"), or
 28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 29 * in which case the provisions of the GPL or the LGPL are applicable instead
 30 * of those above. If you wish to allow use of your version of this file only
 31 * under the terms of either the GPL or the LGPL, and not to allow others to
 32 * use your version of this file under the terms of the MPL, indicate your
 33 * decision by deleting the provisions above and replace them with the notice
 34 * and other provisions required by the GPL or the LGPL. If you do not delete
 35 * the provisions above, a recipient may use your version of this file under
 36 * the terms of any one of the MPL, the GPL or the LGPL.
 37 *
 38 * ***** END LICENSE BLOCK ***** */
 39
 40#include "nsISupports.idl"
 41#include "nsIPrefBranch.idl"
 42
 43%{C++
 44struct PrefTuple;
 45template<class E, class A> class nsTArray;
 46struct nsTArrayInfallibleAllocator;
 47%}
 48
 49[ptr] native nsPreferencesArrayPtr(nsTArray<PrefTuple, nsTArrayInfallibleAllocator>);
 50[ptr] native nsPreferencePtr(PrefTuple);
 51[ptr] native nsPreferencePtrConst(const PrefTuple);
 52
 53interface nsIFile;
 54interface nsILocalFile;
 55
 56/**
 57 * The nsIPrefService interface is the main entry point into the back end
 58 * preferences management library. The preference service is directly
 59 * responsible for the management of the preferences files and also facilitates
 60 * access to the preference branch object which allows the direct manipulation
 61 * of the preferences themselves.
 62 *
 63 * @see nsIPrefBranch
 64 */
 65
 66[scriptable, uuid(decb9cc7-c08f-4ea5-be91-a8fc637ce2d2)]
 67interface nsIPrefService : nsISupports
 68{
 69  /**
 70   * Called to read in the preferences specified in a user preference file.
 71   *
 72   * @param aFile The file to be read.
 73   *
 74   * @note
 75   * If nsnull is passed in for the aFile parameter the default preferences
 76   * file(s) [prefs.js, user.js] will be read and processed.
 77   *
 78   * @return NS_OK File was read and processed.
 79   * @return Other File failed to read or contained invalid data.
 80   *
 81   * @see savePrefFile
 82   * @see nsIFile
 83   */
 84  void readUserPrefs(in nsIFile aFile);
 85
 86  /**
 87   * Called to completely flush and re-initialize the preferences system.
 88   *
 89   * @return NS_OK The preference service was re-initialized correctly.
 90   * @return Other The preference service failed to restart correctly.
 91   */
 92  void resetPrefs();
 93
 94  /**
 95   * Called to reset all preferences with user set values back to the
 96   * application default values.
 97   *
 98   * @return NS_OK Always.
 99   */
100  void resetUserPrefs();
101
102  /**
103   * Called to write current preferences state to a file.
104   *
105   * @param aFile The file to be written.
106   *
107   * @note
108   * If nsnull is passed in for the aFile parameter the preference data is
109   * written out to the current preferences file (usually prefs.js.)
110   *
111   * @return NS_OK File was written.
112   * @return Other File failed to write.
113   *
114   * @see readUserPrefs
115   * @see nsIFile
116   */
117  void savePrefFile(in nsIFile aFile);
118
119  /**
120   * Call to get a Preferences "Branch" which accesses user preference data.
121   * Using a Set method on this object will always create or set a user
122   * preference value. When using a Get method a user set value will be
123   * returned if one exists, otherwise a default value will be returned.
124   *
125   * @param aPrefRoot The preference "root" on which to base this "branch".
126   *                  For example, if the root "browser.startup." is used, the
127   *                  branch will be able to easily access the preferences
128   *                  "browser.startup.page", "browser.startup.homepage", or
129   *                  "browser.startup.homepage_override" by simply requesting
130   *                  "page", "homepage", or "homepage_override". nsnull or "" 
131   *                  may be used to access to the entire preference "tree".
132   *
133   * @return nsIPrefBranch The object representing the requested branch.
134   *
135   * @see getDefaultBranch
136   */
137  nsIPrefBranch getBranch(in string aPrefRoot);
138
139  /**
140   * Call to get a Preferences "Branch" which accesses only the default 
141   * preference data. Using a Set method on this object will always create or
142   * set a default preference value. When using a Get method a default value
143   * will always be returned.
144   *
145   * @param aPrefRoot The preference "root" on which to base this "branch".
146   *                  For example, if the root "browser.startup." is used, the
147   *                  branch will be able to easily access the preferences
148   *                  "browser.startup.page", "browser.startup.homepage", or
149   *                  "browser.startup.homepage_override" by simply requesting
150   *                  "page", "homepage", or "homepage_override". nsnull or "" 
151   *                  may be used to access to the entire preference "tree".
152   *
153   * @note
154   * Few consumers will want to create default branch objects. Many of the
155   * branch methods do nothing on a default branch because the operations only
156   * make sense when applied to user set preferences.
157   *
158   * @return nsIPrefBranch The object representing the requested default branch.
159   *
160   * @see getBranch
161   */
162  nsIPrefBranch getDefaultBranch(in string aPrefRoot);
163
164};
165
166%{C++
167
168#define NS_PREFSERVICE_CID                             \
169  { /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */       \
170    0x91ca2441,                                        \
171    0x050f,                                            \
172    0x4f7c,                                            \
173    { 0x9d, 0xf8, 0x75, 0xb4, 0x0e, 0xa4, 0x01, 0x56 } \
174  }
175
176#define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1"
177#define NS_PREFSERVICE_CLASSNAME "Preferences Server"
178
179/**
180 * Notification sent before reading the default user preferences files.
181 */
182#define NS_PREFSERVICE_READ_TOPIC_ID "prefservice:before-read-userprefs"
183
184/**
185 * Notification sent when resetPrefs has been called, but before the actual
186 * reset process occurs.
187 */
188#define NS_PREFSERVICE_RESET_TOPIC_ID "prefservice:before-reset"
189
190/**
191 * Notification sent when after reading app-provided default
192 * preferences, but before user profile override defaults or extension
193 * defaults are loaded.
194 */
195#define NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID "prefservice:after-app-defaults"
196
197%}