toolkit/components/contentprefs/ContentPrefInstance.jsm

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:87477a3a8c60
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 'use strict';
6
7 const Cc = Components.classes;
8 const Ci = Components.interfaces;
9
10 this.EXPORTED_SYMBOLS = ['ContentPrefInstance'];
11
12 // This is a wrapper for nsIContentPrefService that alleviates the need to pass
13 // an nsILoadContext argument to every method. Pass the context to the constructor
14 // instead and continue on your way in blissful ignorance.
15
16 this.ContentPrefInstance = function ContentPrefInstance(aContext) {
17 this._contentPrefSvc = Cc["@mozilla.org/content-pref/service;1"].
18 getService(Ci.nsIContentPrefService);
19 this._context = aContext;
20 };
21
22 ContentPrefInstance.prototype = {
23 getPref: function ContentPrefInstance_init(aName, aGroup, aCallback) {
24 return this._contentPrefSvc.getPref(aName, aGroup, this._context, aCallback);
25 },
26
27 setPref: function ContentPrefInstance_setPref(aGroup, aName, aValue) {
28 return this._contentPrefSvc.setPref(aGroup, aName, aValue, this._context);
29 },
30
31 hasPref: function ContentPrefInstance_hasPref(aGroup, aName) {
32 return this._contentPrefSvc.hasPref(aGroup, aName, this._context);
33 },
34
35 hasCachedPref: function ContentPrefInstance_hasCachedPref(aGroup, aName) {
36 return this._contentPrefSvc.hasCachedPref(aGroup, aName, this._context);
37 },
38
39 removePref: function ContentPrefInstance_removePref(aGroup, aName) {
40 return this._contentPrefSvc.removePref(aGroup, aName, this._context);
41 },
42
43 removeGroupedPrefs: function ContentPrefInstance_removeGroupedPrefs() {
44 return this._contentPrefSvc.removeGroupedPrefs(this._context);
45 },
46
47 removePrefsByName: function ContentPrefInstance_removePrefsByName(aName) {
48 return this._contentPrefSvc.removePrefsByName(aName, this._context);
49 },
50
51 getPrefs: function ContentPrefInstance_getPrefs(aGroup) {
52 return this._contentPrefSvc.getPrefs(aGroup, this._context);
53 },
54
55 getPrefsByName: function ContentPrefInstance_getPrefsByName(aName) {
56 return this._contentPrefSvc.getPrefsByName(aName, this._context);
57 },
58
59 addObserver: function ContentPrefInstance_addObserver(aName, aObserver) {
60 return this._contentPrefSvc.addObserver(aName, aObserver);
61 },
62
63 removeObserver: function ContentPrefInstance_removeObserver(aName, aObserver) {
64 return this._contentPrefSvc.removeObserver(aName, aObserver);
65 },
66
67 get grouper() {
68 return this._contentPrefSvc.grouper;
69 },
70
71 get DBConnection() {
72 return this._contentPrefSvc.DBConnection;
73 }
74 };

mercurial