OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 // State variables. | 9 // State variables. |
10 var syncEnabled = false; | 10 var syncEnabled = false; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 | 90 |
91 if (PersonalOptions.disablePasswordManagement()) { | 91 if (PersonalOptions.disablePasswordManagement()) { |
92 // Disable the Password Manager in guest mode. | 92 // Disable the Password Manager in guest mode. |
93 $('passwords-offersave').disabled = true; | 93 $('passwords-offersave').disabled = true; |
94 $('passwords-neversave').disabled = true; | 94 $('passwords-neversave').disabled = true; |
95 $('passwords-offersave').value = false; | 95 $('passwords-offersave').value = false; |
96 $('passwords-neversave').value = true; | 96 $('passwords-neversave').value = true; |
97 $('manage-passwords').disabled = true; | 97 $('manage-passwords').disabled = true; |
98 } else { | 98 } else { |
99 // Otherwise, follow the preference, which can be toggled at runtime. | 99 // Otherwise, follow the preference, which can be toggled at runtime. |
100 // TODO(joaodasilva): remove the radio controls toggles below, once a | 100 // TODO(joaodasilva): remove the radio controls toggles below, once a |
Bernhard Bauer
2011/07/13 11:22:16
Joao, could you take a look whether we should chan
Joao da Silva
2011/07/13 17:35:17
Yes, see comments below. These temporary fixes sho
Bernhard Bauer
2011/07/13 22:15:12
But we do that now (see http://crbug.com/80604).
Joao da Silva
2011/07/14 09:04:11
Very cool! In that case this code can be fixed, I'
Bernhard Bauer
2011/07/14 10:15:56
Sure.
| |
101 // generic fix for updateElementState_ in pref_ui.js is available. | 101 // generic fix for updateElementState_ in pref_ui.js is available. |
102 // The problem is that updateElementState_ disables controls when a | 102 // The problem is that updateElementState_ disables controls when a |
103 // policy enforces the preference, but doesn't re-enable them when the | 103 // policy enforces the preference, but doesn't re-enable them when the |
104 // policy is changed or removed. That's because controls can also be | 104 // policy is changed or removed. That's because controls can also be |
105 // disabled for other reasons (e.g. Guest mode, in this case) and | 105 // disabled for other reasons (e.g. Guest mode, in this case) and |
106 // removing the policy doesn't mean the control can be enabled again. | 106 // removing the policy doesn't mean the control can be enabled again. |
107 Preferences.getInstance().addEventListener( | 107 Preferences.getInstance().addEventListener( |
108 'profile.password_manager_enabled', | 108 'profile.password_manager_enabled', |
109 function(event) { | 109 function(event) { |
110 var managed = event.value && event.value['managed']; | 110 var managed = event.value && event.value['managed']; |
Joao da Silva
2011/07/13 17:35:17
Replace this line with:
var managed = event.value
Joao da Silva
2011/07/14 09:04:11
The lines affecting the radio controls ('passwords
Bernhard Bauer
2011/07/14 10:15:56
Done.
Bernhard Bauer
2011/07/14 10:15:56
I try to use |event.value['controlledBy']| to stor
| |
111 var value = event.value && event.value['value'] != undefined ? | 111 var value = event.value && event.value['value'] != undefined ? |
112 event.value['value'] : event.value; | 112 event.value['value'] : event.value; |
113 $('passwords-offersave').disabled = managed; | 113 $('passwords-offersave').disabled = managed; |
114 $('passwords-neversave').disabled = managed; | 114 $('passwords-neversave').disabled = managed; |
115 $('manage-passwords').disabled = managed && !value; | 115 $('manage-passwords').disabled = managed && !value; |
116 }); | 116 }); |
117 } | 117 } |
118 | 118 |
119 if (PersonalOptions.disableAutofillManagement()) { | 119 if (PersonalOptions.disableAutofillManagement()) { |
120 $('autofill-settings').disabled = true; | 120 $('autofill-settings').disabled = true; |
121 | 121 |
122 // Disable and turn off autofill. | 122 // Disable and turn off autofill. |
123 var autofillEnabled = $('autofill-enabled'); | 123 var autofillEnabled = $('autofill-enabled'); |
124 autofillEnabled.disabled = true; | 124 autofillEnabled.disabled = true; |
125 autofillEnabled.checked = false; | 125 autofillEnabled.checked = false; |
126 cr.dispatchSimpleEvent(autofillEnabled, 'change'); | 126 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
127 } else { | 127 } else { |
128 Preferences.getInstance().addEventListener( | 128 Preferences.getInstance().addEventListener( |
129 'autofill.enabled', | 129 'autofill.enabled', |
130 function(event) { | 130 function(event) { |
131 var managed = event.value && event.value['managed']; | 131 var managed = event.value && event.value['managed']; |
Joao da Silva
2011/07/13 17:35:17
Same change on this line too.
Bernhard Bauer
2011/07/14 10:15:56
Done.
| |
132 var value = event.value && event.value['value'] != undefined ? | 132 var value = event.value && event.value['value'] != undefined ? |
133 event.value['value'] : event.value; | 133 event.value['value'] : event.value; |
134 $('autofill-settings').disabled = managed && !value; | 134 $('autofill-settings').disabled = managed && !value; |
135 }); | 135 }); |
136 } | 136 } |
137 }, | 137 }, |
138 | 138 |
139 setSyncEnabled_: function(enabled) { | 139 setSyncEnabled_: function(enabled) { |
140 this.syncEnabled = enabled; | 140 this.syncEnabled = enabled; |
141 }, | 141 }, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 PersonalOptions.getInstance()[name + '_'](value); | 270 PersonalOptions.getInstance()[name + '_'](value); |
271 }; | 271 }; |
272 }); | 272 }); |
273 | 273 |
274 // Export | 274 // Export |
275 return { | 275 return { |
276 PersonalOptions: PersonalOptions | 276 PersonalOptions: PersonalOptions |
277 }; | 277 }; |
278 | 278 |
279 }); | 279 }); |
280 | |
Evan Stade
2011/07/13 17:06:04
?
Bernhard Bauer
2011/07/13 22:15:12
That was a whitespace change to include this file
| |
OLD | NEW |