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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 chrome.send('themesSetGTK'); | 73 chrome.send('themesSetGTK'); |
74 }; | 74 }; |
75 } | 75 } |
76 } else { | 76 } else { |
77 chrome.send('loadAccountPicture'); | 77 chrome.send('loadAccountPicture'); |
78 } | 78 } |
79 | 79 |
80 if (cr.commandLine.options['--bwsi']) { | 80 if (cr.commandLine.options['--bwsi']) { |
81 // Disable the screen lock checkbox for the guest mode. | 81 // Disable the screen lock checkbox for the guest mode. |
82 $('enable-screen-lock').disabled = true; | 82 $('enable-screen-lock').disabled = true; |
| 83 } |
83 | 84 |
84 // Disable passwords management settings for the guest mode. | 85 if (PersonalOptions.disablePasswordManagement()) { |
85 $('passwords-offersave').disabled = true; | 86 $('passwords-offersave').disabled = true; |
86 $('passwords-neversave').disabled = true; | 87 $('passwords-neversave').disabled = true; |
87 $('passwords-offersave').value = false; | 88 $('passwords-offersave').value = false; |
88 $('passwords-neversave').value = true; | 89 $('passwords-neversave').value = true; |
89 $('manage-passwords').disabled = true; | 90 $('manage-passwords').disabled = true; |
90 } | 91 } |
91 }, | 92 }, |
92 | 93 |
93 showStopSyncingOverlay_: function(event) { | 94 showStopSyncingOverlay_: function(event) { |
94 AlertOverlay.show(localStrings.getString('stop_syncing_title'), | 95 AlertOverlay.show(localStrings.getString('stop_syncing_title'), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (type.match(/Registered$/) && !dict[type]) { | 178 if (type.match(/Registered$/) && !dict[type]) { |
178 node = $(type.replace(/([a-z]+)Registered$/i, '$1').toLowerCase() | 179 node = $(type.replace(/([a-z]+)Registered$/i, '$1').toLowerCase() |
179 + '-check'); | 180 + '-check'); |
180 if (node) | 181 if (node) |
181 node.parentNode.style.display = 'none'; | 182 node.parentNode.style.display = 'none'; |
182 } | 183 } |
183 } | 184 } |
184 }, | 185 }, |
185 }; | 186 }; |
186 | 187 |
| 188 /** |
| 189 * Returns whether the user should be able to manage (view and edit) their |
| 190 * stored passwords. Password management is disabled in guest mode. |
| 191 * @return {boolean} True if password management should be disabled. |
| 192 */ |
| 193 PersonalOptions.disablePasswordManagement = function() { |
| 194 return cr.commandLine.options['--bwsi']; |
| 195 }; |
| 196 |
187 // Forward public APIs to private implementations. | 197 // Forward public APIs to private implementations. |
188 [ | 198 [ |
189 'setSyncEnabled', | 199 'setSyncEnabled', |
190 'setSyncSetupCompleted', | 200 'setSyncSetupCompleted', |
191 'setAccountPicture', | 201 'setAccountPicture', |
192 'setSyncStatus', | 202 'setSyncStatus', |
193 'setSyncStatusErrorVisible', | 203 'setSyncStatusErrorVisible', |
194 'setSyncActionLinkEnabled', | 204 'setSyncActionLinkEnabled', |
195 'setSyncActionLinkLabel', | 205 'setSyncActionLinkLabel', |
196 'setStartStopButtonVisible', | 206 'setStartStopButtonVisible', |
197 'setStartStopButtonEnabled', | 207 'setStartStopButtonEnabled', |
198 'setStartStopButtonLabel', | 208 'setStartStopButtonLabel', |
199 'setGtkThemeButtonEnabled', | 209 'setGtkThemeButtonEnabled', |
200 'setThemesResetButtonEnabled', | 210 'setThemesResetButtonEnabled', |
201 'hideSyncSection', | 211 'hideSyncSection', |
202 'setRegisteredDataTypes', | 212 'setRegisteredDataTypes', |
203 ].forEach(function(name) { | 213 ].forEach(function(name) { |
204 PersonalOptions[name] = function(value) { | 214 PersonalOptions[name] = function(value) { |
205 PersonalOptions.getInstance()[name + '_'](value); | 215 PersonalOptions.getInstance()[name + '_'](value); |
206 }; | 216 }; |
207 }); | 217 }); |
208 | 218 |
209 // Export | 219 // Export |
210 return { | 220 return { |
211 PersonalOptions: PersonalOptions | 221 PersonalOptions: PersonalOptions |
212 }; | 222 }; |
213 | 223 |
214 }); | 224 }); |
OLD | NEW |