author | Wolfgang Rosenauer <wr@rosenauer.org> |
Sat, 01 Nov 2014 14:03:32 +0100 | |
branch | firefox31 |
changeset 795 | ca27ee37d62e |
parent 59 | 604517bb16d8 |
child 174 | b3f909e83302 |
permissions | -rw-r--r-- |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1 |
From: various contributors |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2 |
Subject: replace gconf backend with more complete mapping for lockdown feature |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
4 |
diff --git a/extensions/pref/Makefile.in b/extensions/pref/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
5 |
--- a/extensions/pref/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
6 |
+++ b/extensions/pref/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
7 |
@@ -40,13 +40,13 @@ DEPTH = ../.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
8 |
topsrcdir = @top_srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
9 |
srcdir = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
10 |
VPATH = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
11 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
12 |
include $(DEPTH)/config/autoconf.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
13 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
14 |
DIRS = autoconfig |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
15 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
16 |
-ifdef MOZ_ENABLE_GTK2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
17 |
+ifdef MOZ_ENABLE_GCONF |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
18 |
DIRS += system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
19 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
20 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
21 |
include $(topsrcdir)/config/rules.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
22 |
diff --git a/extensions/pref/system-pref/src/Makefile.in b/extensions/pref/system-pref/src/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
23 |
--- a/extensions/pref/system-pref/src/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
24 |
+++ b/extensions/pref/system-pref/src/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
25 |
@@ -38,47 +38,41 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
26 |
DEPTH = ../../../.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
27 |
topsrcdir = @top_srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
28 |
srcdir = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
29 |
VPATH = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
30 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
31 |
include $(DEPTH)/config/autoconf.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
32 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
33 |
MODULE = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
34 |
-LIBRARY_NAME = system-pref_s |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
35 |
+LIBRARY_NAME = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
36 |
ifneq ($(OS_ARCH),WINNT) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
37 |
SHORT_LIBNAME = syspref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
38 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
39 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
40 |
# We want to force the creation of a static lib. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
41 |
-FORCE_STATIC_LIB = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
42 |
-LIBXUL_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
43 |
+#FORCE_STATIC_LIB = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
44 |
+LIBXUL_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
45 |
+MODULE_NAME = nsSystemPrefModule |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
46 |
+IS_COMPONENT = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
47 |
+EXPORT_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
48 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
49 |
REQUIRES = xpcom \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
50 |
string \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
51 |
embedcomponents \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
52 |
pref \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
53 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
54 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
55 |
-ifdef MOZ_ENABLE_GTK2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
56 |
-DIRS = gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
57 |
-endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
58 |
+CPPSRCS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
59 |
+ nsSystemPref.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
60 |
+ nsSystemPrefFactory.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
61 |
+ $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
62 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
63 |
EXTRA_DSO_LDOPTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
64 |
- -L$(DIST)/bin \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
65 |
$(MOZ_COMPONENT_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
66 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
67 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
68 |
-CPPSRCS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
69 |
- nsSystemPref.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
70 |
- $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
71 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
72 |
EXPORTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
73 |
- nsSystemPrefLog.h \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
74 |
+ nsISystemPrefService.h \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
75 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
76 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
77 |
include $(topsrcdir)/config/rules.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
78 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
79 |
-ifdef MOZ_ENABLE_GTK2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
80 |
-INCLUDES += \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
81 |
- -I$(srcdir)/gconf \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
82 |
- $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
83 |
-endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
84 |
diff --git a/extensions/pref/system-pref/src/gconf/Makefile.in b/extensions/pref/system-pref/src/gconf/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
85 |
--- a/extensions/pref/system-pref/src/gconf/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
86 |
+++ b/extensions/pref/system-pref/src/gconf/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
87 |
@@ -37,50 +37,37 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
88 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
89 |
DEPTH = ../../../../.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
90 |
topsrcdir = @top_srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
91 |
srcdir = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
92 |
VPATH = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
93 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
94 |
include $(DEPTH)/config/autoconf.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
95 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
96 |
-MODULE = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
97 |
-LIBRARY_NAME = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
98 |
-LIBXUL_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
99 |
+MODULE = system-pref-gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
100 |
+LIBRARY_NAME = system-pref-gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
101 |
+IS_COMPONENT = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
102 |
+MODULE_NAME = nsSystemPrefServiceModule |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
103 |
+FORCE_SHARED_LIB = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
104 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
105 |
REQUIRES = pref \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
106 |
string \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
107 |
xpcom \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
108 |
- embedcomponents \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
109 |
+ necko \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
110 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
111 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
112 |
CPPSRCS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
113 |
nsSystemPrefService.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
114 |
- nsSystemPrefFactory.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
115 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
116 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
117 |
-SHARED_LIBRARY_LIBS = ../libsystem-pref_s.a |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
118 |
+OS_INCLUDES += $(MOZ_GCONF_CFLAGS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
119 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
120 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
121 |
EXTRA_DSO_LDOPTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
122 |
- -L$(DIST)/bin \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
123 |
- $(MOZ_COMPONENT_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
124 |
- $(MOZ_GTK2_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
125 |
+ $(XPCOM_GLUE_LDOPTS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
126 |
+ $(MOZ_GCONF_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
127 |
+ $(NSPR_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
128 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
129 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
130 |
-EXPORT_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
131 |
-IS_COMPONENT = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
132 |
-MODULE_NAME = nsSystemPrefModule |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
133 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
134 |
-EXPORTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
135 |
- nsSystemPrefService.h \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
136 |
- $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
137 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
138 |
include $(topsrcdir)/config/rules.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
139 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
140 |
-CFLAGS += $(MOZ_GTK2_CFLAGS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
141 |
-CXXFLAGS += $(MOZ_GTK2_CFLAGS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
142 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
143 |
-LOCAL_INCLUDES = -I$(srcdir)/.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
144 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
145 |
-export:: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
146 |
- $(INSTALL) $(srcdir)/../nsSystemPrefFactory.cpp . |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
147 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
148 |
GARBAGE += nsSystemPrefFactory.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
149 |
diff --git a/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp b/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
150 |
--- a/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
151 |
+++ b/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
152 |
@@ -18,17 +18,19 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
153 |
* The Original Code is mozilla.org code. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
154 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
155 |
* The Initial Developer of the Original Code is Sun Microsystems, Inc. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
156 |
* Portions created by Sun Microsystems are Copyright (C) 2003 Sun |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
157 |
* Microsystems, Inc. All Rights Reserved. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
158 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
159 |
* Original Author: Bolian Yin (bolian.yin@sun.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
160 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
161 |
- * Contributor(s): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
162 |
+ * Contributor(s): Robert O'Callahan/Novell (rocallahan@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
163 |
+ * Hubert Figuiere (hfiguiere@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
164 |
+ * Wolfgang Rosenauer (wr@rosenauer.org) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
165 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
166 |
* Alternatively, the contents of this file may be used under the terms of |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
167 |
* either the GNU General Public License Version 2 or later (the "GPL"), or |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
168 |
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
169 |
* in which case the provisions of the GPL or the LGPL are applicable instead |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
170 |
* of those above. If you wish to allow use of your version of this file only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
171 |
* under the terms of either the GPL or the LGPL, and not to allow others to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
172 |
* use your version of this file under the terms of the NPL, indicate your |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
173 |
@@ -36,299 +38,1300 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
174 |
* and other provisions required by the GPL or the LGPL. If you do not delete |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
175 |
* the provisions above, a recipient may use your version of this file under |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
176 |
* the terms of any one of the NPL, the GPL or the LGPL. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
177 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
178 |
* ***** END LICENSE BLOCK ***** */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
179 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
180 |
#include <glib.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
181 |
#include <glib-object.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
182 |
+#include <gconf/gconf-client.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
183 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
184 |
#include "plstr.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
185 |
#include "nsCOMPtr.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
186 |
-#include "nsIPrefBranch.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
187 |
-#include "nsIPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
188 |
+#include "nsIPref.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
189 |
#include "nsIServiceManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
190 |
#include "nsIObserver.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
191 |
#include "nsWeakReference.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
192 |
+#include "nsIPrefBranch2.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
193 |
+#include "nsDataHashtable.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
194 |
+#include "nsHashKeys.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
195 |
+#include "nsICategoryManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
196 |
+#include "nsIGenericFactory.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
197 |
+#include "nsStringAPI.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
198 |
+#include "nsIPermissionManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
199 |
+#include "../nsSystemPref.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
200 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
201 |
-#include "nsString.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
202 |
-#include "nsSystemPrefLog.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
203 |
-#include "nsSystemPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
204 |
+#define NS_SYSTEMPREF_SERVICE_CID \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
205 |
+ { /* {3724e748-b088-4bf8-9298-aad426b66293} */ \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
206 |
+ 0x3724e748, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
207 |
+ 0xb088, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
208 |
+ 0x4bf8, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
209 |
+ { 0x92, 0x98, 0xaa, 0xd4, 0x26, 0xb6, 0x62, 0x93 } \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
210 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
211 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
212 |
-/************************************************************************* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
213 |
- * The strange thing here is that we load the gconf library manually and |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
214 |
- * search the function pointers we need. If that process fails, no gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
215 |
- * support is available in mozilla. The aim is to make mozilla independent |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
216 |
- * on gconf, in both compile time and run time. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
217 |
- ************************************************************************/ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
218 |
+#define NS_SYSTEMPREF_SERVICE_CLASSNAME "System Preferences Platform Service" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
219 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
220 |
-//gconf types |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
221 |
-extern "C" { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
222 |
+NS_DEFINE_STATIC_IID_ACCESSOR(nsISystemPrefService, NS_ISYSTEMPREFSERVICE_IID) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
223 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
224 |
- typedef enum { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
225 |
- GCONF_VALUE_INVALID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
226 |
- GCONF_VALUE_STRING, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
227 |
- GCONF_VALUE_INT, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
228 |
- GCONF_VALUE_FLOAT, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
229 |
- GCONF_VALUE_BOOL, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
230 |
- GCONF_VALUE_SCHEMA, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
231 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
232 |
+ * We can link directly to the gconf library. If it's not available, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
233 |
+ * this component just won't load and no system prefs will be offered. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
234 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
235 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
236 |
- GCONF_VALUE_LIST, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
237 |
- GCONF_VALUE_PAIR |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
238 |
+#define NUM_ELEM(a) (sizeof(a)/sizeof(a[0])) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
239 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
240 |
- }GConfValueType; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
241 |
+class nsSystemPrefService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
242 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
243 |
- typedef struct { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
244 |
- GConfValueType type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
245 |
- }GConfValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
246 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
247 |
+ * List the preferences that have a simple mapping between Moz and gconf. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
248 |
+ * These preferences have the same meaning and their values are |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
249 |
+ * automatically converted. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
250 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
251 |
+struct SimplePrefMapping { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
252 |
+ const char *mozPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
253 |
+ const char *gconfPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
254 |
+ /** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
255 |
+ * If this is PR_FALSE, then we never allow Mozilla to change |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
256 |
+ * this setting. The Mozilla pref will always be locked. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
257 |
+ * If this is PR_TRUE then Mozilla will be allowed to change |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
258 |
+ * the setting --- but only if it is writable in gconf. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
259 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
260 |
+ PRBool allowWritesFromMozilla; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
261 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
262 |
+typedef nsresult (* ComplexGConfPrefChanged)(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
263 |
+ GConfClient* aClient); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
264 |
+typedef nsresult (* ComplexMozPrefChanged)(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
265 |
+ GConfClient* aClient); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
266 |
+struct ComplexGConfPrefMapping { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
267 |
+ const char* gconfPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
268 |
+ ComplexGConfPrefChanged callback; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
269 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
270 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
271 |
- typedef void * (*GConfClientGetDefaultType) (void); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
272 |
- typedef PRBool (*GConfClientGetBoolType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
273 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
274 |
- typedef gchar* (*GConfClientGetStringType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
275 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
276 |
- typedef PRInt32 (*GConfClientGetIntType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
277 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
278 |
- typedef GSList* (*GConfClientGetListType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
279 |
- GConfValueType list_type, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
280 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
281 |
- typedef void (*GConfClientNotifyFuncType) (void* client, guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
282 |
- void *entry, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
283 |
- gpointer user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
284 |
- typedef guint (*GConfClientNotifyAddType) (void* client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
285 |
- const gchar* namespace_section, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
286 |
- GConfClientNotifyFuncType func, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
287 |
- gpointer user_data, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
288 |
- GFreeFunc destroy_notify, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
289 |
- GError** err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
290 |
- typedef void (*GConfClientNotifyRemoveType) (void *client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
291 |
- guint cnxn); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
292 |
- typedef void (*GConfClientAddDirType) (void *client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
293 |
- const gchar *dir, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
294 |
- guint8 preload, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
295 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
296 |
- typedef void (*GConfClientRemoveDirType) (void *client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
297 |
- const gchar *dir, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
298 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
299 |
+struct ComplexMozPrefMapping { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
300 |
+ const char* mozPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
301 |
+ ComplexMozPrefChanged callback; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
302 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
303 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
304 |
- typedef const char* (*GConfEntryGetKeyType) (const void *entry); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
305 |
- typedef GConfValue* (*GConfEntryGetValueType) (const void *entry); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
306 |
+class nsSystemPrefService : public nsISystemPrefService, nsIPrefBranch |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
307 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
308 |
+ public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
309 |
+ NS_DECL_ISUPPORTS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
310 |
+ NS_DECL_NSIPREFBRANCH |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
311 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
312 |
- typedef const char* (*GConfValueGetStringType) (const GConfValue *value); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
313 |
- typedef PRInt32 (*GConfValueGetIntType) (const GConfValue *value); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
314 |
- typedef PRBool (*GConfValueGetBoolType) (const GConfValue *value); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
315 |
+ nsresult Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
316 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
317 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
318 |
- static void gconf_key_listener (void* client, guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
319 |
- void *entry, gpointer user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
320 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
321 |
+ virtual nsresult LoadSystemPreferences(nsISystemPref* aPrefs); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
322 |
+ virtual nsresult NotifyMozillaPrefChanged(const char* aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
323 |
+ virtual nsresult NotifyUnloadSystemPreferences(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
324 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
325 |
-struct GConfCallbackData |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
326 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
327 |
- GConfProxy *proxy; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
328 |
- void * userData; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
329 |
- PRUint32 atom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
330 |
- PRUint32 notifyId; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
331 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
332 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
333 |
-// GConPrxoy is a thin wrapper for easy use of gconf funcs. It loads the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
334 |
-// gconf library and initializes the func pointers for later use. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
335 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
336 |
-class GConfProxy |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
337 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
338 |
-public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
339 |
- GConfProxy(nsSystemPrefService* aSysPrefService); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
340 |
- ~GConfProxy(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
341 |
- PRBool Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
342 |
+ nsSystemPrefService(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
343 |
+ virtual ~nsSystemPrefService(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
344 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
345 |
- nsresult GetBoolPref(const char *aMozKey, PRBool *retval); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
346 |
- nsresult GetCharPref(const char *aMozKey, char **retval); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
347 |
- nsresult GetIntPref(const char *aMozKey, PRInt32 *retval); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
348 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
349 |
- nsresult NotifyAdd (PRUint32 aAtom, void *aUserData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
350 |
- nsresult NotifyRemove (PRUint32 aAtom, const void *aUserData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
351 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
352 |
- nsresult GetAtomForMozKey(const char *aMozKey, PRUint32 *aAtom) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
353 |
- return GetAtom(aMozKey, 0, aAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
354 |
+ nsISystemPref* GetPrefs() { return mPref; } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
355 |
+ SimplePrefMapping* GetSimpleCallbackData(PRUint32 aKey) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
356 |
+ SimplePrefMapping* result = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
357 |
+ mGConfSimpleCallbacks.Get(aKey, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
358 |
+ return result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
359 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
360 |
- const char *GetMozKey(PRUint32 aAtom) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
361 |
- return GetKey(aAtom, 0); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
362 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
363 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
364 |
- void OnNotify(void *aClient, void * aEntry, PRUint32 aNotifyId, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
365 |
- GConfCallbackData *aData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
366 |
+ ComplexGConfPrefMapping* GetComplexCallbackData(PRUint32 aKey) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
367 |
+ ComplexGConfPrefMapping* result = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
368 |
+ mGConfComplexCallbacks.Get(aKey, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
369 |
+ return result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
370 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
371 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
372 |
private: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
373 |
- void *mGConfClient; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
374 |
- PRLibrary *mGConfLib; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
375 |
- PRBool mInitialized; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
376 |
- nsSystemPrefService *mSysPrefService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
377 |
+ nsISystemPref* mPref; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
378 |
+ nsDataHashtable<nsUint32HashKey, SimplePrefMapping*> mGConfSimpleCallbacks; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
379 |
+ nsDataHashtable<nsUint32HashKey, ComplexGConfPrefMapping*> mGConfComplexCallbacks; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
380 |
+ // This is set to PR_FALSE temporarily to stop listening to gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
381 |
+ // change notifications (while we change gconf values) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
382 |
+ PRPackedBool mListenToGConf; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
383 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
384 |
- //listeners |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
385 |
- nsAutoVoidArray *mObservers; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
386 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
387 |
- void InitFuncPtrs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
388 |
- //gconf public func ptrs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
389 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
390 |
- //gconf client funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
391 |
- GConfClientGetDefaultType GConfClientGetDefault; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
392 |
- GConfClientGetBoolType GConfClientGetBool; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
393 |
- GConfClientGetStringType GConfClientGetString; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
394 |
- GConfClientGetIntType GConfClientGetInt; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
395 |
- GConfClientGetListType GConfClientGetList; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
396 |
- GConfClientNotifyAddType GConfClientNotifyAdd; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
397 |
- GConfClientNotifyRemoveType GConfClientNotifyRemove; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
398 |
- GConfClientAddDirType GConfClientAddDir; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
399 |
- GConfClientRemoveDirType GConfClientRemoveDir; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
400 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
401 |
- //gconf entry funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
402 |
- GConfEntryGetValueType GConfEntryGetValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
403 |
- GConfEntryGetKeyType GConfEntryGetKey; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
404 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
405 |
- //gconf value funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
406 |
- GConfValueGetBoolType GConfValueGetBool; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
407 |
- GConfValueGetStringType GConfValueGetString; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
408 |
- GConfValueGetIntType GConfValueGetInt; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
409 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
410 |
- //pref name translating stuff |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
411 |
- nsresult GetAtom(const char *aKey, PRUint8 aNameType, PRUint32 *aAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
412 |
- nsresult GetAtomForGConfKey(const char *aGConfKey, PRUint32 *aAtom) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
413 |
- {return GetAtom(aGConfKey, 1, aAtom);} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
414 |
- const char *GetKey(PRUint32 aAtom, PRUint8 aNameType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
415 |
- const char *GetGConfKey(PRUint32 aAtom) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
416 |
- {return GetKey(aAtom, 1); } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
417 |
- inline const char *MozKey2GConfKey(const char *aMozKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
418 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
419 |
- //const strings |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
420 |
- static const char sPrefGConfKey[]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
421 |
- static const char sDefaultLibName1[]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
422 |
- static const char sDefaultLibName2[]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
423 |
+ GConfValue* GConfGet(const char *aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
424 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
425 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
426 |
-struct SysPrefCallbackData { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
427 |
- nsISupports *observer; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
428 |
- PRBool bIsWeakRef; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
429 |
- PRUint32 prefAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
430 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
431 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
432 |
-PRBool |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
433 |
-sysPrefDeleteObserver(void *aElement, void *aData) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
434 |
- SysPrefCallbackData *pElement = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
435 |
- static_cast<SysPrefCallbackData *>(aElement); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
436 |
- NS_RELEASE(pElement->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
437 |
- nsMemory::Free(pElement); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
438 |
- return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
439 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
440 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
441 |
-NS_IMPL_ISUPPORTS2(nsSystemPrefService, nsIPrefBranch, nsIPrefBranch2) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
442 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
443 |
-/* public */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
444 |
nsSystemPrefService::nsSystemPrefService() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
445 |
- :mInitialized(PR_FALSE), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
446 |
- mGConf(nsnull), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
447 |
- mObservers(nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
448 |
+ : mPref(nsnull), mListenToGConf(PR_TRUE) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
449 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
450 |
+ mGConfSimpleCallbacks.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
451 |
+ mGConfComplexCallbacks.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
452 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
453 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
454 |
nsSystemPrefService::~nsSystemPrefService() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
455 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
456 |
- mInitialized = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
457 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
458 |
- if (mGConf) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
459 |
- delete mGConf; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
460 |
- if (mObservers) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
461 |
- (void)mObservers->EnumerateForwards(sysPrefDeleteObserver, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
462 |
- delete mObservers; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
463 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
464 |
+ NotifyUnloadSystemPreferences(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
465 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
466 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
467 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
468 |
nsSystemPrefService::Init() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
469 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
470 |
- if (!gSysPrefLog) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
471 |
- gSysPrefLog = PR_NewLogModule("Syspref"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
472 |
- if (!gSysPrefLog) return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
473 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
474 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
475 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
476 |
+NS_IMPL_ISUPPORTS2(nsSystemPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
477 |
+ nsISystemPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
478 |
+ nsIPrefBranch) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
479 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
480 |
+static GConfClient* GetGConf() { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
481 |
+ return gconf_client_get_default(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
482 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
483 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
484 |
+static PRBool VerifyMatchingTypes(nsISystemPref* aPrefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
485 |
+ const char* aMozPref, GConfValue* aVal) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
486 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
487 |
+ nsCOMPtr<nsIPrefBranch2> prefBranch = aPrefs->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
488 |
+ PRInt32 type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
489 |
+ nsresult rv = prefBranch->GetPrefType(aMozPref, &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
490 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
491 |
+ // pref probably doesn't exist. Let gconf set it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
492 |
+ return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
493 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
494 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
495 |
- SYSPREF_LOG(("Init SystemPref Service\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
496 |
- if (mInitialized) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
497 |
+ PRBool ok; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
498 |
+ switch (aVal->type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
499 |
+ case GCONF_VALUE_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
500 |
+ ok = type == nsIPrefBranch2::PREF_STRING; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
501 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
502 |
+ case GCONF_VALUE_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
503 |
+ ok = type == nsIPrefBranch2::PREF_INT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
504 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
505 |
+ case GCONF_VALUE_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
506 |
+ ok = type == nsIPrefBranch2::PREF_BOOL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
507 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
508 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
509 |
+ NS_ERROR("Unhandled gconf preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
510 |
+ return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
511 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
512 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
513 |
+ NS_ASSERTION(ok, "Mismatched gconf/Mozilla pref types"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
514 |
+ return ok; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
515 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
516 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
517 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
518 |
+ * Map a gconf pref value into the corresponding Mozilla pref. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
519 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
520 |
+static nsresult ApplySimpleMapping(SimplePrefMapping* aMap, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
521 |
+ nsISystemPref* aPrefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
522 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
523 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
524 |
+ GConfValue* val = gconf_client_get(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
525 |
+ if (!val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
526 |
+ // No gconf key, so there's really nothing to do |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
527 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
528 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
529 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
530 |
+ VerifyMatchingTypes(aPrefs, aMap->mozPrefName, val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
531 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
532 |
+ PRBool locked = !aMap->allowWritesFromMozilla || |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
533 |
+ !gconf_client_key_is_writable(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
534 |
+ nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
535 |
+ switch (val->type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
536 |
+ case GCONF_VALUE_STRING: { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
537 |
+ const char* str = gconf_value_get_string(val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
538 |
+ rv = aPrefs->SetOverridingMozillaStringPref(aMap->mozPrefName, str, locked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
539 |
+ // XXX do we need to free 'str' here? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
540 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
541 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
542 |
+ case GCONF_VALUE_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
543 |
+ rv = aPrefs->SetOverridingMozillaIntPref(aMap->mozPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
544 |
+ gconf_value_get_int(val), locked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
545 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
546 |
+ case GCONF_VALUE_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
547 |
+ rv = aPrefs->SetOverridingMozillaBoolPref(aMap->mozPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
548 |
+ gconf_value_get_bool(val), locked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
549 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
550 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
551 |
+ NS_ERROR("Unusable gconf value type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
552 |
+ rv = NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
553 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
554 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
555 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
556 |
+ gconf_value_free(val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
557 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
558 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
559 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
560 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
561 |
+ * Map a Mozilla pref into the corresponding gconf pref, if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
562 |
+ * that's allowed. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
563 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
564 |
+static nsresult ReverseApplySimpleMapping(SimplePrefMapping* aMap, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
565 |
+ nsISystemPref* aPrefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
566 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
567 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
568 |
+ // Verify that the gconf key has the right type, if it exists |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
569 |
+ GConfValue* val = gconf_client_get(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
570 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
571 |
+ VerifyMatchingTypes(aPrefs, aMap->mozPrefName, val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
572 |
+ gconf_value_free(val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
573 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
574 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
575 |
+ PRBool writable = aMap->allowWritesFromMozilla && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
576 |
+ gconf_client_key_is_writable(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
577 |
+ if (!writable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
578 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
579 |
return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
580 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
581 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
582 |
- if (!mGConf) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
583 |
- mGConf = new GConfProxy(this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
584 |
- if (!mGConf->Init()) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
585 |
- delete mGConf; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
586 |
- mGConf = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
587 |
+ nsCOMPtr<nsIPrefBranch2> prefBranch = aPrefs->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
588 |
+ PRInt32 type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
589 |
+ nsresult rv = prefBranch->GetPrefType(aMap->mozPrefName, &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
590 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
591 |
+ NS_ERROR("Writing back a pref that doesn't exist?"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
592 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
593 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
594 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
595 |
+ switch (type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
596 |
+ case nsIPrefBranch2::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
597 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
598 |
+ char* result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
599 |
+ rv = prefBranch->GetCharPref(aMap->mozPrefName, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
600 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
601 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
602 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
603 |
+ gconf_client_set_string(aClient, aMap->gconfPrefName, result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
604 |
+ nsMemory::Free(result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
605 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
606 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
607 |
+ case nsIPrefBranch2::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
608 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
609 |
+ PRInt32 result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
610 |
+ rv = prefBranch->GetIntPref(aMap->mozPrefName, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
611 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
612 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
613 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
614 |
+ gconf_client_set_int(aClient, aMap->gconfPrefName, result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
615 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
616 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
617 |
+ case nsIPrefBranch2::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
618 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
619 |
+ PRBool result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
620 |
+ rv = prefBranch->GetBoolPref(aMap->mozPrefName, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
621 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
622 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
623 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
624 |
+ gconf_client_set_bool(aClient, aMap->gconfPrefName, result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
625 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
626 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
627 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
628 |
+ NS_ERROR("Unhandled gconf preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
629 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
630 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
631 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
632 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
633 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
634 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
635 |
+/* BEGIN preference mapping definition area |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
636 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
637 |
+ * There are a few rules that our preference maps have to obey: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
638 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
639 |
+ * 1) Each mapping defines a relationship R between a set of GConf preferences and |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
640 |
+ * a set of Mozilla preferences that must *always* be true. Thus, when a Mozilla |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
641 |
+ * pref changes or a gconf pref changes, we may need to change something on the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
642 |
+ * other side to preserve R. If a GConf preference is read-only, then we may |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
643 |
+ * need to lock one or more Mozilla preferences to avoid a situation where the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
644 |
+ * Mozilla preference changes and we can't update the GConf preference to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
645 |
+ * ensure R continues to hold. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
646 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
647 |
+ * 2) If an unlocked Mozilla preference is changed, then we can only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
648 |
+ * preserve R by changing GConf preferences; we are not allowed to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
649 |
+ * change Mozilla preferences. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
650 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
651 |
+ * 3) If a GConf preference is changed, then we can only preserve R by |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
652 |
+ * changing Moozilla preferences; we are nt allowed to change GConf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
653 |
+ * preferences. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
654 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
655 |
+ * For "simple" mappings, the relationship R is just of the form |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
656 |
+ * "GConf preference 'A' is equal to Mozilla preference 'B'". R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
657 |
+ * preserved by setting A to B when B changes, and by setting B to A |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
658 |
+ * when A changes. If A is read-only then we lock B (or we may just |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
659 |
+ * decide to lock B for other reasons). Thus rules 1-3 are satisfied. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
660 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
661 |
+ * For "complex" mappings we have more complicated |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
662 |
+ * relationships. These are documented below. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
663 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
664 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
665 |
+static SimplePrefMapping sSimplePrefMappings[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
666 |
+ // GNOME accessibility setting; never allow this to be set by Firefox |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
667 |
+ {"config.use_system_prefs.accessibility", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
668 |
+ "/desktop/gnome/interface/accessibility", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
669 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
670 |
+ // GConf Firefox preferences; allow these to be set through the Firefox UI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
671 |
+ {"security.enable_java", "/apps/firefox/web/java_enabled", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
672 |
+ {"javascript.enabled", "/apps/firefox/web/javascript_enabled", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
673 |
+ {"browser.startup.homepage", "/apps/firefox/general/homepage_url", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
674 |
+ {"browser.cache.disk.capacity", "/apps/firefox/web/cache_size", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
675 |
+ {"network.cookie.lifetimePolicy", "/apps/firefox/web/cookie_accept", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
676 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
677 |
+ // UI lockdown settings; never allow these to be set by Firefox. There is no |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
678 |
+ // Firefox UI for these but they could otherwise be set via about:config. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
679 |
+ {"config.lockdown.printing", "/desktop/gnome/lockdown/disable_printing", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
680 |
+ {"config.lockdown.printsetup", "/desktop/gnome/lockdown/disable_print_setup", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
681 |
+ {"config.lockdown.savepage", "/desktop/gnome/lockdown/disable_save_to_disk", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
682 |
+ {"config.lockdown.history", "/apps/firefox/lockdown/disable_history", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
683 |
+ {"config.lockdown.toolbarediting", "/apps/firefox/lockdown/disable_toolbar_editing", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
684 |
+ {"config.lockdown.urlbar", "/apps/firefox/lockdown/disable_url_bar", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
685 |
+ {"config.lockdown.bookmark", "/apps/firefox/lockdown/disable_bookmark_editing", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
686 |
+ {"config.lockdown.disable_themes", "/apps/firefox/lockdown/disable_themes", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
687 |
+ {"config.lockdown.disable_extensions", "/apps/firefox/lockdown/disable_extensions", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
688 |
+ {"config.lockdown.searchbar", "/apps/firefox/lockdown/disable_searchbar", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
689 |
+ {"config.lockdown.hidebookmark", "/apps/firefox/lockdown/hide_bookmark", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
690 |
+ {"config.lockdown.showsavedpasswords", "/apps/firefox/lockdown/disable_show_passwords", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
691 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
692 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
693 |
+static nsresult ApplyListPref(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
694 |
+ GConfClient* aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
695 |
+ const char* aGConfKey, const char* aMozKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
696 |
+ char aSeparator) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
697 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
698 |
+ GSList* list = gconf_client_get_list(aClient, aGConfKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
699 |
+ GCONF_VALUE_STRING, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
700 |
+ nsCAutoString str; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
701 |
+ for (GSList* l = list; l; l = l->next) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
702 |
+ str.Append((const char*)l->data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
703 |
+ if (l->next) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
704 |
+ str.Append(aSeparator); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
705 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
706 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
707 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, aGConfKey, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
708 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
709 |
+ SetOverridingMozillaStringPref(aMozKey, str.get(), lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
710 |
+ // XXX does this free the strings? Should it? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
711 |
+ g_slist_free(list); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
712 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
713 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
714 |
+static nsresult ReverseApplyListPref(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
715 |
+ GConfClient* aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
716 |
+ const char* aGConfKey, const char* aMozKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
717 |
+ char aSeparator) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
718 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
719 |
+ char* data = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
720 |
+ nsCOMPtr<nsIPrefBranch2> prefs = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
721 |
+ aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
722 |
+ prefs->GetCharPref(aMozKey, &data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
723 |
+ if (!data) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
724 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
725 |
+ nsresult rv = NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
726 |
+ GSList* list = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
727 |
+ PRInt32 i = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
728 |
+ while (data[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
729 |
+ const char* nextComma = strchr(data+i, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
730 |
+ PRInt32 tokLen = nextComma ? nextComma - (data+i) : strlen(data+i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
731 |
+ char* tok = strndup(data+i, tokLen); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
732 |
+ if (!tok) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
733 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
734 |
+ GSList* newList = g_slist_append(list, tok); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
735 |
+ if (!newList) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
736 |
+ rv = NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
737 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
738 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
739 |
+ list = newList; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
740 |
+ if (!nextComma) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
741 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
742 |
+ i = nextComma + 1 - data; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
743 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
744 |
+ nsMemory::Free(data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
745 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
746 |
+ if (gconf_client_key_is_writable(aClient, aGConfKey, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
747 |
+ gconf_client_set_list(aClient, aGConfKey, GCONF_VALUE_STRING, list, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
748 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
749 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
750 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
751 |
+ for (GSList* l = list; l; l = l->next) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
752 |
+ free(l->data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
753 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
754 |
+ g_slist_free(list); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
755 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
756 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
757 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
758 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
759 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
760 |
+ * "network.negotiate-auth.trusted-uris" is the comma-separated concatenation |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
761 |
+ * of the elements of the list "/apps/firefox/general/trusted_URIs" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
762 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
763 |
+static const char GConfKey_TrustedURIs[] = "/apps/firefox/general/trusted_URIs"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
764 |
+static const char MozKey_TrustedURIs[] = "network.negotiate-auth.trusted-uris"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
765 |
+static nsresult ApplyTrustedURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
766 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
767 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
768 |
+ return ApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
769 |
+ GConfKey_TrustedURIs, MozKey_TrustedURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
770 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
771 |
+static nsresult ReverseApplyTrustedURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
772 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
773 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
774 |
+ return ReverseApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
775 |
+ GConfKey_TrustedURIs, MozKey_TrustedURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
776 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
777 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
778 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
779 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
780 |
+ * "network.negotiate-auth.delegation-uris" is the comma-separated concatenation |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
781 |
+ * of the elements of the list "/apps/firefox/general/delegation_URIs" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
782 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
783 |
+static const char GConfKey_DelegationURIs[] = "/apps/firefox/general/delegation_URIs"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
784 |
+static const char MozKey_DelegationURIs[] = "network.negotiate-auth.delegation-uris"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
785 |
+static nsresult ApplyDelegationURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
786 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
787 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
788 |
+ return ApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
789 |
+ GConfKey_DelegationURIs, MozKey_DelegationURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
790 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
791 |
+static nsresult ReverseApplyDelegationURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
792 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
793 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
794 |
+ return ReverseApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
795 |
+ GConfKey_DelegationURIs, MozKey_DelegationURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
796 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
797 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
798 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
799 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
800 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
801 |
+ * If "/apps/firefox/web/download_defaultfolder" is the empty string, then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
802 |
+ * "browser.download.useDownloadDir" is false; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
803 |
+ * otherwise "browser.download.useDownloadDir" is true and "browser.download.folderList" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
804 |
+ * is (0 if "/apps/firefox/web/download_defaultfolder" is "Desktop"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
805 |
+ * 1 if "/apps/firefox/web/download_defaultfolder" is "My Downloads"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
806 |
+ * 3 if "/apps/firefox/web/download_defaultfolder" is "Home"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
807 |
+ * otherwise 2 and "browser.download.dir" = "/apps/firefox/web/download_defaultfolder") |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
808 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
809 |
+static const char GConfKey_DownloadFolder[] = "/apps/firefox/web/download_defaultfolder"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
810 |
+static const char MozKey_UseDownloadDir[] = "browser.download.useDownloadDir"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
811 |
+static const char MozKey_DownloadDirType[] = "browser.download.folderList"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
812 |
+static const char MozKey_DownloadDirExplicit[] = "browser.download.dir"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
813 |
+static nsresult ApplyDownloadFolder(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
814 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
815 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
816 |
+ char* str = gconf_client_get_string(aClient, GConfKey_DownloadFolder, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
817 |
+ if (!str) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
818 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
819 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DownloadFolder, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
820 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
821 |
+ SetOverridingMozillaBoolPref(MozKey_UseDownloadDir, *str != 0, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
822 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
823 |
+ g_free(str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
824 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
825 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
826 |
+ PRInt32 dirType = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
827 |
+ if (!strcmp(str, "Desktop")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
828 |
+ dirType = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
829 |
+ } else if (!strcmp(str, "My Downloads")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
830 |
+ dirType = 1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
831 |
+ } else if (!strcmp(str, "Home")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
832 |
+ dirType = 3; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
833 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
834 |
+ dirType = 2; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
835 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
836 |
+ // Always set all three Mozilla preferences. This is simpler and avoids |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
837 |
+ // problems; e.g., if the gconf value changes from "/home/rocallahan" to "Desktop" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
838 |
+ // we might leave MozKey_DownloadDirType accidentally locked. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
839 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
840 |
+ SetOverridingMozillaIntPref(MozKey_DownloadDirType, dirType, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
841 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
842 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
843 |
+ SetOverridingMozillaStringPref(MozKey_DownloadDirExplicit, str, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
844 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
845 |
+ g_free(str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
846 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
847 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
848 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
849 |
+static nsresult ReverseApplyDownloadFolder(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
850 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
851 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
852 |
+ PRBool useDownloadDir = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
853 |
+ const char* result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
854 |
+ char* explicitStr = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
855 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
856 |
+ prefs->GetBoolPref(MozKey_UseDownloadDir, &useDownloadDir); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
857 |
+ if (!useDownloadDir) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
858 |
+ result = ""; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
859 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
860 |
+ PRInt32 type = -1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
861 |
+ prefs->GetIntPref(MozKey_DownloadDirType, &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
862 |
+ if (type < 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
863 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
864 |
+ switch (type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
865 |
+ case 0: result = "Desktop"; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
866 |
+ case 1: result = "Downloads"; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
867 |
+ case 2: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
868 |
+ prefs->GetCharPref(MozKey_DownloadDirExplicit, &explicitStr); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
869 |
+ result = explicitStr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
870 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
871 |
+ case 3: result = "Home"; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
872 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
873 |
+ NS_ERROR("Unknown download dir type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
874 |
return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
875 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
876 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
877 |
+ if (!result) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
878 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
879 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DownloadFolder, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
880 |
+ gconf_client_set_string(aClient, GConfKey_DownloadFolder, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
881 |
+ result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
882 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
883 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
884 |
+ nsMemory::Free(explicitStr); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
885 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
886 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
887 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
888 |
- mInitialized = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
889 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
890 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
891 |
+ * "/apps/firefox/web/disable_cookies" is true if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
892 |
+ * "network.cookie.cookieBehavior" is 2 ('dontUse') |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
893 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
894 |
+static const char GConfKey_DisableCookies[] = "/apps/firefox/web/disable_cookies"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
895 |
+static const char MozKey_CookieBehavior[] = "network.cookie.cookieBehavior"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
896 |
+static const char MozKey_CookieExceptions[] = "network.cookie.honorExceptions"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
897 |
+static const char MozKey_CookieViewExceptions[] = "pref.privacy.disable_button.cookie_exceptions"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
898 |
+static nsresult ApplyDisableCookies(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
899 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
900 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
901 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableCookies, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
902 |
+ PRInt32 behavior = -1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
903 |
+ nsCOMPtr<nsIPrefBranch2> prefs = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
904 |
+ aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
905 |
+ prefs->GetIntPref(MozKey_CookieBehavior, &behavior); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
906 |
+ if (behavior < 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
907 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
908 |
+ if (disable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
909 |
+ behavior = 2; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
910 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
911 |
+ if (behavior == 2) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
912 |
+ behavior = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
913 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
914 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
915 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableCookies, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
916 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
917 |
+ SetOverridingMozillaBoolPref(MozKey_CookieExceptions, !lock, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
918 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
919 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
920 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
921 |
+ SetOverridingMozillaBoolPref(MozKey_CookieViewExceptions, lock, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
922 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
923 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
924 |
+ return aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
925 |
+ SetOverridingMozillaIntPref(MozKey_CookieBehavior, behavior, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
926 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
927 |
+static nsresult ReverseApplyDisableCookies(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
928 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
929 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
930 |
+ PRInt32 behavior = -1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
931 |
+ nsCOMPtr<nsIPrefBranch2> prefs = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
932 |
+ aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
933 |
+ prefs->GetIntPref(MozKey_CookieBehavior, &behavior); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
934 |
+ if (behavior < 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
935 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
936 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisableCookies, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
937 |
+ gconf_client_set_bool(aClient, GConfKey_DisableCookies, behavior == 2, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
938 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
939 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
940 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
941 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
942 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
943 |
+static char const* windowOpenFeatures[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
944 |
+ "dom.disable_window_open_feature.close", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
945 |
+ "dom.disable_window_open_feature.directories", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
946 |
+ "dom.disable_window_open_feature.location", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
947 |
+ "dom.disable_window_open_feature.menubar", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
948 |
+ "dom.disable_window_open_feature.minimizable", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
949 |
+ "dom.disable_window_open_feature.personalbar", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
950 |
+ "dom.disable_window_open_feature.resizable", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
951 |
+ "dom.disable_window_open_feature.scrollbars", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
952 |
+ "dom.disable_window_open_feature.status", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
953 |
+ "dom.disable_window_open_feature.titlebar", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
954 |
+ "dom.disable_window_open_feature.toolbar" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
955 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
956 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
957 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
958 |
+ * "/apps/firefox/lockdown/disable_javascript_chrome" is true if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
959 |
+ * all of windowOpenFeatures are true |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
960 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
961 |
+static const char GConfKey_DisableJSChrome[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
962 |
+ "/apps/firefox/lockdown/disable_javascript_chrome"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
963 |
+static nsresult ApplyWindowOpen(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
964 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
965 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
966 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableJSChrome, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
967 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableJSChrome, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
968 |
+ PRBool curValues[NUM_ELEM(windowOpenFeatures)]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
969 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
970 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
971 |
+ PRBool allDisabled = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
972 |
+ for (i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
973 |
+ nsresult rv = prefs->GetBoolPref(windowOpenFeatures[i], &curValues[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
974 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
975 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
976 |
+ if (!curValues[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
977 |
+ allDisabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
978 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
979 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
980 |
+ for (i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
981 |
+ PRBool newVal = curValues[i]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
982 |
+ if (disable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
983 |
+ newVal = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
984 |
+ } else if (allDisabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
985 |
+ // If all disable-window-open-feature prefs are currently |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
986 |
+ // PR_TRUE, then we need to set at least one of them to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
987 |
+ // PR_FALSE. Set all of them to PR_FALSE. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
988 |
+ newVal = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
989 |
+ } // If at least one disable-window-open-feature pref is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
990 |
+ // currently PR_FALSE, then we don't need to change anything |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
991 |
+ // when the gconf pref says don't disable |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
992 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
993 |
+ SetOverridingMozillaBoolPref(windowOpenFeatures[i], newVal, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
994 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
995 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
996 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
997 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
998 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
999 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1000 |
+static nsresult ReverseApplyWindowOpen(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1001 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1002 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1003 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1004 |
+ PRBool allDisabled = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1005 |
+ PRBool curValues[NUM_ELEM(windowOpenFeatures)]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1006 |
+ for (PRUint32 i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1007 |
+ nsresult rv = prefs->GetBoolPref(windowOpenFeatures[i], &curValues[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1008 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1009 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1010 |
+ if (!curValues[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1011 |
+ allDisabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1012 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1013 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1014 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisableJSChrome, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1015 |
+ gconf_client_set_bool(aClient, GConfKey_DisableJSChrome, allDisabled, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1016 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1017 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1018 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1019 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1020 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1021 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1022 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1023 |
+ * If "/apps/firefox/lockdown/disable_unsafe_protocol" is true then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1024 |
+ * -- "network.protocol-handler.blocked-default" is true |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1025 |
+ * -- "network.protocol-handler.blocked.XYZ" is false if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1026 |
+ * XYZ is a builtin non-disablable protocol or in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1027 |
+ * "/apps/firefox/lockdown/additional_safe_protocols" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1028 |
+ * AND if "/apps/firefox/lockdown/disable_unsafe_protocol" is false then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1029 |
+ * -- "network.protocol-handler.blocked-default" is false |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1030 |
+ * -- if "network.protocol-handler.blocked.XYZ" exists then it is false |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1031 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1032 |
+static const char GConfKey_DisableUnsafeProtocols[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1033 |
+ "/apps/firefox/lockdown/disable_unsafe_protocol"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1034 |
+static const char GConfKey_AdditionalSafeProtocols[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1035 |
+ "/apps/firefox/lockdown/additional_safe_protocols"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1036 |
+static const char MozKey_BlockedDefault[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1037 |
+ "network.protocol-handler.blocked-default"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1038 |
+static const char MozKey_BlockedPrefix[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1039 |
+ "network.protocol-handler.blocked."; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1040 |
+static const char* nonDisablableBuiltinProtocols[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1041 |
+ { "about", "data", "jar", "keyword", "resource", "viewsource", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1042 |
+ "chrome", "moz-icon", "javascript", "file" }; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1043 |
+static PRBool FindString(const char** aList, PRInt32 aCount, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1044 |
+ const char* aStr) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1045 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1046 |
+ for (PRInt32 i = 0; i < aCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1047 |
+ if (!strcmp(aStr, aList[i])) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1048 |
+ return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1049 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1050 |
+ return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1051 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1052 |
+typedef nsDataHashtable<nsCStringHashKey,int> StringSet; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1053 |
+/** Collect the set of protocol names that we want to set preferences for */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1054 |
+static nsresult AddAllProtocols(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1055 |
+ const char* aSafeProtocols, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1056 |
+ StringSet* aProtocolSet, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1057 |
+ StringSet* aSafeSet) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1058 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1059 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1060 |
+ PRUint32 childCount; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1061 |
+ char **childArray = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1062 |
+ nsresult rv = prefs->GetChildList(MozKey_BlockedPrefix, &childCount, &childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1063 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1064 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1065 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1066 |
+ for (i = 0; i < childCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1067 |
+ nsDependentCString tmp(childArray[i] + NUM_ELEM(MozKey_BlockedPrefix)-1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1068 |
+ aProtocolSet->Put(tmp, 1); // copies |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1069 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1070 |
+ for (i = 0; i < NUM_ELEM(nonDisablableBuiltinProtocols); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1071 |
+ nsDependentCString tmp(nonDisablableBuiltinProtocols[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1072 |
+ aProtocolSet->Put(tmp, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1073 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1074 |
+ i = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1075 |
+ while (aSafeProtocols[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1076 |
+ const char* nextComma = strchr(aSafeProtocols+i, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1077 |
+ PRUint32 tokLen = nextComma ? nextComma - (aSafeProtocols+i) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1078 |
+ : strlen(aSafeProtocols+i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1079 |
+ nsCAutoString tok(aSafeProtocols+i, tokLen); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1080 |
+ aProtocolSet->Put(tok, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1081 |
+ aSafeSet->Put(tok, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1082 |
+ if (nextComma) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1083 |
+ i = nextComma - aSafeProtocols + 1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1084 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1085 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1086 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1087 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1088 |
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1089 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1090 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1091 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1092 |
+struct ProtocolPrefClosure { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1093 |
+ StringSet safeProtocolSet; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1094 |
+ nsIPrefBranch2* prefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1095 |
+ nsISystemPref* prefSetter; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1096 |
+ PRPackedBool disableUnsafe; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1097 |
+ PRPackedBool lock; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1098 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1099 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1100 |
+static PLDHashOperator PR_CALLBACK SetProtocolPref(const nsACString& aKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1101 |
+ int aItem, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1102 |
+ void* aClosure) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1103 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1104 |
+ ProtocolPrefClosure* closure = static_cast<ProtocolPrefClosure*>(aClosure); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1105 |
+ const nsCString& protocol = PromiseFlatCString(aKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1106 |
+ PRBool blockProtocol = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1107 |
+ if (closure->disableUnsafe && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1108 |
+ !FindString(nonDisablableBuiltinProtocols, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1109 |
+ NUM_ELEM(nonDisablableBuiltinProtocols), protocol.get()) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1110 |
+ !closure->safeProtocolSet.Get(aKey, nsnull)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1111 |
+ blockProtocol = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1112 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1113 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1114 |
+ nsCAutoString prefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1115 |
+ prefName.Append(MozKey_BlockedPrefix); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1116 |
+ prefName.Append(protocol); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1117 |
+ closure->prefSetter->SetOverridingMozillaBoolPref(prefName.get(), blockProtocol, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1118 |
+ closure->lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1119 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1120 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1121 |
+static nsresult ApplyUnsafeProtocols(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1122 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1123 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1124 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableUnsafeProtocols, nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1125 |
+ || !gconf_client_key_is_writable(aClient, GConfKey_AdditionalSafeProtocols, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1126 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableUnsafeProtocols, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1127 |
+ char* protocols = gconf_client_get_string(aClient, GConfKey_AdditionalSafeProtocols, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1128 |
+ if (!protocols) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1129 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1130 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1131 |
+ SetOverridingMozillaBoolPref(MozKey_BlockedDefault, disable, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1132 |
+ StringSet protocolSet; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1133 |
+ ProtocolPrefClosure closure; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1134 |
+ protocolSet.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1135 |
+ closure.safeProtocolSet.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1136 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1137 |
+ rv = AddAllProtocols(aPrefService, protocols, &protocolSet, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1138 |
+ &closure.safeProtocolSet); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1139 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1140 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1141 |
+ closure.disableUnsafe = disable; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1142 |
+ closure.lock = lock; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1143 |
+ closure.prefSetter = aPrefService->GetPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1144 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1145 |
+ closure.prefs = prefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1146 |
+ protocolSet.EnumerateRead(SetProtocolPref, &closure); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1147 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1148 |
+ g_free(protocols); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1149 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1150 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1151 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1152 |
+static nsresult ReverseApplyUnsafeProtocols(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1153 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1154 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1155 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1156 |
+ PRBool blockedDefault; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1157 |
+ nsresult rv = prefs->GetBoolPref(MozKey_BlockedDefault, &blockedDefault); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1158 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1159 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1160 |
+ nsCAutoString enabledProtocols; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1161 |
+ PRUint32 childCount; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1162 |
+ char **childArray = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1163 |
+ rv = prefs->GetChildList(MozKey_BlockedPrefix, &childCount, &childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1164 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1165 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1166 |
+ for (PRUint32 i = 0; i < childCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1167 |
+ PRBool val = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1168 |
+ prefs->GetBoolPref(childArray[i], &val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1169 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1170 |
+ if (enabledProtocols.Length() > 0) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1171 |
+ enabledProtocols.Append(','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1172 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1173 |
+ enabledProtocols.Append(childArray[i] + NUM_ELEM(MozKey_BlockedPrefix)-1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1174 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1175 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1176 |
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1177 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisableUnsafeProtocols, nsnull) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1178 |
+ gconf_client_key_is_writable(aClient, GConfKey_AdditionalSafeProtocols, nsnull)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1179 |
+ gconf_client_set_bool(aClient, GConfKey_DisableUnsafeProtocols, blockedDefault, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1180 |
+ gconf_client_set_string(aClient, GConfKey_AdditionalSafeProtocols, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1181 |
+ enabledProtocols.get(), nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1182 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1183 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1184 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1185 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1186 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1187 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1188 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1189 |
+ * Set config.lockdown.setwallpaper if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1190 |
+ * /desktop/gnome/background/picture_filename is write-only. Always |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1191 |
+ * lock it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1192 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1193 |
+static const char MozKey_LockdownWallpaper[] = "config.lockdown.setwallpaper"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1194 |
+static const char GConfKey_WallpaperSetting[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1195 |
+ "/desktop/gnome/background/picture_filename"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1196 |
+static nsresult ApplyWallpaper(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1197 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1198 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1199 |
+ PRBool canSetWallpaper = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1200 |
+ gconf_client_key_is_writable(aClient, GConfKey_WallpaperSetting, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1201 |
+ return aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1202 |
+ SetOverridingMozillaBoolPref(MozKey_LockdownWallpaper, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1203 |
+ !canSetWallpaper, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1204 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1205 |
+// No ReverseApplyWallpaper because this Mozilla pref can never be |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1206 |
+// modified |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1207 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1208 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1209 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1210 |
+ * "signon.rememberSignons" is true if and only if "/apps/firefox/web/disable_save_password" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1211 |
+ * is false. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1212 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1213 |
+static const char MozKey_RememberSignons[] = "signon.rememberSignons"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1214 |
+static const char GConfKey_DisableSavePassword[] = "/apps/firefox/web/disable_save_password"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1215 |
+static nsresult ApplyDisableSavePassword(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1216 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1217 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1218 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableSavePassword, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1219 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableSavePassword, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1220 |
+ return aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1221 |
+ SetOverridingMozillaBoolPref(MozKey_RememberSignons, !disable, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1222 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1223 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1224 |
+static nsresult ReverseApplyDisableSavePassword(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1225 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1226 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1227 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1228 |
+ PRBool remember; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1229 |
+ nsresult rv = prefs->GetBoolPref(MozKey_RememberSignons, &remember); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1230 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1231 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1232 |
+ gconf_client_set_bool(aClient, GConfKey_DisableSavePassword, !remember, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1233 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1234 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1235 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1236 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1237 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1238 |
+ * "permissions.default.image" is 1 (nsIPermissionManager::ALLOW_ACTION) if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1239 |
+ * "/apps/firefox/web/images_load" is 0, AND |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1240 |
+ * "permissions.default.image" is 2 (nsIPermissionManager::DENY_ACTION) if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1241 |
+ * "/apps/firefox/web/images_load" is 2, AND |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1242 |
+ * "permissions.default.image" is 3 if and only if "/apps/firefox/web/images_load" is 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1243 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1244 |
+ * Also, we set pref.advanced.images.disable_button.view_image iff |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1245 |
+ * /apps/firefox/web/images_load is read-only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1246 |
+ * And we set permissions.default.honorExceptions iff |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1247 |
+ * /apps/firefox/web/images_load is not read-only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1248 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1249 |
+static const char MozKey_ImagePermissions[] = "permissions.default.image"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1250 |
+static const char MozKey_ImageExceptions[] = "permissions.honorExceptions.image"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1251 |
+static const char MozKey_ImageViewExceptions[] = "pref.advanced.images.disable_button.view_image"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1252 |
+static const char GConfKey_LoadImages[] = "/apps/firefox/web/images_load"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1253 |
+static nsresult ApplyLoadImages(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1254 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1255 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1256 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_LoadImages, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1257 |
+ // 0 == accept, 1 == no-foreign, 2 == reject |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1258 |
+ gint setting = gconf_client_get_int(aClient, GConfKey_LoadImages, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1259 |
+ PRInt32 pref; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1260 |
+ switch (setting) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1261 |
+ case 0: pref = nsIPermissionManager::ALLOW_ACTION; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1262 |
+ case 2: pref = nsIPermissionManager::DENY_ACTION; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1263 |
+ case 1: pref = 3; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1264 |
+ default: return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1265 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1266 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1267 |
+ SetOverridingMozillaBoolPref(MozKey_ImageExceptions, !lock, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1268 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1269 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1270 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1271 |
+ SetOverridingMozillaBoolPref(MozKey_ImageViewExceptions, lock, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1272 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1273 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1274 |
+ return aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1275 |
+ SetOverridingMozillaIntPref(MozKey_ImagePermissions, pref, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1276 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1277 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1278 |
+static nsresult ReverseApplyLoadImages(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1279 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1280 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1281 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1282 |
+ PRInt32 pref; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1283 |
+ nsresult rv = prefs->GetIntPref(MozKey_ImagePermissions, &pref); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1284 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1285 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1286 |
+ gint setting; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1287 |
+ switch (pref) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1288 |
+ case nsIPermissionManager::ALLOW_ACTION: setting = 0; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1289 |
+ case nsIPermissionManager::DENY_ACTION: setting = 2; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1290 |
+ case 3: setting = 1; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1291 |
+ default: return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1292 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1293 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_LoadImages, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1294 |
+ gconf_client_set_int(aClient, GConfKey_LoadImages, setting, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1295 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1296 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1297 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1298 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1299 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1300 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1301 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1302 |
+ * "/apps/firefox/web/disable_popups" is true if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1303 |
+ * "dom.disable_open_during_load" is true |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1304 |
+ * AND if "/apps/firefox/web/disable_popups" is true then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1305 |
+ * "privacy.popups.showBrowserMessage" is false. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1306 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1307 |
+static const char MozKey_DisablePopups[] = "dom.disable_open_during_load"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1308 |
+static const char MozKey_DisableBrowserPopupMessage[] = "privacy.popups.showBrowserMessage"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1309 |
+static const char GConfKey_DisablePopups[] = "/apps/firefox/web/disable_popups"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1310 |
+static nsresult ApplyDisablePopups(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1311 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1312 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1313 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisablePopups, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1314 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisablePopups, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1315 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1316 |
+ SetOverridingMozillaBoolPref(MozKey_DisablePopups, disable, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1317 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1318 |
+ if (disable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1319 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1320 |
+ SetOverridingMozillaBoolPref(MozKey_DisableBrowserPopupMessage, PR_TRUE, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1321 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1322 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1323 |
+ StopOverridingMozillaPref(MozKey_DisableBrowserPopupMessage); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1324 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1325 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1326 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1327 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1328 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1329 |
+static nsresult ReverseApplyDisablePopups(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1330 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1331 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1332 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1333 |
+ PRBool disabled; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1334 |
+ nsresult rv = prefs->GetBoolPref(MozKey_DisablePopups, &disabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1335 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1336 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1337 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisablePopups, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1338 |
+ gconf_client_set_bool(aClient, GConfKey_DisablePopups, disabled, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1339 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1340 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1341 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1342 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1343 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1344 |
+static ComplexGConfPrefMapping sComplexGConfPrefMappings[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1345 |
+ {GConfKey_TrustedURIs, ApplyTrustedURIs}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1346 |
+ {GConfKey_DelegationURIs, ApplyDelegationURIs}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1347 |
+ {GConfKey_DownloadFolder, ApplyDownloadFolder}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1348 |
+ {GConfKey_DisableCookies, ApplyDisableCookies}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1349 |
+ {GConfKey_DisableJSChrome, ApplyWindowOpen}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1350 |
+ {GConfKey_DisableUnsafeProtocols, ApplyUnsafeProtocols}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1351 |
+ {GConfKey_AdditionalSafeProtocols, ApplyUnsafeProtocols}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1352 |
+ {GConfKey_WallpaperSetting, ApplyWallpaper}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1353 |
+ {GConfKey_DisableSavePassword, ApplyDisableSavePassword}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1354 |
+ {GConfKey_LoadImages, ApplyLoadImages}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1355 |
+ {GConfKey_DisablePopups, ApplyDisablePopups} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1356 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1357 |
+static ComplexMozPrefMapping sComplexMozPrefMappings[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1358 |
+ {MozKey_TrustedURIs, ReverseApplyTrustedURIs}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1359 |
+ {MozKey_DelegationURIs, ReverseApplyDelegationURIs}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1360 |
+ {MozKey_UseDownloadDir, ReverseApplyDownloadFolder}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1361 |
+ {MozKey_DownloadDirType, ReverseApplyDownloadFolder}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1362 |
+ {MozKey_DownloadDirExplicit, ReverseApplyDownloadFolder}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1363 |
+ {MozKey_CookieBehavior, ReverseApplyDisableCookies}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1364 |
+ {MozKey_RememberSignons, ReverseApplyDisableSavePassword}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1365 |
+ {MozKey_ImagePermissions, ReverseApplyLoadImages}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1366 |
+ {MozKey_DisablePopups, ReverseApplyDisablePopups} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1367 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1368 |
+// The unsafe protocol preferences are handled specially because |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1369 |
+// they affect an unknown number of Mozilla preferences |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1370 |
+// Window opener permissions are also handled specially so we don't have to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1371 |
+// repeat the windowOpenFeatures list. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1372 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1373 |
+/* END preference mapping definition area */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1374 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1375 |
+static PR_CALLBACK void GConfSimpleNotification(GConfClient* client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1376 |
+ guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1377 |
+ GConfEntry *entry, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1378 |
+ gpointer user_data) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1379 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1380 |
+ nsSystemPrefService* service = static_cast<nsSystemPrefService*>(user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1381 |
+ SimplePrefMapping* map = static_cast<SimplePrefMapping*>( |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1382 |
+ service->GetSimpleCallbackData(cnxn_id)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1383 |
+ NS_ASSERTION(map, "Can't find mapping for callback"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1384 |
+ if (!map) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1385 |
+ return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1386 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1387 |
+ ApplySimpleMapping(map, service->GetPrefs(), client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1388 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1389 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1390 |
+static PR_CALLBACK void GConfComplexNotification(GConfClient* client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1391 |
+ guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1392 |
+ GConfEntry *entry, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1393 |
+ gpointer user_data) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1394 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1395 |
+ nsSystemPrefService* service = static_cast<nsSystemPrefService*>(user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1396 |
+ ComplexGConfPrefMapping* map = static_cast<ComplexGConfPrefMapping*>( |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1397 |
+ service->GetComplexCallbackData(cnxn_id)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1398 |
+ NS_ASSERTION(map, "Can't find mapping for callback"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1399 |
+ if (!map) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1400 |
+ return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1401 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1402 |
+ map->callback(service, GetGConf()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1403 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1404 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1405 |
+nsresult nsSystemPrefService::LoadSystemPreferences(nsISystemPref* aPrefs) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1406 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1407 |
+ mPref = aPrefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1408 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1409 |
+ GConfClient* client = GetGConf(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1410 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1411 |
+ // Register simple mappings and callbacks |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1412 |
+ for (i = 0; i < NUM_ELEM(sSimplePrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1413 |
+ guint cx = gconf_client_notify_add(client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1414 |
+ sSimplePrefMappings[i].gconfPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1415 |
+ GConfSimpleNotification, this, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1416 |
+ nsnull, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1417 |
+ mGConfSimpleCallbacks.Put(cx, &sSimplePrefMappings[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1418 |
+ nsresult rv = ApplySimpleMapping(&sSimplePrefMappings[i], aPrefs, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1419 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1420 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1421 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1422 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1423 |
+ // Update Mozilla settings with any gconf settings that have |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1424 |
+ // changed from the default. Do it before we register our |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1425 |
+ // Mozilla notifications. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1426 |
+ ComplexGConfPrefChanged lastCallback = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1427 |
+ for (i = 0; i < NUM_ELEM(sComplexGConfPrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1428 |
+ guint cx = gconf_client_notify_add(client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1429 |
+ sComplexGConfPrefMappings[i].gconfPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1430 |
+ GConfComplexNotification, this, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1431 |
+ nsnull, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1432 |
+ mGConfComplexCallbacks.Put(cx, &sComplexGConfPrefMappings[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1433 |
+ ComplexGConfPrefChanged cb = sComplexGConfPrefMappings[i].callback; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1434 |
+ if (cb != lastCallback) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1435 |
+ cb(this, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1436 |
+ lastCallback = cb; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1437 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1438 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1439 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1440 |
+ nsCOMPtr<nsIPrefBranch2> userPrefs = aPrefs->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1441 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1442 |
+ // Update gconf settings with any Mozilla settings that have |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1443 |
+ // changed from the default. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1444 |
+ for (i = 0; i < NUM_ELEM(sSimplePrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1445 |
+ gconf_client_add_dir(client, sSimplePrefMappings[i].gconfPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1446 |
+ GCONF_CLIENT_PRELOAD_NONE, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1447 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1448 |
+ PRBool hasUserPref = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1449 |
+ nsresult rv = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1450 |
+ userPrefs->PrefHasUserValue(sSimplePrefMappings[i].mozPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1451 |
+ &hasUserPref); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1452 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1453 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1454 |
+ if (hasUserPref && sSimplePrefMappings[i].allowWritesFromMozilla) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1455 |
+ rv = ReverseApplySimpleMapping(&sSimplePrefMappings[i], |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1456 |
+ aPrefs, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1457 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1458 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1459 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1460 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1461 |
+ for (i = 0; i < NUM_ELEM(sComplexGConfPrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1462 |
+ gconf_client_add_dir(client, sComplexGConfPrefMappings[i].gconfPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1463 |
+ GCONF_CLIENT_PRELOAD_NONE, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1464 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1465 |
+ ComplexMozPrefChanged lastMozCallback = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1466 |
+ for (i = 0; i < NUM_ELEM(sComplexMozPrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1467 |
+ PRBool hasUserPref = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1468 |
+ nsresult rv = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1469 |
+ userPrefs->PrefHasUserValue(sComplexMozPrefMappings[i].mozPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1470 |
+ &hasUserPref); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1471 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1472 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1473 |
+ if (hasUserPref) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1474 |
+ ComplexMozPrefChanged cb = sComplexMozPrefMappings[i].callback; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1475 |
+ if (cb != lastMozCallback) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1476 |
+ cb(this, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1477 |
+ lastMozCallback = cb; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1478 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1479 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1480 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1481 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1482 |
+ ApplyUnsafeProtocols(this, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1483 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1484 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1485 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1486 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1487 |
+nsresult nsSystemPrefService::NotifyMozillaPrefChanged(const char* aPrefName) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1488 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1489 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1490 |
+ GConfClient* client = GetGConf(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1491 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1492 |
+ for (i = 0; i < NUM_ELEM(sSimplePrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1493 |
+ if (!strcmp(aPrefName, sSimplePrefMappings[i].mozPrefName)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1494 |
+ ReverseApplySimpleMapping(&sSimplePrefMappings[i], |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1495 |
+ mPref, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1496 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1497 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1498 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1499 |
+ for (i = 0; i < NUM_ELEM(sComplexMozPrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1500 |
+ if (!strcmp(aPrefName, sComplexMozPrefMappings[i].mozPrefName)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1501 |
+ sComplexMozPrefMappings[i].callback(this, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1502 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1503 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1504 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1505 |
+ for (i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1506 |
+ if (!strcmp(aPrefName, windowOpenFeatures[i])) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1507 |
+ ReverseApplyWindowOpen(this, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1508 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1509 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1510 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1511 |
+ ReverseApplyUnsafeProtocols(this, client); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1512 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1513 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1514 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1515 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1516 |
+static PLDHashOperator PR_CALLBACK UnregisterSimple(const PRUint32& aKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1517 |
+ SimplePrefMapping* aData, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1518 |
+ void* aClosure) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1519 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1520 |
+ GConfClient* client = GetGConf(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1521 |
+ gconf_client_notify_remove(client, aKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1522 |
+ gconf_client_remove_dir(client, aData->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1523 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1524 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1525 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1526 |
+static PLDHashOperator PR_CALLBACK UnregisterComplex(const PRUint32& aKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1527 |
+ ComplexGConfPrefMapping* aData, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1528 |
+ void* aClosure) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1529 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1530 |
+ GConfClient* client = GetGConf(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1531 |
+ gconf_client_notify_remove(client, aKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1532 |
+ gconf_client_remove_dir(client, aData->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1533 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1534 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1535 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1536 |
+nsresult nsSystemPrefService::NotifyUnloadSystemPreferences() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1537 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1538 |
+ // Unregister callbacks |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1539 |
+ mGConfSimpleCallbacks.EnumerateRead(UnregisterSimple, this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1540 |
+ mGConfSimpleCallbacks.Clear(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1541 |
+ mGConfComplexCallbacks.EnumerateRead(UnregisterComplex, this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1542 |
+ mGConfComplexCallbacks.Clear(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1543 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1544 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1545 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1546 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1547 |
+// PrefBranch interfaces |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1548 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1549 |
+GConfValue* nsSystemPrefService::GConfGet(const char *aPrefName) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1550 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1551 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1552 |
+ PRBool found = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1553 |
+ GConfValue *val = NULL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1554 |
+ GConfClient* client = GetGConf(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1555 |
+ NS_ASSERTION(client, "Could not get default GConf client"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1556 |
+ if (!client) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1557 |
+ return NULL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1558 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1559 |
+ for (i = 0; i < NUM_ELEM(sSimplePrefMappings); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1560 |
+ if (!strcmp(aPrefName, sSimplePrefMappings[i].mozPrefName)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1561 |
+ found = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1562 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1563 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1564 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1565 |
+ if (found) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1566 |
+ val = gconf_client_get(client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1567 |
+ sSimplePrefMappings[i].gconfPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1568 |
+ NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1569 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1570 |
+ return val; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1571 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1572 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1573 |
/* readonly attribute string root; */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1574 |
NS_IMETHODIMP nsSystemPrefService::GetRoot(char * *aRoot) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1575 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1576 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1577 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1578 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1579 |
/* long getPrefType (in string aPrefName); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1580 |
NS_IMETHODIMP nsSystemPrefService::GetPrefType(const char *aPrefName, PRInt32 *_retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1581 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1582 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1583 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1584 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1585 |
/* boolean getBoolPref (in string aPrefName); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1586 |
NS_IMETHODIMP nsSystemPrefService::GetBoolPref(const char *aPrefName, PRBool *_retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1587 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1588 |
- return mInitialized ? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1589 |
- mGConf->GetBoolPref(aPrefName, _retval) : NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1590 |
+ GConfValue *val = GConfGet(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1591 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1592 |
+ *_retval = (PRBool)(gconf_value_get_bool(val)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1593 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1594 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1595 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1596 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1597 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1598 |
/* void setBoolPref (in string aPrefName, in long aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1599 |
NS_IMETHODIMP nsSystemPrefService::SetBoolPref(const char *aPrefName, PRInt32 aValue) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1600 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1601 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1602 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1603 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1604 |
/* string getCharPref (in string aPrefName); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1605 |
NS_IMETHODIMP nsSystemPrefService::GetCharPref(const char *aPrefName, char **_retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1606 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1607 |
- return mInitialized ? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1608 |
- mGConf->GetCharPref(aPrefName, _retval) : NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1609 |
+ GConfValue *val = GConfGet(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1610 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1611 |
+ *_retval = (char*)(gconf_value_get_string(val)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1612 |
+ return *_retval ? NS_OK : NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1613 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1614 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1615 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1616 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1617 |
/* void setCharPref (in string aPrefName, in string aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1618 |
NS_IMETHODIMP nsSystemPrefService::SetCharPref(const char *aPrefName, const char *aValue) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1619 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1620 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1621 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1622 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1623 |
/* long getIntPref (in string aPrefName); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1624 |
NS_IMETHODIMP nsSystemPrefService::GetIntPref(const char *aPrefName, PRInt32 *_retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1625 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1626 |
- return mInitialized ? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1627 |
- mGConf->GetIntPref(aPrefName, _retval) : NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1628 |
+ GConfValue *val = GConfGet(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1629 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1630 |
+ *_retval = (PRInt32)(gconf_value_get_int(val)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1631 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1632 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1633 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1634 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1635 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1636 |
/* void setIntPref (in string aPrefName, in long aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1637 |
NS_IMETHODIMP nsSystemPrefService::SetIntPref(const char *aPrefName, PRInt32 aValue) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1638 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1639 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1640 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1641 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1642 |
-/* void getComplexValue (in string aPrefName, in nsIIDRef aType, [iid_is (aType), retval] out nsQIResult aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1643 |
+/* void getComplexValue (in string aPrefName, in nsIIDRef aType, [iid_is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1644 |
+ * (aType), retval] out nsQIResult aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1645 |
NS_IMETHODIMP nsSystemPrefService::GetComplexValue(const char *aPrefName, const nsIID & aType, void * *aValue) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1646 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1647 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1648 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1649 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1650 |
-/* void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1651 |
+/* void setComplexValue (in string aPrefName, in nsIIDRef aType, in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1652 |
+ * nsISupports aValue); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1653 |
NS_IMETHODIMP nsSystemPrefService::SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1654 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1655 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1656 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1657 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1658 |
/* void clearUserPref (in string aPrefName); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1659 |
NS_IMETHODIMP nsSystemPrefService::ClearUserPref(const char *aPrefName) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1660 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1661 |
@@ -360,557 +1363,36 @@ NS_IMETHODIMP nsSystemPrefService::Unloc |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1662 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1663 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1664 |
/* void deleteBranch (in string aStartingAt); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1665 |
NS_IMETHODIMP nsSystemPrefService::DeleteBranch(const char *aStartingAt) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1666 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1667 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1668 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1669 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1670 |
-/* void getChildList (in string aStartingAt, out unsigned long aCount, [array, size_is (aCount), retval] out string aChildArray); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1671 |
+/* void getChildList (in string aStartingAt, out unsigned long aCount, [array, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1672 |
+ * size_is (aCount), retval] out string aChildArray); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1673 |
NS_IMETHODIMP nsSystemPrefService::GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1674 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1675 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1676 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1677 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1678 |
/* void resetBranch (in string aStartingAt); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1679 |
NS_IMETHODIMP nsSystemPrefService::ResetBranch(const char *aStartingAt) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1680 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1681 |
return NS_ERROR_NOT_IMPLEMENTED; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1682 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1683 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1684 |
-/* void addObserver (in string aDomain, in nsIObserver aObserver, in boolean aHoldWeak); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1685 |
-NS_IMETHODIMP nsSystemPrefService::AddObserver(const char *aDomain, nsIObserver *aObserver, PRBool aHoldWeak) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1686 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1687 |
- nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1688 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1689 |
- NS_ENSURE_ARG_POINTER(aDomain); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1690 |
- NS_ENSURE_ARG_POINTER(aObserver); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1691 |
+// Factory stuff |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1692 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1693 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1694 |
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemPrefService, Init) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1695 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1696 |
- PRUint32 prefAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1697 |
- // make sure the pref name is supported |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1698 |
- rv = mGConf->GetAtomForMozKey(aDomain, &prefAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1699 |
- NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1700 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1701 |
- if (!mObservers) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1702 |
- mObservers = new nsAutoVoidArray(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1703 |
- if (mObservers == nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1704 |
- return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1705 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1706 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1707 |
- SysPrefCallbackData *pCallbackData = (SysPrefCallbackData *) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1708 |
- nsMemory::Alloc(sizeof(SysPrefCallbackData)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1709 |
- if (pCallbackData == nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1710 |
- return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1711 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1712 |
- pCallbackData->bIsWeakRef = aHoldWeak; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1713 |
- pCallbackData->prefAtom = prefAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1714 |
- // hold a weak reference to the observer if so requested |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1715 |
- nsCOMPtr<nsISupports> observerRef; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1716 |
- if (aHoldWeak) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1717 |
- nsCOMPtr<nsISupportsWeakReference> weakRefFactory = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1718 |
- do_QueryInterface(aObserver); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1719 |
- if (!weakRefFactory) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1720 |
- // the caller didn't give us a object that supports weak reference. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1721 |
- // ... tell them |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1722 |
- nsMemory::Free(pCallbackData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1723 |
- return NS_ERROR_INVALID_ARG; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1724 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1725 |
- nsCOMPtr<nsIWeakReference> tmp = do_GetWeakReference(weakRefFactory); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1726 |
- observerRef = tmp; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1727 |
- } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1728 |
- observerRef = aObserver; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1729 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1730 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1731 |
- rv = mGConf->NotifyAdd(prefAtom, pCallbackData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1732 |
- if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1733 |
- nsMemory::Free(pCallbackData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1734 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1735 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1736 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1737 |
- pCallbackData->observer = observerRef; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1738 |
- NS_ADDREF(pCallbackData->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1739 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1740 |
- mObservers->AppendElement(pCallbackData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1741 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1742 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1743 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1744 |
-/* void removeObserver (in string aDomain, in nsIObserver aObserver); */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1745 |
-NS_IMETHODIMP nsSystemPrefService::RemoveObserver(const char *aDomain, nsIObserver *aObserver) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1746 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1747 |
- nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1748 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1749 |
- NS_ENSURE_ARG_POINTER(aDomain); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1750 |
- NS_ENSURE_ARG_POINTER(aObserver); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1751 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1752 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1753 |
- if (!mObservers) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1754 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1755 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1756 |
- PRUint32 prefAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1757 |
- // make sure the pref name is supported |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1758 |
- rv = mGConf->GetAtomForMozKey(aDomain, &prefAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1759 |
- NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1760 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1761 |
- // need to find the index of observer, so we can remove it |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1762 |
- PRIntn count = mObservers->Count(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1763 |
- if (count <= 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1764 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1765 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1766 |
- PRIntn i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1767 |
- SysPrefCallbackData *pCallbackData; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1768 |
- for (i = 0; i < count; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1769 |
- pCallbackData = (SysPrefCallbackData *)mObservers->ElementAt(i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1770 |
- if (pCallbackData) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1771 |
- nsCOMPtr<nsISupports> observerRef; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1772 |
- if (pCallbackData->bIsWeakRef) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1773 |
- nsCOMPtr<nsISupportsWeakReference> weakRefFactory = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1774 |
- do_QueryInterface(aObserver); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1775 |
- if (weakRefFactory) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1776 |
- nsCOMPtr<nsIWeakReference> tmp = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1777 |
- do_GetWeakReference(aObserver); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1778 |
- observerRef = tmp; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1779 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1780 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1781 |
- if (!observerRef) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1782 |
- observerRef = aObserver; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1783 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1784 |
- if (pCallbackData->observer == observerRef && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1785 |
- pCallbackData->prefAtom == prefAtom) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1786 |
- rv = mGConf->NotifyRemove(prefAtom, pCallbackData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1787 |
- if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1788 |
- mObservers->RemoveElementAt(i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1789 |
- NS_RELEASE(pCallbackData->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1790 |
- nsMemory::Free(pCallbackData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1791 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1792 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1793 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1794 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1795 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1796 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1797 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1798 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1799 |
-void |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1800 |
-nsSystemPrefService::OnPrefChange(PRUint32 aPrefAtom, void *aData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1801 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1802 |
- if (!mInitialized) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1803 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1804 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1805 |
- SysPrefCallbackData *pData = (SysPrefCallbackData *)aData; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1806 |
- if (pData->prefAtom != aPrefAtom) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1807 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1808 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1809 |
- nsCOMPtr<nsIObserver> observer; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1810 |
- if (pData->bIsWeakRef) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1811 |
- nsCOMPtr<nsIWeakReference> weakRef = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1812 |
- do_QueryInterface(pData->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1813 |
- if(weakRef) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1814 |
- observer = do_QueryReferent(weakRef); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1815 |
- if (!observer) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1816 |
- // this weak referenced observer went away, remove it from the list |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1817 |
- nsresult rv = mGConf->NotifyRemove(aPrefAtom, pData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1818 |
- if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1819 |
- mObservers->RemoveElement(pData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1820 |
- NS_RELEASE(pData->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1821 |
- nsMemory::Free(pData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1822 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1823 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1824 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1825 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1826 |
- else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1827 |
- observer = do_QueryInterface(pData->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1828 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1829 |
- if (observer) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1830 |
- observer->Observe(static_cast<nsIPrefBranch *>(this), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1831 |
- NS_SYSTEMPREF_PREFCHANGE_TOPIC_ID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1832 |
- NS_ConvertUTF8toUTF16(mGConf->GetMozKey(aPrefAtom)). |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1833 |
- get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1834 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1835 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1836 |
-/************************************************************* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1837 |
- * GConfProxy |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1838 |
- * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1839 |
- ************************************************************/ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1840 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1841 |
-struct GConfFuncListType { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1842 |
- const char *FuncName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1843 |
- PRFuncPtr FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1844 |
+static const nsModuleComponentInfo components[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1845 |
+ { NS_SYSTEMPREF_SERVICE_CLASSNAME, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1846 |
+ NS_SYSTEMPREF_SERVICE_CID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1847 |
+ NS_SYSTEMPREF_SERVICE_CONTRACTID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1848 |
+ nsSystemPrefServiceConstructor, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1849 |
+ }, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1850 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1851 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1852 |
-struct PrefNamePair { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1853 |
- const char *mozPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1854 |
- const char *gconfPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1855 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1856 |
+NS_IMPL_NSGETMODULE(nsSystemPrefServiceModule, components) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1857 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1858 |
-const char |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1859 |
-GConfProxy::sPrefGConfKey[] = "accessibility.unix.gconf2.shared-library"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1860 |
-const char GConfProxy::sDefaultLibName1[] = "libgconf-2.so.4"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1861 |
-const char GConfProxy::sDefaultLibName2[] = "libgconf-2.so"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1862 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1863 |
-#define GCONF_FUNCS_POINTER_BEGIN \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1864 |
- static GConfFuncListType sGConfFuncList[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1865 |
-#define GCONF_FUNCS_POINTER_ADD(func_name) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1866 |
- {func_name, nsnull}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1867 |
-#define GCONF_FUNCS_POINTER_END \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1868 |
- {nsnull, nsnull}, }; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1869 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1870 |
-GCONF_FUNCS_POINTER_BEGIN |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1871 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_get_default") // 0 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1872 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_get_bool") // 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1873 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_get_string") //2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1874 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_get_int") //3 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1875 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_notify_add") //4 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1876 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_notify_remove") //5 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1877 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_add_dir") //6 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1878 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_remove_dir") //7 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1879 |
- GCONF_FUNCS_POINTER_ADD("gconf_entry_get_value") //8 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1880 |
- GCONF_FUNCS_POINTER_ADD("gconf_entry_get_key") //9 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1881 |
- GCONF_FUNCS_POINTER_ADD("gconf_value_get_bool") //10 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1882 |
- GCONF_FUNCS_POINTER_ADD("gconf_value_get_string") //11 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1883 |
- GCONF_FUNCS_POINTER_ADD("gconf_value_get_int") //12 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1884 |
- GCONF_FUNCS_POINTER_ADD("gconf_client_get_list") //13 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1885 |
-GCONF_FUNCS_POINTER_END |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1886 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1887 |
-///////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1888 |
-// the list is the mapping table, between mozilla prefs and gconf prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1889 |
-// It is expected to include all the pref pairs that are related in mozilla |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1890 |
-// and gconf. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1891 |
-// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1892 |
-// Note: the prefs listed here are not neccessarily be read from gconf, they |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1893 |
-// are the prefs that could be read from gconf. Mozilla has another |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1894 |
-// list (see sSysPrefList in nsSystemPref.cpp) that decide which prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1895 |
-// are really read. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1896 |
-////////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1897 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1898 |
-static const PrefNamePair sPrefNameMapping[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1899 |
-#include "gconf_pref_list.inc" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1900 |
- {nsnull, nsnull}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1901 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1902 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1903 |
-PRBool |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1904 |
-gconfDeleteObserver(void *aElement, void *aData) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1905 |
- nsMemory::Free(aElement); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1906 |
- return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1907 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1908 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1909 |
-GConfProxy::GConfProxy(nsSystemPrefService *aSysPrefService): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1910 |
- mGConfClient(nsnull), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1911 |
- mGConfLib(nsnull), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1912 |
- mInitialized(PR_FALSE), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1913 |
- mSysPrefService(aSysPrefService), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1914 |
- mObservers(nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1915 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1916 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1917 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1918 |
-GConfProxy::~GConfProxy() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1919 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1920 |
- if (mGConfClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1921 |
- g_object_unref(G_OBJECT(mGConfClient)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1922 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1923 |
- if (mObservers) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1924 |
- (void)mObservers->EnumerateForwards(gconfDeleteObserver, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1925 |
- delete mObservers; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1926 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1927 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1928 |
- // bug 379666: can't unload GConf-2 since it registers atexit handlers |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1929 |
- //PR_UnloadLibrary(mGConfLib); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1930 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1931 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1932 |
-PRBool |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1933 |
-GConfProxy::Init() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1934 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1935 |
- SYSPREF_LOG(("GConfProxy:: Init GConfProxy\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1936 |
- if (!mSysPrefService) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1937 |
- return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1938 |
- if (mInitialized) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1939 |
- return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1940 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1941 |
- nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1942 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1943 |
- if (!pref) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1944 |
- return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1945 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1946 |
- nsXPIDLCString gconfLibName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1947 |
- nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1948 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1949 |
- //check if gconf-2 library is given in prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1950 |
- rv = pref->GetCharPref(sPrefGConfKey, getter_Copies(gconfLibName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1951 |
- if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1952 |
- //use the library name in the preference |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1953 |
- SYSPREF_LOG(("GConf library in prefs is %s\n", gconfLibName.get())); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1954 |
- mGConfLib = PR_LoadLibrary(gconfLibName.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1955 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1956 |
- else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1957 |
- SYSPREF_LOG(("GConf library not specified in prefs, try the default: " |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1958 |
- "%s and %s\n", sDefaultLibName1, sDefaultLibName2)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1959 |
- mGConfLib = PR_LoadLibrary(sDefaultLibName1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1960 |
- if (!mGConfLib) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1961 |
- mGConfLib = PR_LoadLibrary(sDefaultLibName2); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1962 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1963 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1964 |
- if (!mGConfLib) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1965 |
- SYSPREF_LOG(("Fail to load GConf library\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1966 |
- return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1967 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1968 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1969 |
- //check every func we need in the gconf library |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1970 |
- GConfFuncListType *funcList; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1971 |
- PRFuncPtr func; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1972 |
- for (funcList = sGConfFuncList; funcList->FuncName; ++funcList) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1973 |
- func = PR_FindFunctionSymbol(mGConfLib, funcList->FuncName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1974 |
- if (!func) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1975 |
- SYSPREF_LOG(("Check GConf Func Error: %s", funcList->FuncName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1976 |
- goto init_failed_unload; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1977 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1978 |
- funcList->FuncPtr = func; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1979 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1980 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1981 |
- InitFuncPtrs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1982 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1983 |
- mGConfClient = GConfClientGetDefault(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1984 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1985 |
- // Don't unload past this point, since GConf's initialization of ORBit |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1986 |
- // causes atexit handlers to be registered. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1987 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1988 |
- if (!mGConfClient) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1989 |
- SYSPREF_LOG(("Fail to Get default gconf client\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1990 |
- goto init_failed; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1991 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1992 |
- mInitialized = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1993 |
- return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1994 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1995 |
- init_failed_unload: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1996 |
- PR_UnloadLibrary(mGConfLib); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1997 |
- init_failed: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1998 |
- mGConfLib = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1999 |
- return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2000 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2001 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2002 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2003 |
-GConfProxy::GetBoolPref(const char *aMozKey, PRBool *retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2004 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2005 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2006 |
- *retval = GConfClientGetBool(mGConfClient, MozKey2GConfKey(aMozKey), NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2007 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2008 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2009 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2010 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2011 |
-GConfProxy::GetCharPref(const char *aMozKey, char **retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2012 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2013 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2014 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2015 |
- const gchar *gconfkey = MozKey2GConfKey(aMozKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2016 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2017 |
- if (!strcmp (aMozKey, "network.proxy.no_proxies_on")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2018 |
- GSList *s; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2019 |
- nsCString noproxy; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2020 |
- GSList *gslist = GConfClientGetList(mGConfClient, gconfkey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2021 |
- GCONF_VALUE_STRING, NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2022 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2023 |
- for (s = gslist; s; s = g_slist_next(s)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2024 |
- noproxy += (char *)s->data; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2025 |
- noproxy += ", "; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2026 |
- g_free ((char *)s->data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2027 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2028 |
- g_slist_free (gslist); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2029 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2030 |
- *retval = PL_strdup(noproxy.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2031 |
- } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2032 |
- gchar *str = GConfClientGetString(mGConfClient, gconfkey, NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2033 |
- if (str) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2034 |
- *retval = PL_strdup(str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2035 |
- g_free (str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2036 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2037 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2038 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2039 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2040 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2041 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2042 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2043 |
-GConfProxy::GetIntPref(const char *aMozKey, PRInt32 *retval) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2044 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2045 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2046 |
- if (strcmp (aMozKey, "network.proxy.type") == 0) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2047 |
- gchar *str; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2048 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2049 |
- str = GConfClientGetString(mGConfClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2050 |
- MozKey2GConfKey (aMozKey), NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2051 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2052 |
- if (str) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2053 |
- if (strcmp (str, "manual") == 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2054 |
- *retval = 1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2055 |
- else if (strcmp (str, "auto") == 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2056 |
- *retval = 2; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2057 |
- else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2058 |
- *retval = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2059 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2060 |
- g_free (str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2061 |
- } else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2062 |
- *retval = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2063 |
- } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2064 |
- *retval = GConfClientGetInt(mGConfClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2065 |
- MozKey2GConfKey(aMozKey), NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2066 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2067 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2068 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2069 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2070 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2071 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2072 |
-GConfProxy::NotifyAdd (PRUint32 aAtom, void *aUserData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2073 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2074 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2075 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2076 |
- const char *gconfKey = GetGConfKey(aAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2077 |
- if (!gconfKey) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2078 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2079 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2080 |
- if (!mObservers) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2081 |
- mObservers = new nsAutoVoidArray(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2082 |
- if (mObservers == nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2083 |
- return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2084 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2085 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2086 |
- GConfCallbackData *pData = (GConfCallbackData *) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2087 |
- nsMemory::Alloc(sizeof(GConfCallbackData)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2088 |
- NS_ENSURE_TRUE(pData, NS_ERROR_OUT_OF_MEMORY); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2089 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2090 |
- pData->proxy = this; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2091 |
- pData->userData = aUserData; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2092 |
- pData->atom = aAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2093 |
- mObservers->AppendElement(pData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2094 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2095 |
- GConfClientAddDir(mGConfClient, gconfKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2096 |
- 0, // GCONF_CLIENT_PRELOAD_NONE, don't preload anything |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2097 |
- NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2098 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2099 |
- pData->notifyId = GConfClientNotifyAdd(mGConfClient, gconfKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2100 |
- gconf_key_listener, pData, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2101 |
- NULL, NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2102 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2103 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2104 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2105 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2106 |
-GConfProxy::NotifyRemove (PRUint32 aAtom, const void *aUserData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2107 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2108 |
- NS_ENSURE_TRUE(mInitialized, NS_ERROR_FAILURE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2109 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2110 |
- PRIntn count = mObservers->Count(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2111 |
- if (count <= 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2112 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2113 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2114 |
- PRIntn i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2115 |
- GConfCallbackData *pData; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2116 |
- for (i = 0; i < count; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2117 |
- pData = (GConfCallbackData *)mObservers->ElementAt(i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2118 |
- if (pData && pData->atom == aAtom && pData->userData == aUserData) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2119 |
- GConfClientNotifyRemove(mGConfClient, pData->notifyId); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2120 |
- GConfClientRemoveDir(mGConfClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2121 |
- GetGConfKey(pData->atom), NULL); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2122 |
- mObservers->RemoveElementAt(i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2123 |
- nsMemory::Free(pData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2124 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2125 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2126 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2127 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2128 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2129 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2130 |
-void |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2131 |
-GConfProxy::InitFuncPtrs() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2132 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2133 |
- //gconf client funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2134 |
- GConfClientGetDefault = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2135 |
- (GConfClientGetDefaultType) sGConfFuncList[0].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2136 |
- GConfClientGetBool = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2137 |
- (GConfClientGetBoolType) sGConfFuncList[1].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2138 |
- GConfClientGetString = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2139 |
- (GConfClientGetStringType) sGConfFuncList[2].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2140 |
- GConfClientGetInt = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2141 |
- (GConfClientGetIntType) sGConfFuncList[3].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2142 |
- GConfClientNotifyAdd = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2143 |
- (GConfClientNotifyAddType) sGConfFuncList[4].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2144 |
- GConfClientNotifyRemove = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2145 |
- (GConfClientNotifyRemoveType) sGConfFuncList[5].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2146 |
- GConfClientAddDir = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2147 |
- (GConfClientAddDirType) sGConfFuncList[6].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2148 |
- GConfClientRemoveDir = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2149 |
- (GConfClientRemoveDirType) sGConfFuncList[7].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2150 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2151 |
- //gconf entry funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2152 |
- GConfEntryGetValue = (GConfEntryGetValueType) sGConfFuncList[8].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2153 |
- GConfEntryGetKey = (GConfEntryGetKeyType) sGConfFuncList[9].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2154 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2155 |
- //gconf value funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2156 |
- GConfValueGetBool = (GConfValueGetBoolType) sGConfFuncList[10].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2157 |
- GConfValueGetString = (GConfValueGetStringType) sGConfFuncList[11].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2158 |
- GConfValueGetInt = (GConfValueGetIntType) sGConfFuncList[12].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2159 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2160 |
- //gconf client list func |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2161 |
- GConfClientGetList = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2162 |
- (GConfClientGetListType) sGConfFuncList[13].FuncPtr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2163 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2164 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2165 |
-void |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2166 |
-GConfProxy::OnNotify(void *aClient, void * aEntry, PRUint32 aNotifyId, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2167 |
- GConfCallbackData *aData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2168 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2169 |
- if (!mInitialized || !aEntry || (mGConfClient != aClient) || !aData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2170 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2171 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2172 |
- if (GConfEntryGetValue(aEntry) == NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2173 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2174 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2175 |
- PRUint32 prefAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2176 |
- nsresult rv = GetAtomForGConfKey(GConfEntryGetKey(aEntry), &prefAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2177 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2178 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2179 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2180 |
- mSysPrefService->OnPrefChange(prefAtom, aData->userData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2181 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2182 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2183 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2184 |
-GConfProxy::GetAtom(const char *aKey, PRUint8 aNameType, PRUint32 *aAtom) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2185 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2186 |
- if (!aKey) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2187 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2188 |
- PRUint32 prefSize = sizeof(sPrefNameMapping) / sizeof(sPrefNameMapping[0]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2189 |
- for (PRUint32 index = 0; index < prefSize; ++index) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2190 |
- if (!strcmp((aNameType == 0) ? sPrefNameMapping[index].mozPrefName : |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2191 |
- sPrefNameMapping[index].gconfPrefName, aKey)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2192 |
- *aAtom = index; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2193 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2194 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2195 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2196 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2197 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2198 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2199 |
-const char * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2200 |
-GConfProxy::GetKey(PRUint32 aAtom, PRUint8 aNameType) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2201 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2202 |
- PRUint32 mapSize = sizeof(sPrefNameMapping) / sizeof(sPrefNameMapping[0]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2203 |
- if (aAtom >= 0 && aAtom < mapSize) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2204 |
- return (aNameType == 0) ? sPrefNameMapping[aAtom].mozPrefName : |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2205 |
- sPrefNameMapping[aAtom].gconfPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2206 |
- return NULL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2207 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2208 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2209 |
-inline const char * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2210 |
-GConfProxy::MozKey2GConfKey(const char *aMozKey) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2211 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2212 |
- PRUint32 atom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2213 |
- nsresult rv = GetAtomForMozKey(aMozKey, &atom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2214 |
- if (NS_SUCCEEDED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2215 |
- return GetGConfKey(atom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2216 |
- return NULL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2217 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2218 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2219 |
-/* static */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2220 |
-void gconf_key_listener (void* client, guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2221 |
- void *entry, gpointer user_data) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2222 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2223 |
- SYSPREF_LOG(("...SYSPREF_LOG...key listener get called \n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2224 |
- if (!user_data) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2225 |
- return; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2226 |
- GConfCallbackData *pData = reinterpret_cast<GConfCallbackData *> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2227 |
- (user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2228 |
- pData->proxy->OnNotify(client, entry, cnxn_id, pData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2229 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2230 |
diff --git a/extensions/pref/system-pref/src/nsISystemPrefService.h b/extensions/pref/system-pref/src/nsISystemPrefService.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2231 |
new file mode 100644 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2232 |
--- /dev/null |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2233 |
+++ b/extensions/pref/system-pref/src/nsISystemPrefService.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2234 |
@@ -0,0 +1,107 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2235 |
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2236 |
+/* vim:expandtab:shiftwidth=4:tabstop=4: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2237 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2238 |
+/* ***** BEGIN LICENSE BLOCK ***** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2239 |
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2240 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2241 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2242 |
+ * The contents of this file are subject to the Mozilla Public |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2243 |
+ * License Version 1.1 (the "License"); you may not use this file |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2244 |
+ * except in compliance with the License. You may obtain a copy of |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2245 |
+ * the License at http://www.mozilla.org/MPL/ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2246 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2247 |
+ * Software distributed under the License is distributed on an "AS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2248 |
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2249 |
+ * implied. See the License for the specific language governing |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2250 |
+ * rights and limitations under the License. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2251 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2252 |
+ * The Original Code is mozilla.org code. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2253 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2254 |
+ * The Initial Developer of the Original Code is Novell |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2255 |
+ * Portions created by Novell are Copyright (C) 2005 Novell, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2256 |
+ * All Rights Reserved. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2257 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2258 |
+ * Original Author: Robert O'Callahan (rocallahan@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2259 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2260 |
+ * Contributor(s): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2261 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2262 |
+ * Alternatively, the contents of this file may be used under the terms of |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2263 |
+ * either the GNU General Public License Version 2 or later (the "GPL"), or |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2264 |
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2265 |
+ * in which case the provisions of the GPL or the LGPL are applicable instead |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2266 |
+ * of those above. If you wish to allow use of your version of this file only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2267 |
+ * under the terms of either the GPL or the LGPL, and not to allow others to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2268 |
+ * use your version of this file under the terms of the NPL, indicate your |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2269 |
+ * decision by deleting the provisions above and replace them with the notice |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2270 |
+ * and other provisions required by the GPL or the LGPL. If you do not delete |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2271 |
+ * the provisions above, a recipient may use your version of this file under |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2272 |
+ * the terms of any one of the NPL, the GPL or the LGPL. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2273 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2274 |
+ * ***** END LICENSE BLOCK ***** */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2275 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2276 |
+#ifndef nsISystemPrefService_h__ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2277 |
+#define nsISystemPrefService_h__ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2278 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2279 |
+#include "nsCOMPtr.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2280 |
+#include "nsIPrefBranchInternal.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2281 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2282 |
+#define NS_SYSTEMPREF_SERVICE_CONTRACTID "@mozilla.org/system-preference-service;1" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2283 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2284 |
+#define NS_ISYSTEMPREFSERVICE_IID \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2285 |
+{ 0x006e1cfd, 0xd66a, 0x40b9, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2286 |
+ { 0x84, 0xa1, 0x84, 0xf3, 0xe6, 0xa2, 0xca, 0xbc } } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2287 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2288 |
+class nsISystemPref { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2289 |
+public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2290 |
+ /** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2291 |
+ * Call one of these three methods to override a Mozilla |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2292 |
+ * preference with a system value. You can call it multiple |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2293 |
+ * times to change the value of a given preference to track |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2294 |
+ * the underlying system value. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2295 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2296 |
+ * If aLocked is true then we set the default preference and |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2297 |
+ * lock it so the user value is ignored. If aLocked is false |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2298 |
+ * then we unlock the Mozilla preference and set the Mozilla |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2299 |
+ * user value. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2300 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2301 |
+ virtual nsresult SetOverridingMozillaBoolPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2302 |
+ PRBool aValue, PRBool aLocked, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2303 |
+ PRBool aPresent = PR_TRUE) = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2304 |
+ virtual nsresult SetOverridingMozillaIntPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2305 |
+ PRInt32 aValue, PRBool aLocked, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2306 |
+ PRBool aPresent = PR_TRUE) = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2307 |
+ virtual nsresult SetOverridingMozillaStringPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2308 |
+ const char* aValue, PRBool aLocked, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2309 |
+ PRBool aPresent = PR_TRUE) = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2310 |
+ virtual nsresult StopOverridingMozillaPref(const char* aPrefName) = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2311 |
+ virtual already_AddRefed<nsIPrefBranch2> GetPrefUserBranch() = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2312 |
+ virtual already_AddRefed<nsIPrefBranch> GetPrefDefaultBranch() = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2313 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2314 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2315 |
+class nsISystemPrefService : public nsISupports { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2316 |
+public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2317 |
+ NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISYSTEMPREFSERVICE_IID) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2318 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2319 |
+ /** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2320 |
+ * Load the system prefs from the store into their corresponding |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2321 |
+ * Mozilla prefs, calling SetOverridingMozillaPref on each |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2322 |
+ * such pref. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2323 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2324 |
+ virtual nsresult LoadSystemPreferences(nsISystemPref* aPrefs) = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2325 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2326 |
+ /** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2327 |
+ * Notify that a Mozilla user pref that is being overridden by the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2328 |
+ * store has changed. The new value of the Mozilla pref should be |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2329 |
+ * written back to the store. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2330 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2331 |
+ virtual nsresult NotifyMozillaPrefChanged(const char* aPrefName) = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2332 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2333 |
+ /** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2334 |
+ * Notify that we're about to stop using the system prefs. After |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2335 |
+ * this, nsSystemPref will automatically stop overriding all |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2336 |
+ * Mozilla prefs that are being overridden. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2337 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2338 |
+ virtual nsresult NotifyUnloadSystemPreferences() = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2339 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2340 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2341 |
+#endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2342 |
diff --git a/extensions/pref/system-pref/src/nsSystemPref.cpp b/extensions/pref/system-pref/src/nsSystemPref.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2343 |
--- a/extensions/pref/system-pref/src/nsSystemPref.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2344 |
+++ b/extensions/pref/system-pref/src/nsSystemPref.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2345 |
@@ -19,16 +19,17 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2346 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2347 |
* The Initial Developer of the Original Code is Sun Microsystems, Inc. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2348 |
* Portions created by Sun Microsystems are Copyright (C) 2003 Sun |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2349 |
* Microsystems, Inc. All Rights Reserved. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2350 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2351 |
* Original Author: Bolian Yin (bolian.yin@sun.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2352 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2353 |
* Contributor(s): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2354 |
+ * Robert O'Callahan (rocallahan@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2355 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2356 |
* Alternatively, the contents of this file may be used under the terms of |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2357 |
* either the GNU General Public License Version 2 or later (the "GPL"), or |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2358 |
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2359 |
* in which case the provisions of the GPL or the LGPL are applicable instead |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2360 |
* of those above. If you wish to allow use of your version of this file only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2361 |
* under the terms of either the GPL or the LGPL, and not to allow others to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2362 |
* use your version of this file under the terms of the NPL, indicate your |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2363 |
@@ -36,76 +37,72 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2364 |
* and other provisions required by the GPL or the LGPL. If you do not delete |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2365 |
* the provisions above, a recipient may use your version of this file under |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2366 |
* the terms of any one of the NPL, the GPL or the LGPL. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2367 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2368 |
* ***** END LICENSE BLOCK ***** */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2369 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2370 |
#include "nsSystemPref.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2371 |
#include "nsIObserverService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2372 |
+#include "nsIAppStartupNotifier.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2373 |
+#include "nsIPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2374 |
+#include "nsIPrefBranch.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2375 |
+#include "nsICategoryManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2376 |
+#include "nsIServiceManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2377 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2378 |
#include "nsSystemPrefLog.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2379 |
-#include "nsSystemPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2380 |
#include "nsString.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2381 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2382 |
-const char sSysPrefString[] = "config.use_system_prefs"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2383 |
-union MozPrefValue { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2384 |
- char * stringVal; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2385 |
- PRInt32 intVal; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2386 |
- PRBool boolVal; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2387 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2388 |
+#include <stdlib.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2389 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2390 |
struct SysPrefItem { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2391 |
- const char *prefName; // mozilla pref string name |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2392 |
- MozPrefValue defaultValue; // store the mozilla default value |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2393 |
- PRBool isLocked; // store the mozilla lock status |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2394 |
+ // Saved values on both branches |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2395 |
+ PRInt32 savedUserValueScalar; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2396 |
+ char* savedUserValueString; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2397 |
+ PRInt32 savedDefaultValueScalar; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2398 |
+ char* savedDefaultValueString; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2399 |
+ // When this is true, then the value was locked originally |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2400 |
+ PRPackedBool savedLocked; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2401 |
+ // When this is true, then there was a user value |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2402 |
+ PRPackedBool savedUserPresent; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2403 |
+ PRPackedBool ignore; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2404 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2405 |
SysPrefItem() { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2406 |
- prefName = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2407 |
- defaultValue.intVal = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2408 |
- defaultValue.stringVal = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2409 |
- defaultValue.boolVal = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2410 |
- isLocked = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2411 |
+ savedUserValueScalar = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2412 |
+ savedUserValueString = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2413 |
+ savedDefaultValueScalar = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2414 |
+ savedDefaultValueString = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2415 |
+ savedUserPresent = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2416 |
+ savedLocked = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2417 |
+ ignore = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2418 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2419 |
- void SetPrefName(const char *aPrefName) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2420 |
- prefName = aPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2421 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2422 |
+ virtual ~SysPrefItem() { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2423 |
+ nsMemory::Free(savedUserValueString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2424 |
+ nsMemory::Free(savedDefaultValueString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2425 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2426 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2427 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2428 |
-// all prefs that mozilla need to read from host system if they are available |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2429 |
-static const char *sSysPrefList[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2430 |
- "network.proxy.http", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2431 |
- "network.proxy.http_port", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2432 |
- "network.proxy.ftp", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2433 |
- "network.proxy.ftp_port", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2434 |
- "network.proxy.ssl", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2435 |
- "network.proxy.ssl_port", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2436 |
- "network.proxy.socks", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2437 |
- "network.proxy.socks_port", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2438 |
- "network.proxy.no_proxies_on", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2439 |
- "network.proxy.autoconfig_url", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2440 |
- "network.proxy.type", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2441 |
- "config.use_system_prefs.accessibility", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2442 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2443 |
+NS_DEFINE_STATIC_IID_ACCESSOR(nsISystemPrefService, NS_ISYSTEMPREFSERVICE_IID) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2444 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2445 |
+static const char sSysPrefString[] = "config.use_system_prefs"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2446 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2447 |
PRLogModuleInfo *gSysPrefLog = NULL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2448 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2449 |
NS_IMPL_ISUPPORTS2(nsSystemPref, nsIObserver, nsISupportsWeakReference) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2450 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2451 |
-nsSystemPref::nsSystemPref(): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2452 |
- mSysPrefService(nsnull), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2453 |
- mEnabled(PR_FALSE), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2454 |
- mSysPrefs(nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2455 |
+nsSystemPref::nsSystemPref() : mIgnorePrefSetting(PR_FALSE) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2456 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2457 |
+ mSavedPrefs.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2458 |
+ mCachedUserPrefBranch = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2459 |
+ mCachedDefaultPrefBranch = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2460 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2461 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2462 |
nsSystemPref::~nsSystemPref() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2463 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2464 |
- mSysPrefService = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2465 |
- mEnabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2466 |
- delete [] mSysPrefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2467 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2468 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2469 |
/////////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2470 |
// nsSystemPref::Init |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2471 |
// Setup log and listen on NS_PREFSERVICE_READ_TOPIC_ID from pref service |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2472 |
/////////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2473 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2474 |
nsSystemPref::Init(void) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2475 |
@@ -126,349 +123,519 @@ nsSystemPref::Init(void) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2476 |
PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2477 |
rv = observerService->AddObserver(this, "profile-before-change", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2478 |
PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2479 |
SYSPREF_LOG(("Add Observer for %s\n", NS_PREFSERVICE_READ_TOPIC_ID)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2480 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2481 |
return(rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2482 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2483 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2484 |
+already_AddRefed<nsIPrefBranch2> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2485 |
+nsSystemPref::GetPrefUserBranch() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2486 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2487 |
+ if (mCachedUserPrefBranch) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2488 |
+ NS_ADDREF(mCachedUserPrefBranch); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2489 |
+ return mCachedUserPrefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2490 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2491 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2492 |
+ nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2493 |
+ nsCOMPtr<nsIPrefService> prefService = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2494 |
+ do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2495 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2496 |
+ return nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2497 |
+ nsCOMPtr<nsIPrefBranch> prefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2498 |
+ rv = prefService->GetBranch(nsnull, getter_AddRefs(prefBranch)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2499 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2500 |
+ return nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2501 |
+ nsCOMPtr<nsIPrefBranch2> pb2(do_QueryInterface(prefBranch)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2502 |
+ if (!pb2) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2503 |
+ return nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2504 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2505 |
+ nsIPrefBranch2* result = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2506 |
+ pb2.swap(result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2507 |
+ return result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2508 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2509 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2510 |
+already_AddRefed<nsIPrefBranch> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2511 |
+nsSystemPref::GetPrefDefaultBranch() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2512 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2513 |
+ if (mCachedDefaultPrefBranch) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2514 |
+ NS_ADDREF(mCachedDefaultPrefBranch); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2515 |
+ return mCachedDefaultPrefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2516 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2517 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2518 |
+ nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2519 |
+ nsCOMPtr<nsIPrefService> prefService = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2520 |
+ do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2521 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2522 |
+ return nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2523 |
+ nsCOMPtr<nsIPrefBranch> prefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2524 |
+ rv = prefService->GetDefaultBranch(nsnull, getter_AddRefs(prefBranch)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2525 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2526 |
+ return nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2527 |
+ nsIPrefBranch* pb = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2528 |
+ prefBranch.swap(pb); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2529 |
+ return pb; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2530 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2531 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2532 |
/////////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2533 |
// nsSystemPref::Observe |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2534 |
// Observe notifications from mozilla pref system and system prefs (if enabled) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2535 |
/////////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2536 |
NS_IMETHODIMP |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2537 |
nsSystemPref::Observe(nsISupports *aSubject, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2538 |
const char *aTopic, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2539 |
const PRUnichar *aData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2540 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2541 |
nsresult rv = NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2542 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2543 |
if (!aTopic) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2544 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2545 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2546 |
- // if we are notified by pref service |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2547 |
- // check the system pref settings |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2548 |
+ nsCOMPtr<nsIPrefBranch2> userBranch = GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2549 |
+ nsCOMPtr<nsIPrefBranch> defaultBranch = GetPrefDefaultBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2550 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2551 |
+ // Check the default branch first. If system prefs are enabled |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2552 |
+ // by default, then don't check the user prefs; we don't want |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2553 |
+ // to allow users to change the default. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2554 |
+ PRBool defaultEnabled; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2555 |
+ rv = defaultBranch->GetBoolPref(sSysPrefString, &defaultEnabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2556 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2557 |
+ SYSPREF_LOG(("...Failed to Get %s\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2558 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2559 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2560 |
+ PRBool enabled = defaultEnabled; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2561 |
+ if (!enabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2562 |
+ rv = userBranch->GetBoolPref(sSysPrefString, &enabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2563 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2564 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2565 |
+ SYSPREF_LOG(("...Failed to Get %s\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2566 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2567 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2568 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2569 |
if (!nsCRT::strcmp(aTopic, NS_PREFSERVICE_READ_TOPIC_ID)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2570 |
+ // The prefs have just loaded. This is the first thing that |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2571 |
+ // happens to us. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2572 |
SYSPREF_LOG(("Observed: %s\n", aTopic)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2573 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2574 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2575 |
- nsCOMPtr<nsIPrefBranch2> prefBranch = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2576 |
- do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2577 |
+ // listen on changes to use_system_pref. It's OK to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2578 |
+ // hold a strong reference because we don't keep a reference |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2579 |
+ // to the pref branch. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2580 |
+ rv = userBranch->AddObserver(sSysPrefString, this, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2581 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2582 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2583 |
+ SYSPREF_LOG(("...Failed to add observer for %s\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2584 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2585 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2586 |
+ NS_ASSERTION(!mSysPrefService, "Should not be already enabled"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2587 |
+ if (!enabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2588 |
+ // Don't load the system pref service if the preference is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2589 |
+ // not set. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2590 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2591 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2592 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2593 |
+ SYSPREF_LOG(("%s is enabled\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2594 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2595 |
+ rv = LoadSystemPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2596 |
if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2597 |
return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2598 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2599 |
- rv = prefBranch->GetBoolPref(sSysPrefString, &mEnabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2600 |
- if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2601 |
- SYSPREF_LOG(("...FAil to Get %s\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2602 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2603 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2604 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2605 |
- // if there is no system pref service, assume nothing happen to us |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2606 |
- mSysPrefService = do_GetService(NS_SYSTEMPREF_SERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2607 |
- if (NS_FAILED(rv) || !mSysPrefService) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2608 |
- SYSPREF_LOG(("...No System Pref Service\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2609 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2610 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2611 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2612 |
- // listen on its changes |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2613 |
- rv = prefBranch->AddObserver(sSysPrefString, this, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2614 |
- if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2615 |
- SYSPREF_LOG(("...FAil to add observer for %s\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2616 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2617 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2618 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2619 |
- if (!mEnabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2620 |
- SYSPREF_LOG(("%s is disabled\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2621 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2622 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2623 |
- SYSPREF_LOG(("%s is enabled\n", sSysPrefString)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2624 |
- rv = UseSystemPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2625 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2626 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2627 |
- // sSysPrefString value was changed, update ... |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2628 |
- else if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2629 |
- NS_ConvertUTF8toUTF16(sSysPrefString).Equals(aData)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2630 |
- SYSPREF_LOG(("++++++ Notify: topic=%s data=%s\n", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2631 |
- aTopic, NS_ConvertUTF16toUTF8(aData).get())); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2632 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2633 |
- nsCOMPtr<nsIPrefBranch> prefBranch = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2634 |
- do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2635 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2636 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2637 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2638 |
- PRBool enabled = mEnabled; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2639 |
- rv = prefBranch->GetBoolPref(sSysPrefString, &mEnabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2640 |
- if (enabled != mEnabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2641 |
- if (mEnabled) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2642 |
- //read prefs from system |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2643 |
- rv = UseSystemPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2644 |
- else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2645 |
- //roll back to mozilla prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2646 |
- rv = UseMozillaPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2647 |
+ // Lock config.use_system_prefs so the user can't undo |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2648 |
+ // it. But only do this if it was set by in the default prefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2649 |
+ // if it was not set by default, then locking it would actually |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2650 |
+ // unset the value! And the user should be allowed to turn off |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2651 |
+ // something they set themselves. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2652 |
+ if (NS_SUCCEEDED(rv) && defaultEnabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2653 |
+ userBranch->LockPref(sSysPrefString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2654 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2655 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2656 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2657 |
- // if the system pref notify us that some pref has been changed by user |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2658 |
- // outside mozilla. We need to read it again. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2659 |
- else if (!nsCRT::strcmp(aTopic, NS_SYSTEMPREF_PREFCHANGE_TOPIC_ID) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2660 |
- aData) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2661 |
- NS_ASSERTION(mEnabled == PR_TRUE, "Should not listen when disabled"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2662 |
- SYSPREF_LOG(("====== System Pref Notify topic=%s data=%s\n", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2663 |
- aTopic, (char*)aData)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2664 |
- rv = ReadSystemPref(NS_LossyConvertUTF16toASCII(aData).get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2665 |
+ if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2666 |
+ nsDependentString(aData).EqualsASCII(sSysPrefString)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2667 |
+ // sSysPrefString value was changed, update... |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2668 |
+ SYSPREF_LOG(("++++++ Notify: topic=%s data=%s\n", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2669 |
+ aTopic, NS_ConvertUTF16toUTF8(aData).get())); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2670 |
+ if (mSysPrefService && !enabled) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2671 |
+ return RestoreMozillaPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2672 |
+ if (!mSysPrefService && enabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2673 |
+ // Don't lock it. If the user enabled use_system_prefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2674 |
+ // they should be allowed to unlock it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2675 |
+ return LoadSystemPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2676 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2677 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2678 |
+ // didn't change? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2679 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2680 |
- } else if (!nsCRT::strcmp(aTopic,"profile-before-change")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2681 |
- //roll back to mozilla prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2682 |
- if (mEnabled) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2683 |
- UseMozillaPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2684 |
- mEnabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2685 |
- mSysPrefService = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2686 |
- delete [] mSysPrefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2687 |
- mSysPrefs = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2688 |
- } else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2689 |
- SYSPREF_LOG(("Not needed topic Received %s\n", aTopic)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2690 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2691 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2692 |
+ if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2693 |
+ // some other pref changed, tell the backend if there is one |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2694 |
+ if (mSysPrefService && !mIgnorePrefSetting) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2695 |
+ NS_LossyConvertUTF16toASCII tmp(aData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2696 |
+#ifdef DEBUG |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2697 |
+ PRBool isLocked; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2698 |
+ userBranch->PrefIsLocked(tmp.get(), &isLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2699 |
+ NS_ASSERTION(!isLocked, "Locked pref is changing?"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2700 |
+#endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2701 |
+ SysPrefItem* item; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2702 |
+ if (!mSavedPrefs.Get(tmp, &item)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2703 |
+ NS_ERROR("Notified about pref change that we didn't ask about?"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2704 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2705 |
+ if (!item->ignore) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2706 |
+ mSysPrefService->NotifyMozillaPrefChanged(tmp.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2707 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2708 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2709 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2710 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2711 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2712 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2713 |
+ if (!nsCRT::strcmp(aTopic,"profile-before-change")) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2714 |
+ return RestoreMozillaPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2715 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2716 |
+ SYSPREF_LOG(("Not needed topic Received %s\n", aTopic)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2717 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2718 |
return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2719 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2720 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2721 |
-/* private */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2722 |
+nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2723 |
+nsSystemPref::SetOverridingMozillaBoolPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2724 |
+ PRBool aValue, PRBool aLock, PRBool aPresent) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2725 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2726 |
+ return OverridePref(aPrefName, nsIPrefBranch::PREF_BOOL, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2727 |
+ (void*)aValue, aLock, aPresent); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2728 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2729 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2730 |
-//////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2731 |
-// nsSystemPref::UseSystemPrefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2732 |
-// Read all the prefs in the table from system, listen for their |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2733 |
-// changes in system pref service. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2734 |
-//////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2735 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2736 |
-nsSystemPref::UseSystemPrefs() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2737 |
+nsSystemPref::SetOverridingMozillaIntPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2738 |
+ PRInt32 aValue, PRBool aLock, PRBool aPresent) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2739 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2740 |
- SYSPREF_LOG(("\n====Now Use system prefs==\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2741 |
- nsresult rv = NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2742 |
- if (!mSysPrefService) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2743 |
+ return OverridePref(aPrefName, nsIPrefBranch::PREF_INT, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2744 |
+ (void*)aValue, aLock, aPresent); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2745 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2746 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2747 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2748 |
+nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2749 |
+nsSystemPref::SetOverridingMozillaStringPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2750 |
+ const char* aValue, PRBool aLock, PRBool aPresent) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2751 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2752 |
+ return OverridePref(aPrefName, nsIPrefBranch::PREF_STRING, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2753 |
+ (void*)aValue, aLock, aPresent); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2754 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2755 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2756 |
+static nsresult RestorePrefValue(PRInt32 aPrefType, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2757 |
+ const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2758 |
+ SysPrefItem* aItem, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2759 |
+ nsIPrefBranch* aUser, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2760 |
+ nsIPrefBranch* aDefault) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2761 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2762 |
+ switch (aPrefType) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2763 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2764 |
+ case nsIPrefBranch::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2765 |
+ aDefault->SetCharPref(aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2766 |
+ aItem->savedDefaultValueString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2767 |
+ if (aItem->savedUserPresent) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2768 |
+ aUser->SetCharPref(aPrefName, aItem->savedUserValueString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2769 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2770 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2771 |
+ case nsIPrefBranch::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2772 |
+ aDefault->SetBoolPref(aPrefName, aItem->savedDefaultValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2773 |
+ if (aItem->savedUserPresent) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2774 |
+ aUser->SetBoolPref(aPrefName, aItem->savedUserValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2775 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2776 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2777 |
+ case nsIPrefBranch::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2778 |
+ aDefault->SetBoolPref(aPrefName, aItem->savedDefaultValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2779 |
+ if (aItem->savedUserPresent) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2780 |
+ aUser->SetBoolPref(aPrefName, aItem->savedUserValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2781 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2782 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2783 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2784 |
+ NS_ERROR("Unknown preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2785 |
return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2786 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2787 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2788 |
- PRIntn sysPrefCount= sizeof(sSysPrefList) / sizeof(sSysPrefList[0]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2789 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2790 |
- if (!mSysPrefs) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2791 |
- mSysPrefs = new SysPrefItem[sysPrefCount]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2792 |
- if (!mSysPrefs) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2793 |
- return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2794 |
- for (PRIntn index = 0; index < sysPrefCount; ++index) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2795 |
- mSysPrefs[index].SetPrefName(sSysPrefList[index]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2796 |
+ if (!aItem->savedUserPresent) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2797 |
+ aUser->DeleteBranch(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2798 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2799 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2800 |
- for (PRIntn index = 0; index < sysPrefCount; ++index) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2801 |
- // save mozilla prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2802 |
- SaveMozDefaultPref(mSysPrefs[index].prefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2803 |
- &mSysPrefs[index].defaultValue, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2804 |
- &mSysPrefs[index].isLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2805 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2806 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2807 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2808 |
- // get the system prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2809 |
- ReadSystemPref(mSysPrefs[index].prefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2810 |
- SYSPREF_LOG(("Add Listener on %s\n", mSysPrefs[index].prefName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2811 |
- mSysPrefService->AddObserver(mSysPrefs[index].prefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2812 |
- this, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2813 |
+static PLDHashOperator PR_CALLBACK RestorePref(const nsACString& aKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2814 |
+ SysPrefItem* aItem, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2815 |
+ void* aClosure) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2816 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2817 |
+ nsSystemPref* prefs = static_cast<nsSystemPref*>(aClosure); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2818 |
+ nsCOMPtr<nsIPrefBranch2> userBranch = prefs->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2819 |
+ const nsCString& prefName = PromiseFlatCString(aKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2820 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2821 |
+ PRInt32 prefType = nsIPrefBranch::PREF_INVALID; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2822 |
+ nsresult rv = userBranch->GetPrefType(prefName.get(), &prefType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2823 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2824 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2825 |
+ PRBool isLocked; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2826 |
+ userBranch->PrefIsLocked(prefName.get(), &isLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2827 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2828 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2829 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2830 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2831 |
+ // Remove our observer before we change the value |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2832 |
+ userBranch->RemoveObserver(prefName.get(), prefs); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2833 |
+ // Remember to ignore this item. Because some prefs start with "config.use_system_prefs", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2834 |
+ // which we always observe, even after we remove the observer, changes to the pref will |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2835 |
+ // still be observed by us. We must ignore them. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2836 |
+ aItem->ignore = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2837 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2838 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2839 |
+ // Unlock the pref so we can set it |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2840 |
+ if (isLocked) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2841 |
+ userBranch->UnlockPref(prefName.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2842 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2843 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2844 |
+ nsCOMPtr<nsIPrefBranch> defaultBranch = prefs->GetPrefDefaultBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2845 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2846 |
+ RestorePrefValue(prefType, prefName.get(), aItem, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2847 |
+ userBranch, defaultBranch); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2848 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2849 |
+ if (aItem->savedLocked) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2850 |
+ userBranch->LockPref(prefName.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2851 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2852 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2853 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2854 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2855 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2856 |
+nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2857 |
+nsSystemPref::StopOverridingMozillaPref(const char* aPrefName) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2858 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2859 |
+ SysPrefItem* item; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2860 |
+ nsDependentCString prefNameStr(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2861 |
+ if (!mSavedPrefs.Get(prefNameStr, &item)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2862 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2863 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2864 |
+ RestorePref(prefNameStr, item, this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2865 |
+ mSavedPrefs.Remove(prefNameStr); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2866 |
+ delete item; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2867 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2868 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2869 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2870 |
+/* private */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2871 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2872 |
+nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2873 |
+nsSystemPref::OverridePref(const char* aPrefName, PRInt32 aType, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2874 |
+ void* aValue, PRBool aLock, PRBool aPresent) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2875 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2876 |
+ nsCOMPtr<nsIPrefBranch2> userBranch = GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2877 |
+ nsCOMPtr<nsIPrefBranch> defaultBranch = GetPrefDefaultBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2878 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2879 |
+ PRInt32 prefType = nsIPrefBranch::PREF_INVALID; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2880 |
+ nsresult rv = userBranch->GetPrefType(aPrefName, &prefType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2881 |
+ PRBool isLocked; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2882 |
+ rv = userBranch->PrefIsLocked(aPrefName, &isLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2883 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2884 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2885 |
+ PRBool hasUserValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2886 |
+ rv = userBranch->PrefHasUserValue(aPrefName, &hasUserValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2887 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2888 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2889 |
+ if (prefType == 0) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2890 |
+ // Preference does not exist. Allow the system prefs to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2891 |
+ // set it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2892 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2893 |
+ NS_ASSERTION(aType == prefType, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2894 |
+ "System pref engine passed incorrect type for Mozilla pref"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2895 |
+ if (aType != prefType) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2896 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2897 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2898 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2899 |
+ if (prefType != 0) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2900 |
+ nsDependentCString prefNameStr(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2901 |
+ SysPrefItem* item = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2902 |
+ if (!mSavedPrefs.Get(prefNameStr, &item)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2903 |
+ // Need to save the existing value away |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2904 |
+ item = new SysPrefItem(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2905 |
+ if (!item) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2906 |
+ return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2907 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2908 |
+ item->savedLocked = isLocked; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2909 |
+ item->savedUserPresent = hasUserValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2910 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2911 |
+ switch (prefType) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2912 |
+ case nsIPrefBranch::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2913 |
+ if (hasUserValue) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2914 |
+ userBranch->GetCharPref(aPrefName, &item->savedUserValueString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2915 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2916 |
+ defaultBranch->GetCharPref(aPrefName, &item->savedDefaultValueString); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2917 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2918 |
+ case nsIPrefBranch::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2919 |
+ if (hasUserValue) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2920 |
+ userBranch->GetIntPref(aPrefName, &item->savedUserValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2921 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2922 |
+ defaultBranch->GetIntPref(aPrefName, &item->savedDefaultValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2923 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2924 |
+ case nsIPrefBranch::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2925 |
+ if (hasUserValue) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2926 |
+ userBranch->GetBoolPref(aPrefName, &item->savedUserValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2927 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2928 |
+ defaultBranch->GetBoolPref(aPrefName, &item->savedDefaultValueScalar); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2929 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2930 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2931 |
+ NS_ERROR("Unknown preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2932 |
+ delete item; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2933 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2934 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2935 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2936 |
+ mSavedPrefs.Put(prefNameStr, item); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2937 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2938 |
+ // Watch the user value in case it changes on the Mozilla side |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2939 |
+ // If 'aLock' is true then it shouldn't change and we don't |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2940 |
+ // need the observer, but don't bother optimizing for that. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2941 |
+ userBranch->AddObserver(aPrefName, this, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2942 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2943 |
+ if (isLocked != aLock) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2944 |
+ // restore pref value on user and default branches |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2945 |
+ RestorePrefValue(prefType, aPrefName, item, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2946 |
+ userBranch, defaultBranch); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2947 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2948 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2949 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2950 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2951 |
+ // We need to ignore pref changes due to our own calls here |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2952 |
+ mIgnorePrefSetting = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2953 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2954 |
+ // Unlock it if it's locked, so we can set it |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2955 |
+ if (isLocked) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2956 |
+ rv = userBranch->UnlockPref(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2957 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2958 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2959 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2960 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2961 |
+ // Set the pref on the default branch if we're locking it, because |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2962 |
+ // only the default branch gets used when the pref is locked. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2963 |
+ // Set the pref on the user branch if we're not locking it, because |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2964 |
+ // that's where the user change will go. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2965 |
+ nsIPrefBranch* settingBranch = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2966 |
+ aLock ? defaultBranch.get() : static_cast<nsIPrefBranch*>(userBranch.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2967 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2968 |
+ if (!aPresent) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2969 |
+ rv = settingBranch->DeleteBranch(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2970 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2971 |
+ switch (aType) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2972 |
+ case nsIPrefBranch::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2973 |
+ rv = settingBranch->SetCharPref(aPrefName, (const char*)aValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2974 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2975 |
+ case nsIPrefBranch::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2976 |
+ rv = settingBranch->SetIntPref(aPrefName, (PRInt32)(NS_PTR_TO_INT32(aValue))); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2977 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2978 |
+ case nsIPrefBranch::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2979 |
+ rv = settingBranch->SetBoolPref(aPrefName, (PRBool)(NS_PTR_TO_INT32(aValue))); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2980 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2981 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2982 |
+ NS_ERROR("Unknown preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2983 |
+ mIgnorePrefSetting = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2984 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2985 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2986 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2987 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2988 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2989 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2990 |
+ if (aLock) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2991 |
+ rv = userBranch->LockPref(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2992 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2993 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2994 |
+ mIgnorePrefSetting = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2995 |
return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2996 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2997 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2998 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2999 |
-// nsSystemPref::ReadSystemPref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3000 |
-// Read a pref value from system pref service, and lock it in mozilla. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3001 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3002 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3003 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3004 |
-nsSystemPref::ReadSystemPref(const char *aPrefName) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3005 |
+nsSystemPref::FixupLockdownPrefs() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3006 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3007 |
- if (!mSysPrefService) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3008 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3009 |
- nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3010 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3011 |
- nsCOMPtr<nsIPrefBranch> prefBranch |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3012 |
- (do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3013 |
+ nsCOMPtr<nsIPrefBranch2> userPrefs = GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3014 |
+ nsCOMPtr<nsIPrefBranch2> defaultPrefs = GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3015 |
+ PRUint32 childCount; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3016 |
+ char **childArray = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3017 |
+ nsresult rv = userPrefs->GetChildList("config.lockdown.", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3018 |
+ &childCount, &childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3019 |
if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3020 |
return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3021 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3022 |
- SYSPREF_LOG(("about to read aPrefName %s\n", aPrefName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3023 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3024 |
- prefBranch->UnlockPref(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3025 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3026 |
- PRInt32 prefType = nsIPrefBranch::PREF_INVALID; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3027 |
- nsXPIDLCString strValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3028 |
- PRInt32 intValue = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3029 |
- PRBool boolValue = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3030 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3031 |
- rv = prefBranch->GetPrefType(aPrefName, &prefType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3032 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3033 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3034 |
- switch (prefType) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3035 |
- case nsIPrefBranch::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3036 |
- mSysPrefService->GetCharPref(aPrefName, getter_Copies(strValue)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3037 |
- SYSPREF_LOG(("system value is %s\n", strValue.get())); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3038 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3039 |
- prefBranch->SetCharPref(aPrefName, strValue.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3040 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3041 |
- case nsIPrefBranch::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3042 |
- mSysPrefService->GetIntPref(aPrefName, &intValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3043 |
- SYSPREF_LOG(("system value is %d\n", intValue)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3044 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3045 |
- prefBranch->SetIntPref(aPrefName, intValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3046 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3047 |
- case nsIPrefBranch::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3048 |
- mSysPrefService->GetBoolPref(aPrefName, &boolValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3049 |
- SYSPREF_LOG(("system value is %s\n", boolValue ? "TRUE" : "FALSE")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3050 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3051 |
- prefBranch->SetBoolPref(aPrefName, boolValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3052 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3053 |
- default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3054 |
- SYSPREF_LOG(("Fail to system value for it\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3055 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3056 |
+ for (PRUint32 i = 0; i < childCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3057 |
+ PRInt32 type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3058 |
+ rv = defaultPrefs->GetPrefType(childArray[i], &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3059 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3060 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3061 |
+ NS_ASSERTION(type == nsIPrefBranch2::PREF_BOOL, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3062 |
+ "All config.lockdown.* prefs should be boolean"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3063 |
+ if (type == nsIPrefBranch2::PREF_BOOL) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3064 |
+ rv = defaultPrefs->SetBoolPref(childArray[i], PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3065 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3066 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3067 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3068 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3069 |
- prefBranch->LockPref(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3070 |
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3071 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3072 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3073 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3074 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3075 |
-// nsSystemPref::UseMozillaPrefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3076 |
-// Restore mozilla default prefs, remove system pref listeners |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3077 |
-///////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3078 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3079 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3080 |
-nsSystemPref::UseMozillaPrefs() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3081 |
+nsSystemPref::LoadSystemPrefs() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3082 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3083 |
- nsresult rv = NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3084 |
- SYSPREF_LOG(("\n====Now rollback to Mozilla prefs==\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3085 |
+ SYSPREF_LOG(("\n====Now Use system prefs==\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3086 |
+ NS_ASSERTION(!mSysPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3087 |
+ "Shouldn't have the pref service here"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3088 |
+ nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3089 |
+ mSysPrefService = do_GetService(NS_SYSTEMPREF_SERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3090 |
+ if (NS_FAILED(rv) || !mSysPrefService) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3091 |
+ FixupLockdownPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3092 |
+ SYSPREF_LOG(("...No System Pref Service\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3093 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3094 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3095 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3096 |
- // if we did not use system prefs, do nothing |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3097 |
- if (!mSysPrefService) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3098 |
- return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3099 |
+ // Cache the pref-branch while we load up the system prefs. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3100 |
+ NS_ASSERTION(!mCachedUserPrefBranch, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3101 |
+ "Shouldn't have a cache here"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3102 |
+ nsCOMPtr<nsIPrefBranch2> userBranch = GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3103 |
+ nsCOMPtr<nsIPrefBranch> defaultBranch = GetPrefDefaultBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3104 |
+ mCachedDefaultPrefBranch = defaultBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3105 |
+ mCachedUserPrefBranch = userBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3106 |
+ rv = mSysPrefService->LoadSystemPreferences(this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3107 |
+ mCachedDefaultPrefBranch = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3108 |
+ mCachedUserPrefBranch = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3109 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3110 |
- PRIntn sysPrefCount= sizeof(sSysPrefList) / sizeof(sSysPrefList[0]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3111 |
- for (PRIntn index = 0; index < sysPrefCount; ++index) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3112 |
- // restore mozilla default value and free string memory if needed |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3113 |
- RestoreMozDefaultPref(mSysPrefs[index].prefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3114 |
- &mSysPrefs[index].defaultValue, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3115 |
- mSysPrefs[index].isLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3116 |
- SYSPREF_LOG(("stop listening on %s\n", mSysPrefs[index].prefName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3117 |
- mSysPrefService->RemoveObserver(mSysPrefs[index].prefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3118 |
- this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3119 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3120 |
+ // Restore all modified preferences to their original values |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3121 |
+ mSavedPrefs.EnumerateRead(RestorePref, this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3122 |
+ mSavedPrefs.Clear(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3123 |
+ mSysPrefService = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3124 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3125 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3126 |
return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3127 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3128 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3129 |
-//////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3130 |
-// nsSystemPref::RestoreMozDefaultPref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3131 |
-// Save the saved mozilla default value. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3132 |
-// It is also responsible for allocate the string memory when needed, because |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3133 |
-// this method know what type of value is stored. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3134 |
-///////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3135 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3136 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3137 |
-nsSystemPref::SaveMozDefaultPref(const char *aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3138 |
- MozPrefValue *aPrefValue, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3139 |
- PRBool *aLocked) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3140 |
+nsSystemPref::RestoreMozillaPrefs() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3141 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3142 |
- NS_ENSURE_ARG_POINTER(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3143 |
- NS_ENSURE_ARG_POINTER(aPrefValue); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3144 |
- NS_ENSURE_ARG_POINTER(aLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3145 |
+ SYSPREF_LOG(("\n====Now rollback to Mozilla prefs==\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3146 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3147 |
- nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3148 |
+ NS_ASSERTION(mSysPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3149 |
+ "Should have the pref service here"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3150 |
+ if (!mSysPrefService) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3151 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3152 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3153 |
- nsCOMPtr<nsIPrefBranch> prefBranch = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3154 |
- do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3155 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3156 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3157 |
+ nsCOMPtr<nsIPrefBranch2> userBranch = GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3158 |
+ nsCOMPtr<nsIPrefBranch> defaultBranch = GetPrefDefaultBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3159 |
+ mCachedDefaultPrefBranch = defaultBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3160 |
+ mCachedUserPrefBranch = userBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3161 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3162 |
- SYSPREF_LOG(("Save Mozilla value for %s\n", aPrefName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3163 |
+ mSysPrefService->NotifyUnloadSystemPreferences(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3164 |
+ // Restore all modified preferences to their original values |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3165 |
+ mSavedPrefs.EnumerateRead(RestorePref, this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3166 |
+ mSavedPrefs.Clear(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3167 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3168 |
- PRInt32 prefType = nsIPrefBranch::PREF_INVALID; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3169 |
- nsXPIDLCString strValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3170 |
+ mCachedDefaultPrefBranch = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3171 |
+ mCachedUserPrefBranch = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3172 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3173 |
+ mSysPrefService = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3174 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3175 |
- rv = prefBranch->GetPrefType(aPrefName, &prefType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3176 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3177 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3178 |
- switch (prefType) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3179 |
- case nsIPrefBranch::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3180 |
- prefBranch->GetCharPref(aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3181 |
- getter_Copies(strValue)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3182 |
- SYSPREF_LOG(("Mozilla value is %s", strValue.get())); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3183 |
+ FixupLockdownPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3184 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3185 |
- if (aPrefValue->stringVal) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3186 |
- PL_strfree(aPrefValue->stringVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3187 |
- aPrefValue->stringVal = PL_strdup(strValue.get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3188 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3189 |
- case nsIPrefBranch::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3190 |
- prefBranch->GetIntPref(aPrefName, &aPrefValue->intVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3191 |
- SYSPREF_LOG(("Mozilla value is %d\n", aPrefValue->intVal)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3192 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3193 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3194 |
- case nsIPrefBranch::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3195 |
- prefBranch->GetBoolPref(aPrefName, &aPrefValue->boolVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3196 |
- SYSPREF_LOG(("Mozilla value is %s\n", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3197 |
- aPrefValue->boolVal ? "TRUE" : "FALSE")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3198 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3199 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3200 |
- default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3201 |
- SYSPREF_LOG(("Fail to Read Mozilla value for it\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3202 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3203 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3204 |
- rv = prefBranch->PrefIsLocked(aPrefName, aLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3205 |
- SYSPREF_LOG((" (%s).\n", aLocked ? "Locked" : "NOT Locked")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3206 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3207 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3208 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3209 |
-//////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3210 |
-// nsSystemPref::RestoreMozDefaultPref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3211 |
-// Restore the saved mozilla default value to pref service. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3212 |
-// It is also responsible for free the string memory when needed, because |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3213 |
-// this method know what type of value is stored. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3214 |
-///////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3215 |
-nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3216 |
-nsSystemPref::RestoreMozDefaultPref(const char *aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3217 |
- MozPrefValue *aPrefValue, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3218 |
- PRBool aLocked) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3219 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3220 |
- NS_ENSURE_ARG_POINTER(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3221 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3222 |
- nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3223 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3224 |
- nsCOMPtr<nsIPrefBranch> prefBranch = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3225 |
- do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3226 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3227 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3228 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3229 |
- SYSPREF_LOG(("Restore Mozilla value for %s\n", aPrefName)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3230 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3231 |
- PRInt32 prefType = nsIPrefBranch::PREF_INVALID; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3232 |
- rv = prefBranch->GetPrefType(aPrefName, &prefType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3233 |
- if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3234 |
- return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3235 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3236 |
- // unlock, if it is locked |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3237 |
- prefBranch->UnlockPref(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3238 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3239 |
- switch (prefType) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3240 |
- case nsIPrefBranch::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3241 |
- prefBranch->SetCharPref(aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3242 |
- aPrefValue->stringVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3243 |
- SYSPREF_LOG(("Mozilla value is %s\n", aPrefValue->stringVal)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3244 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3245 |
- PL_strfree(aPrefValue->stringVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3246 |
- aPrefValue->stringVal = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3247 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3248 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3249 |
- case nsIPrefBranch::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3250 |
- prefBranch->SetIntPref(aPrefName, aPrefValue->intVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3251 |
- SYSPREF_LOG(("Mozilla value is %d\n", aPrefValue->intVal)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3252 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3253 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3254 |
- case nsIPrefBranch::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3255 |
- prefBranch->SetBoolPref(aPrefName, aPrefValue->boolVal); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3256 |
- SYSPREF_LOG(("Mozilla value is %s\n", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3257 |
- aPrefValue->boolVal ? "TRUE" : "FALSE")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3258 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3259 |
- break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3260 |
- default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3261 |
- SYSPREF_LOG(("Fail to Restore Mozilla value for it\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3262 |
- return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3263 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3264 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3265 |
- // restore its old lock status |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3266 |
- if (aLocked) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3267 |
- prefBranch->LockPref(aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3268 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3269 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3270 |
diff --git a/extensions/pref/system-pref/src/nsSystemPref.h b/extensions/pref/system-pref/src/nsSystemPref.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3271 |
--- a/extensions/pref/system-pref/src/nsSystemPref.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3272 |
+++ b/extensions/pref/system-pref/src/nsSystemPref.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3273 |
@@ -18,17 +18,17 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3274 |
* The Original Code is mozilla.org code. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3275 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3276 |
* The Initial Developer of the Original Code is Sun Microsystems, Inc. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3277 |
* Portions created by Sun Microsystems are Copyright (C) 2003 Sun |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3278 |
* Microsystems, Inc. All Rights Reserved. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3279 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3280 |
* Original Author: Bolian Yin (bolian.yin@sun.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3281 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3282 |
- * Contributor(s): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3283 |
+ * Contributor(s): Robert O'Callahan/Novell (rocallahan@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3284 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3285 |
* Alternatively, the contents of this file may be used under the terms of |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3286 |
* either the GNU General Public License Version 2 or later (the "GPL"), or |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3287 |
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3288 |
* in which case the provisions of the GPL or the LGPL are applicable instead |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3289 |
* of those above. If you wish to allow use of your version of this file only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3290 |
* under the terms of either the GPL or the LGPL, and not to allow others to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3291 |
* use your version of this file under the terms of the NPL, indicate your |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3292 |
@@ -40,71 +40,101 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3293 |
* ***** END LICENSE BLOCK ***** */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3294 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3295 |
#ifndef __SYSTEM_PREF_H__ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3296 |
#define __SYSTEM_PREF_H__ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3297 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3298 |
#include "nsCOMPtr.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3299 |
#include "nsXPCOM.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3300 |
#include "nsCRT.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3301 |
-#include "nsIAppStartupNotifier.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3302 |
-#include "nsICategoryManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3303 |
-#include "nsIServiceManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3304 |
#include "nsWeakReference.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3305 |
-#include "nsIPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3306 |
-#include "nsIPrefBranch2.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3307 |
+#include "nsClassHashtable.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3308 |
+#include "nsHashKeys.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3309 |
+#include "nsMemory.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3310 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3311 |
-#include <nsIObserver.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3312 |
+#include "nsISystemPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3313 |
+#include "nsIObserver.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3314 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3315 |
-union MozPrefValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3316 |
struct SysPrefItem; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3317 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3318 |
////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3319 |
// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3320 |
// nsSystemPref, as an extension of mozilla pref service, reads some mozilla |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3321 |
// prefs from host system when the feature is enabled ("config.system-pref"). |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3322 |
// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3323 |
-// nsSystemPref listens on NS_PREFSERVICE_READ_TOPIC_ID. When notified, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3324 |
-// nsSystemPref will start the nsSystemPrefService (platform specific) to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3325 |
-// read all the interested prefs (listed in sSysPrefList table) from system |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3326 |
-// and lock these prefs from user's modification. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3327 |
+// nsSystemPref listens on NS_PREFSERVICE_READ_TOPIC_ID. When |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3328 |
+// notified, nsSystemPref will start the nsSystemPrefService (platform |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3329 |
+// specific) and tell it to override Mozilla prefs with its own |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3330 |
+// settings. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3331 |
// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3332 |
-// This feature will make mozilla integrated better into host platforms. If |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3333 |
-// users want to change the prefs read from system, the system provided pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3334 |
-// editor (i.e. gconf-editor in gnome) should be used. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3335 |
+// When overriding a Mozilla preference the prefservice can request the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3336 |
+// pref be locked or unlocked. If the pref is locked then we set the default |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3337 |
+// value and lock it in Mozilla so the user value is ignored and the user cannot |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3338 |
+// change the value. If the pref is unlocked then we set the user value |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3339 |
+// and unlock it in Mozilla so the user can change it. If the user changes it, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3340 |
+// then the prefservice is notified so it can copy the value back to its |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3341 |
+// underlying store. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3342 |
+// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3343 |
+// We detect changes to Mozilla prefs by observing pref changes in the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3344 |
+// user branch. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3345 |
+// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3346 |
+// For testing purposes, if the user toggles on |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3347 |
+// config.use_system_prefs then we save the current preferences before |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3348 |
+// overriding them from gconf, and if the user toggles off |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3349 |
+// config.use_system_prefs *in the same session* then we restore the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3350 |
+// preferences. If the user exits without turning off use_system_prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3351 |
+// then the saved values are lost and the new values are permanent. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3352 |
+// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3353 |
////////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3354 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3355 |
class nsSystemPref : public nsIObserver, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3356 |
- public nsSupportsWeakReference |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3357 |
+ public nsSupportsWeakReference, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3358 |
+ public nsISystemPref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3359 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3360 |
public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3361 |
NS_DECL_ISUPPORTS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3362 |
NS_DECL_NSIOBSERVER |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3363 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3364 |
nsSystemPref(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3365 |
virtual ~nsSystemPref(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3366 |
nsresult Init(void); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3367 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3368 |
+ // nsISystemPref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3369 |
+ virtual nsresult SetOverridingMozillaBoolPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3370 |
+ PRBool aValue, PRBool aLocked, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3371 |
+ PRBool aPresent = PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3372 |
+ virtual nsresult SetOverridingMozillaIntPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3373 |
+ PRInt32 aValue, PRBool aLocked, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3374 |
+ PRBool aPresent = PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3375 |
+ virtual nsresult SetOverridingMozillaStringPref(const char* aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3376 |
+ const char* aValue, PRBool aLocked, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3377 |
+ PRBool aPresent = PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3378 |
+ virtual nsresult StopOverridingMozillaPref(const char* aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3379 |
+ virtual already_AddRefed<nsIPrefBranch2> GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3380 |
+ virtual already_AddRefed<nsIPrefBranch> GetPrefDefaultBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3381 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3382 |
private: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3383 |
- // funcs used to load system prefs and save mozilla default prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3384 |
- nsresult UseSystemPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3385 |
- nsresult ReadSystemPref(const char *aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3386 |
- nsresult SaveMozDefaultPref(const char *aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3387 |
- MozPrefValue *aPrefVal, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3388 |
- PRBool *aLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3389 |
+ // If we don't load the system prefs for any reason, then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3390 |
+ // set all config.lockdown.* preferences to PR_FALSE so that |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3391 |
+ // residual lockdown settings are removed. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3392 |
+ nsresult FixupLockdownPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3393 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3394 |
- // funcs used to load mozilla default prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3395 |
- nsresult UseMozillaPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3396 |
- nsresult RestoreMozDefaultPref(const char *aPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3397 |
- MozPrefValue *aPrefVal, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3398 |
- PRBool aLocked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3399 |
+ nsresult LoadSystemPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3400 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3401 |
- nsCOMPtr<nsIPrefBranch2> mSysPrefService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3402 |
- PRBool mEnabled; // system pref is enabled or not |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3403 |
- SysPrefItem *mSysPrefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3404 |
+ nsresult RestoreMozillaPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3405 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3406 |
+ nsresult OverridePref(const char* aPrefName, PRInt32 aType, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3407 |
+ void* aValue, PRBool aLock, PRBool aPresent); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3408 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3409 |
+ nsCOMPtr<nsISystemPrefService> mSysPrefService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3410 |
+ nsClassHashtable<nsCStringHashKey,SysPrefItem> mSavedPrefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3411 |
+ // weak pointers to cached prefbranches |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3412 |
+ nsIPrefBranch2* mCachedUserPrefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3413 |
+ nsIPrefBranch* mCachedDefaultPrefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3414 |
+ PRPackedBool mIgnorePrefSetting; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3415 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3416 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3417 |
#define NS_SYSTEMPREF_CID \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3418 |
{ /* {549abb24-7c9d-4aba-915e-7ce0b716b32f} */ \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3419 |
0x549abb24, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3420 |
0x7c9d, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3421 |
0x4aba, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3422 |
{ 0x91, 0x5e, 0x7c, 0xe0, 0xb7, 0x16, 0xb3, 0x2f } \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3423 |
diff --git a/extensions/pref/system-pref/src/nsSystemPrefFactory.cpp b/extensions/pref/system-pref/src/nsSystemPrefFactory.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3424 |
--- a/extensions/pref/system-pref/src/nsSystemPrefFactory.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3425 |
+++ b/extensions/pref/system-pref/src/nsSystemPrefFactory.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3426 |
@@ -37,20 +37,20 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3427 |
* the provisions above, a recipient may use your version of this file under |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3428 |
* the terms of any one of the NPL, the GPL or the LGPL. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3429 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3430 |
* ***** END LICENSE BLOCK ***** */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3431 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3432 |
#include "nsICategoryManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3433 |
#include "nsIGenericFactory.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3434 |
#include "nsSystemPref.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3435 |
-#include "nsSystemPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3436 |
+#include "nsIServiceManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3437 |
+#include "nsIAppStartupNotifier.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3438 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3439 |
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemPref, Init) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3440 |
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemPrefService, Init) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3441 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3442 |
// Registering nsSystemPref module as part of the app-startup category to get |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3443 |
// it instantiated. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3444 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3445 |
static NS_METHOD |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3446 |
RegisterSystemPref(nsIComponentManager *aCompMgr, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3447 |
nsIFile *aPath, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3448 |
const char *registryLocation, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3449 |
@@ -91,16 +91,11 @@ UnRegisterSystemPref(nsIComponentManager |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3450 |
static const nsModuleComponentInfo components[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3451 |
{ NS_SYSTEMPREF_CLASSNAME, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3452 |
NS_SYSTEMPREF_CID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3453 |
NS_SYSTEMPREF_CONTRACTID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3454 |
nsSystemPrefConstructor, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3455 |
RegisterSystemPref, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3456 |
UnRegisterSystemPref, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3457 |
}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3458 |
- { NS_SYSTEMPREF_SERVICE_CLASSNAME, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3459 |
- NS_SYSTEMPREF_SERVICE_CID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3460 |
- NS_SYSTEMPREF_SERVICE_CONTRACTID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3461 |
- nsSystemPrefServiceConstructor, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3462 |
- }, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3463 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3464 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3465 |
NS_IMPL_NSGETMODULE(nsSystemPrefModule, components) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3466 |
diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3467 |
--- a/toolkit/library/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3468 |
+++ b/toolkit/library/Makefile.in |
59
604517bb16d8
Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
3469 |
@@ -225,16 +225,20 @@ endif |
604517bb16d8
Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
3470 |
ifdef MOZ_ENABLE_LIBCONIC |
604517bb16d8
Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
3471 |
EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS) |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3472 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3473 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3474 |
ifdef MOZ_ENABLE_DBUS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3475 |
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3476 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3477 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3478 |
+ifdef MOZ_ENABLE_GCONF |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3479 |
+EXTRA_DSO_LDOPTS += $(MOZ_GCONF_LIBS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3480 |
+endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3481 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3482 |
ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3483 |
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS) $(MOZ_PANGO_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS) -lgthread-2.0 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3484 |
EXTRA_DSO_LDOPTS += $(FT2_LIBS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3485 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3486 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3487 |
ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3488 |
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XT_LIBS) $(MOZ_QT_LIBS) -lgthread-2.0 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3489 |
EXTRA_DSO_LDOPTS += $(FT2_LIBS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3490 |
diff --git a/toolkit/toolkit-tiers.mk b/toolkit/toolkit-tiers.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3491 |
--- a/toolkit/toolkit-tiers.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3492 |
+++ b/toolkit/toolkit-tiers.mk |
59
604517bb16d8
Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
3493 |
@@ -254,16 +254,23 @@ endif |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3494 |
ifdef MOZ_ENABLE_LIBXUL |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3495 |
tier_toolkit_dirs += xpcom/stub |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3496 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3497 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3498 |
ifdef NS_TRACE_MALLOC |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3499 |
tier_toolkit_dirs += tools/trace-malloc |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3500 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3501 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3502 |
+# gconf module is external |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3503 |
+ifdef MOZ_PREF_EXTENSIONS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3504 |
+ifdef MOZ_ENABLE_GCONF |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3505 |
+tier_toolkit_dirs += extensions/pref/system-pref/src/gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3506 |
+endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3507 |
+endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3508 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3509 |
ifdef MOZ_ENABLE_GNOME_COMPONENT |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3510 |
tier_toolkit_dirs += toolkit/system/gnome |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3511 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3512 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3513 |
ifndef MOZ_ENABLE_LIBCONIC |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3514 |
# if libconic is present, it will do its own network monitoring |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3515 |
ifdef MOZ_ENABLE_DBUS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3516 |
tier_toolkit_dirs += toolkit/system/dbus |