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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // TODO(joaodasilva): remove the radio controls toggles below, once a | 100 // TODO(joaodasilva): remove the radio controls toggles below, once a |
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['disabled']; |
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; | |
114 $('passwords-neversave').disabled = managed; | |
115 $('manage-passwords').disabled = managed && !value; | 113 $('manage-passwords').disabled = managed && !value; |
116 }); | 114 }); |
117 } | 115 } |
118 | 116 |
119 if (PersonalOptions.disableAutofillManagement()) { | 117 if (PersonalOptions.disableAutofillManagement()) { |
120 $('autofill-settings').disabled = true; | 118 $('autofill-settings').disabled = true; |
121 | 119 |
122 // Disable and turn off autofill. | 120 // Disable and turn off autofill. |
123 var autofillEnabled = $('autofill-enabled'); | 121 var autofillEnabled = $('autofill-enabled'); |
124 autofillEnabled.disabled = true; | 122 autofillEnabled.disabled = true; |
125 autofillEnabled.checked = false; | 123 autofillEnabled.checked = false; |
126 cr.dispatchSimpleEvent(autofillEnabled, 'change'); | 124 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
127 } else { | 125 } else { |
128 Preferences.getInstance().addEventListener( | 126 Preferences.getInstance().addEventListener( |
129 'autofill.enabled', | 127 'autofill.enabled', |
130 function(event) { | 128 function(event) { |
131 var managed = event.value && event.value['managed']; | 129 var managed = event.value && event.value['disabled']; |
132 var value = event.value && event.value['value'] != undefined ? | 130 var value = event.value && event.value['value'] != undefined ? |
133 event.value['value'] : event.value; | 131 event.value['value'] : event.value; |
134 $('autofill-settings').disabled = managed && !value; | 132 $('autofill-settings').disabled = managed && !value; |
135 }); | 133 }); |
136 } | 134 } |
137 }, | 135 }, |
138 | 136 |
139 setSyncEnabled_: function(enabled) { | 137 setSyncEnabled_: function(enabled) { |
140 this.syncEnabled = enabled; | 138 this.syncEnabled = enabled; |
141 }, | 139 }, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 PersonalOptions.getInstance()[name + '_'](value); | 268 PersonalOptions.getInstance()[name + '_'](value); |
271 }; | 269 }; |
272 }); | 270 }); |
273 | 271 |
274 // Export | 272 // Export |
275 return { | 273 return { |
276 PersonalOptions: PersonalOptions | 274 PersonalOptions: PersonalOptions |
277 }; | 275 }; |
278 | 276 |
279 }); | 277 }); |
OLD | NEW |