| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 if (loadTimeData.getBoolean('managedUsersEnabled')) { | 5 if (loadTimeData.getBoolean('managedUsersEnabled')) { |
| 6 | 6 |
| 7 cr.define('options', function() { | 7 cr.define('options', function() { |
| 8 /** @const */ var OptionsPage = options.OptionsPage; | 8 /** @const */ var OptionsPage = options.OptionsPage; |
| 9 /** @const */ var SettingsDialog = options.SettingsDialog; | 9 /** @const */ var SettingsDialog = options.SettingsDialog; |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** @override */ | 103 /** @override */ |
| 104 handleConfirm: function() { | 104 handleConfirm: function() { |
| 105 if ($('use-passphrase-checkbox').checked && !this.isPassphraseSet) { | 105 if ($('use-passphrase-checkbox').checked && !this.isPassphraseSet) { |
| 106 OptionsPage.navigateToPage('setPassphrase'); | 106 OptionsPage.navigateToPage('setPassphrase'); |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 if (!$('use-passphrase-checkbox').checked) | 109 if (!$('use-passphrase-checkbox').checked) |
| 110 chrome.send('resetPassphrase'); | 110 chrome.send('resetPassphrase'); |
| 111 chrome.send('confirmManagedUserSettings'); | |
| 112 SettingsDialog.prototype.handleConfirm.call(this); | 111 SettingsDialog.prototype.handleConfirm.call(this); |
| 113 }, | 112 }, |
| 114 | 113 |
| 115 /** Update the page according to the current authentication state */ | 114 /** Update the page according to the current authentication state */ |
| 116 didShowPage: function() { | 115 didShowPage: function() { |
| 117 var isAuthenticated = | 116 var isAuthenticated = |
| 118 this.authenticationState == ManagedUserAuthentication.AUTHENTICATED; | 117 this.authenticationState == ManagedUserAuthentication.AUTHENTICATED; |
| 119 this.enableControls(isAuthenticated); | 118 this.enableControls(isAuthenticated); |
| 120 chrome.send('settingsPageOpened'); | 119 chrome.send('settingsPageOpened'); |
| 121 }, | 120 }, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 this.authenticationState = ManagedUserAuthentication.UNAUTHENTICATED; | 153 this.authenticationState = ManagedUserAuthentication.UNAUTHENTICATED; |
| 155 } | 154 } |
| 156 }, | 155 }, |
| 157 | 156 |
| 158 // Reset the authentication to UNAUTHENTICATED when the managed user | 157 // Reset the authentication to UNAUTHENTICATED when the managed user |
| 159 // settings dialog is closed. | 158 // settings dialog is closed. |
| 160 didClosePage: function() { | 159 didClosePage: function() { |
| 161 // Reset the authentication of the custodian. | 160 // Reset the authentication of the custodian. |
| 162 this.authenticationState = ManagedUserAuthentication.UNAUTHENTICATED; | 161 this.authenticationState = ManagedUserAuthentication.UNAUTHENTICATED; |
| 163 chrome.send('setElevated', [false]); | 162 chrome.send('setElevated', [false]); |
| 163 chrome.send('confirmManagedUserSettings'); |
| 164 }, | 164 }, |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 // Sets the authentication state of the managed user. |success| is true if | 167 // Sets the authentication state of the managed user. |success| is true if |
| 168 // the authentication was successful. | 168 // the authentication was successful. |
| 169 ManagedUserSettings.isAuthenticated = function(success) { | 169 ManagedUserSettings.isAuthenticated = function(success) { |
| 170 ManagedUserSettings.getInstance().isAuthenticated_(success); | 170 ManagedUserSettings.getInstance().isAuthenticated_(success); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 // Sets the use passphrase checkbox according to if a passphrase is specified | 173 // Sets the use passphrase checkbox according to if a passphrase is specified |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 // Export | 214 // Export |
| 215 return { | 215 return { |
| 216 ManagedUserSettings: ManagedUserSettings, | 216 ManagedUserSettings: ManagedUserSettings, |
| 217 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, | 217 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, |
| 218 ManagedUserAuthentication: ManagedUserAuthentication | 218 ManagedUserAuthentication: ManagedUserAuthentication |
| 219 }; | 219 }; |
| 220 }); | 220 }); |
| 221 | 221 |
| 222 } | 222 } |
| OLD | NEW |