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-enabled').disabled = true; | |
achuithb
2011/05/20 23:38:01
Curious - is it better to cache the autofill-enabl
xiyuan
2011/05/20 23:52:39
I think you are right that use $() will incur a pe
| |
100 $('autofill-settings').disabled = true; | |
101 | |
102 // Turn off autofill. | |
103 $('autofill-enabled').checked = false; | |
104 cr.dispatchSimpleEvent($('autofill-enabled'), 'change'); | |
105 } | |
95 }, | 106 }, |
96 | 107 |
97 showStopSyncingOverlay_: function() { | 108 showStopSyncingOverlay_: function() { |
98 AlertOverlay.show(localStrings.getString('stop_syncing_title'), | 109 AlertOverlay.show(localStrings.getString('stop_syncing_title'), |
99 localStrings.getString('stop_syncing_explanation'), | 110 localStrings.getString('stop_syncing_explanation'), |
100 localStrings.getString('stop_syncing_confirm'), | 111 localStrings.getString('stop_syncing_confirm'), |
101 localStrings.getString('cancel'), | 112 localStrings.getString('cancel'), |
102 function() { chrome.send('stopSyncing'); }); | 113 function() { chrome.send('stopSyncing'); }); |
103 }, | 114 }, |
104 | 115 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 | 218 |
208 /** | 219 /** |
209 * Returns whether the user should be able to manage (view and edit) their | 220 * Returns whether the user should be able to manage (view and edit) their |
210 * stored passwords. Password management is disabled in guest mode. | 221 * stored passwords. Password management is disabled in guest mode. |
211 * @return {boolean} True if password management should be disabled. | 222 * @return {boolean} True if password management should be disabled. |
212 */ | 223 */ |
213 PersonalOptions.disablePasswordManagement = function() { | 224 PersonalOptions.disablePasswordManagement = function() { |
214 return cr.commandLine.options['--bwsi']; | 225 return cr.commandLine.options['--bwsi']; |
215 }; | 226 }; |
216 | 227 |
228 /** | |
229 * Returns whether the user should be able to manage autofill settings. | |
230 * @return {boolean} True if password management should be disabled. | |
231 */ | |
232 PersonalOptions.disableAutofillManagement = function() { | |
233 return cr.commandLine.options['--bwsi']; | |
234 }; | |
235 | |
217 // Forward public APIs to private implementations. | 236 // Forward public APIs to private implementations. |
218 [ | 237 [ |
219 'setSyncEnabled', | 238 'setSyncEnabled', |
220 'setSyncSetupCompleted', | 239 'setSyncSetupCompleted', |
221 'setAccountPicture', | 240 'setAccountPicture', |
222 'setSyncStatus', | 241 'setSyncStatus', |
223 'setSyncStatusErrorVisible', | 242 'setSyncStatusErrorVisible', |
224 'setSyncActionLinkEnabled', | 243 'setSyncActionLinkEnabled', |
225 'setSyncActionLinkLabel', | 244 'setSyncActionLinkLabel', |
226 'setProfilesSectionVisible', | 245 'setProfilesSectionVisible', |
(...skipping 10 matching lines...) Expand all Loading... | |
237 PersonalOptions.getInstance()[name + '_'](value); | 256 PersonalOptions.getInstance()[name + '_'](value); |
238 }; | 257 }; |
239 }); | 258 }); |
240 | 259 |
241 // Export | 260 // Export |
242 return { | 261 return { |
243 PersonalOptions: PersonalOptions | 262 PersonalOptions: PersonalOptions |
244 }; | 263 }; |
245 | 264 |
246 }); | 265 }); |
OLD | NEW |