| 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 var ArrayDataModel = cr.ui.ArrayDataModel; | 8 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 chrome.send('coreOptionsUserMetricsAction', | 80 chrome.send('coreOptionsUserMetricsAction', |
| 81 ['Options_ShowPasswordManager']); | 81 ['Options_ShowPasswordManager']); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 // Autofill. | 84 // Autofill. |
| 85 $('autofill-settings').onclick = function(event) { | 85 $('autofill-settings').onclick = function(event) { |
| 86 OptionsPage.navigateToPage('autofill'); | 86 OptionsPage.navigateToPage('autofill'); |
| 87 chrome.send('coreOptionsUserMetricsAction', | 87 chrome.send('coreOptionsUserMetricsAction', |
| 88 ['Options_ShowAutofillSettings']); | 88 ['Options_ShowAutofillSettings']); |
| 89 }; | 89 }; |
| 90 if (cr.isChromeOS && cr.commandLine.options['--bwsi']) { | 90 if (cr.isChromeOS && cr.commandLine && cr.commandLine.options['--bwsi']) { |
| 91 // Hide Autofill options for the guest user. | 91 // Hide Autofill options for the guest user. |
| 92 $('autofill-section').hidden = true; | 92 $('autofill-section').hidden = true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Appearance. | 95 // Appearance. |
| 96 $('themes-reset').onclick = function(event) { | 96 $('themes-reset').onclick = function(event) { |
| 97 chrome.send('themesReset'); | 97 chrome.send('themesReset'); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 if (!cr.isChromeOS) { | 100 if (!cr.isChromeOS) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 111 $('themes-GTK-button').onclick = function(event) { | 111 $('themes-GTK-button').onclick = function(event) { |
| 112 chrome.send('themesSetGTK'); | 112 chrome.send('themesSetGTK'); |
| 113 }; | 113 }; |
| 114 } | 114 } |
| 115 } else { | 115 } else { |
| 116 $('change-picture-button').onclick = function(event) { | 116 $('change-picture-button').onclick = function(event) { |
| 117 OptionsPage.navigateToPage('changePicture'); | 117 OptionsPage.navigateToPage('changePicture'); |
| 118 }; | 118 }; |
| 119 this.updateAccountPicture_(); | 119 this.updateAccountPicture_(); |
| 120 | 120 |
| 121 if (cr.commandLine.options['--bwsi']) { | 121 if (cr.commandLine && cr.commandLine.options['--bwsi']) { |
| 122 // Disable the screen lock checkbox and change-picture-button in | 122 // Disable the screen lock checkbox and change-picture-button in |
| 123 // guest mode. | 123 // guest mode. |
| 124 $('enable-screen-lock').disabled = true; | 124 $('enable-screen-lock').disabled = true; |
| 125 $('change-picture-button').disabled = true; | 125 $('change-picture-button').disabled = true; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 if (PersonalOptions.disablePasswordManagement()) { | 129 if (PersonalOptions.disablePasswordManagement()) { |
| 130 // Disable the Password Manager in guest mode. | 130 // Disable the Password Manager in guest mode. |
| 131 $('passwords-offersave').disabled = true; | 131 $('passwords-offersave').disabled = true; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 '?id=' + (new Date()).getTime(); | 310 '?id=' + (new Date()).getTime(); |
| 311 }, | 311 }, |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 /** | 314 /** |
| 315 * Returns whether the user should be able to manage (view and edit) their | 315 * Returns whether the user should be able to manage (view and edit) their |
| 316 * stored passwords. Password management is disabled in guest mode. | 316 * stored passwords. Password management is disabled in guest mode. |
| 317 * @return {boolean} True if password management should be disabled. | 317 * @return {boolean} True if password management should be disabled. |
| 318 */ | 318 */ |
| 319 PersonalOptions.disablePasswordManagement = function() { | 319 PersonalOptions.disablePasswordManagement = function() { |
| 320 return cr.commandLine.options['--bwsi']; | 320 return cr.commandLine && cr.commandLine.options['--bwsi']; |
| 321 }; | 321 }; |
| 322 | 322 |
| 323 /** | 323 /** |
| 324 * Returns whether the user should be able to manage autofill settings. | 324 * Returns whether the user should be able to manage autofill settings. |
| 325 * @return {boolean} True if password management should be disabled. | 325 * @return {boolean} True if password management should be disabled. |
| 326 */ | 326 */ |
| 327 PersonalOptions.disableAutofillManagement = function() { | 327 PersonalOptions.disableAutofillManagement = function() { |
| 328 return cr.commandLine.options['--bwsi']; | 328 return cr.commandLine && cr.commandLine.options['--bwsi']; |
| 329 }; | 329 }; |
| 330 | 330 |
| 331 if (cr.isChromeOS) { | 331 if (cr.isChromeOS) { |
| 332 /** | 332 /** |
| 333 * Returns username (canonical email) of the user logged in (ChromeOS only). | 333 * Returns username (canonical email) of the user logged in (ChromeOS only). |
| 334 * @return {string} user email. | 334 * @return {string} user email. |
| 335 */ | 335 */ |
| 336 PersonalOptions.getLoggedInUsername = function() { | 336 PersonalOptions.getLoggedInUsername = function() { |
| 337 return PersonalOptions.getInstance().username_; | 337 return PersonalOptions.getInstance().username_; |
| 338 }; | 338 }; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 363 return PersonalOptions.getInstance()[name + '_'](value); | 363 return PersonalOptions.getInstance()[name + '_'](value); |
| 364 }; | 364 }; |
| 365 }); | 365 }); |
| 366 | 366 |
| 367 // Export | 367 // Export |
| 368 return { | 368 return { |
| 369 PersonalOptions: PersonalOptions | 369 PersonalOptions: PersonalOptions |
| 370 }; | 370 }; |
| 371 | 371 |
| 372 }); | 372 }); |
| OLD | NEW |