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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if ($('themes-GTK-button')) { | 71 if ($('themes-GTK-button')) { |
72 $('themes-GTK-button').onclick = function(event) { | 72 $('themes-GTK-button').onclick = function(event) { |
73 chrome.send('themesSetGTK'); | 73 chrome.send('themesSetGTK'); |
74 }; | 74 }; |
75 } | 75 } |
76 } else { | 76 } else { |
77 $('change-picture-button').onclick = function(event) { | 77 $('change-picture-button').onclick = function(event) { |
78 OptionsPage.navigateToPage('changePicture'); | 78 OptionsPage.navigateToPage('changePicture'); |
79 }; | 79 }; |
80 chrome.send('loadAccountPicture'); | 80 chrome.send('loadAccountPicture'); |
81 } | |
82 | 81 |
83 if (cr.commandLine.options['--bwsi']) { | 82 if (cr.commandLine.options['--bwsi']) { |
84 // Disable the screen lock checkbox for the guest mode. | 83 // Disable the screen lock checkbox and change-picture-button in |
85 $('enable-screen-lock').disabled = true; | 84 // guest mode. |
| 85 $('enable-screen-lock').disabled = true; |
| 86 $('change-picture-button').disabled = true; |
| 87 } |
86 } | 88 } |
87 | 89 |
88 if (PersonalOptions.disablePasswordManagement()) { | 90 if (PersonalOptions.disablePasswordManagement()) { |
89 $('passwords-offersave').disabled = true; | 91 $('passwords-offersave').disabled = true; |
90 $('passwords-neversave').disabled = true; | 92 $('passwords-neversave').disabled = true; |
91 $('passwords-offersave').value = false; | 93 $('passwords-offersave').value = false; |
92 $('passwords-neversave').value = true; | 94 $('passwords-neversave').value = true; |
93 $('manage-passwords').disabled = true; | 95 $('manage-passwords').disabled = true; |
94 } | 96 } |
| 97 |
| 98 if (PersonalOptions.disableAutofillManagement()) { |
| 99 $('autofill-settings').disabled = true; |
| 100 |
| 101 // Disable and turn off autofill. |
| 102 var autofillEnabled = $('autofill-enabled'); |
| 103 autofillEnabled.disabled = true; |
| 104 autofillEnabled.checked = false; |
| 105 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
| 106 } |
95 }, | 107 }, |
96 | 108 |
97 showStopSyncingOverlay_: function() { | 109 showStopSyncingOverlay_: function() { |
98 AlertOverlay.show(localStrings.getString('stop_syncing_title'), | 110 AlertOverlay.show(localStrings.getString('stop_syncing_title'), |
99 localStrings.getString('stop_syncing_explanation'), | 111 localStrings.getString('stop_syncing_explanation'), |
100 localStrings.getString('stop_syncing_confirm'), | 112 localStrings.getString('stop_syncing_confirm'), |
101 localStrings.getString('cancel'), | 113 localStrings.getString('cancel'), |
102 function() { chrome.send('stopSyncing'); }); | 114 function() { chrome.send('stopSyncing'); }); |
103 }, | 115 }, |
104 | 116 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 219 |
208 /** | 220 /** |
209 * Returns whether the user should be able to manage (view and edit) their | 221 * Returns whether the user should be able to manage (view and edit) their |
210 * stored passwords. Password management is disabled in guest mode. | 222 * stored passwords. Password management is disabled in guest mode. |
211 * @return {boolean} True if password management should be disabled. | 223 * @return {boolean} True if password management should be disabled. |
212 */ | 224 */ |
213 PersonalOptions.disablePasswordManagement = function() { | 225 PersonalOptions.disablePasswordManagement = function() { |
214 return cr.commandLine.options['--bwsi']; | 226 return cr.commandLine.options['--bwsi']; |
215 }; | 227 }; |
216 | 228 |
| 229 /** |
| 230 * Returns whether the user should be able to manage autofill settings. |
| 231 * @return {boolean} True if password management should be disabled. |
| 232 */ |
| 233 PersonalOptions.disableAutofillManagement = function() { |
| 234 return cr.commandLine.options['--bwsi']; |
| 235 }; |
| 236 |
217 // Forward public APIs to private implementations. | 237 // Forward public APIs to private implementations. |
218 [ | 238 [ |
219 'setSyncEnabled', | 239 'setSyncEnabled', |
220 'setSyncSetupCompleted', | 240 'setSyncSetupCompleted', |
221 'setAccountPicture', | 241 'setAccountPicture', |
222 'setSyncStatus', | 242 'setSyncStatus', |
223 'setSyncStatusErrorVisible', | 243 'setSyncStatusErrorVisible', |
224 'setSyncActionLinkEnabled', | 244 'setSyncActionLinkEnabled', |
225 'setSyncActionLinkLabel', | 245 'setSyncActionLinkLabel', |
226 'setProfilesSectionVisible', | 246 'setProfilesSectionVisible', |
(...skipping 10 matching lines...) Expand all Loading... |
237 PersonalOptions.getInstance()[name + '_'](value); | 257 PersonalOptions.getInstance()[name + '_'](value); |
238 }; | 258 }; |
239 }); | 259 }); |
240 | 260 |
241 // Export | 261 // Export |
242 return { | 262 return { |
243 PersonalOptions: PersonalOptions | 263 PersonalOptions: PersonalOptions |
244 }; | 264 }; |
245 | 265 |
246 }); | 266 }); |
OLD | NEW |