Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
| 7 | 7 |
| 8 ////////////////////////////////////////////////////////////////////////////// | 8 ////////////////////////////////////////////////////////////////////////////// |
| 9 // ManagedUserSetPassphraseOverlay class: | 9 // ManagedUserSetPassphraseOverlay class: |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Encapsulated handling of the Managed User Set Passphrase page. | 12 * Encapsulated handling of the Managed User Set Passphrase page. |
| 13 * @constructor | 13 * @constructor |
| 14 */ | 14 */ |
| 15 function ManagedUserSetPassphraseOverlay() { | 15 function ManagedUserSetPassphraseOverlay() { |
| 16 OptionsPage.call( | 16 OptionsPage.call( |
| 17 this, | 17 this, |
| 18 'setPassphrase', | 18 'setPassphrase', |
| 19 loadTimeData.getString('setPassphraseTitle'), | 19 loadTimeData.getString('setPassphraseTitle'), |
| 20 'managed-user-set-passphrase-overlay'); | 20 'managed-user-set-passphrase-overlay'); |
| 21 } | 21 } |
| 22 | 22 |
| 23 cr.addSingletonGetter(ManagedUserSetPassphraseOverlay); | 23 cr.addSingletonGetter(ManagedUserSetPassphraseOverlay); |
| 24 | 24 |
| 25 /** Closes the page and resets the passphrase fields */ | 25 /** Closes the page and resets the passphrase fields */ |
| 26 var closePage = function(container) { | 26 var closePage = function(container) { |
|
James Hawkins
2013/03/07 18:40:54
Please move this into the prototype so you don't h
Adrian Kuegel
2013/03/08 08:56:34
Done.
| |
| 27 // Reseting the fields directly would lead to a flicker, so listen to | 27 // Reseting the fields directly would lead to a flicker, so listen to |
| 28 // webkitTransitionEnd to clear them after that. Similar to how it is done | 28 // webkitTransitionEnd to clear them after that. Similar to how it is done |
| 29 // in setOverlayVisible_ in options_page.js. | 29 // in setOverlayVisible_ in options_page.js. |
| 30 container.addEventListener('webkitTransitionEnd', function f(e) { | 30 container.addEventListener('webkitTransitionEnd', function f(e) { |
| 31 if (e.target != e.currentTarget || e.propertyName != 'opacity') | 31 if (e.target != e.currentTarget || e.propertyName != 'opacity') |
| 32 return; | 32 return; |
| 33 container.removeEventListener('webkitTransitionEnd', f); | 33 container.removeEventListener('webkitTransitionEnd', f); |
| 34 | 34 |
| 35 // Reset the fields. | 35 // Reset the fields. |
| 36 $('managed-user-passphrase').value = ''; | 36 $('managed-user-passphrase').value = ''; |
| 37 $('passphrase-confirm').value = ''; | 37 $('passphrase-confirm').value = ''; |
| 38 $('passphrase-mismatch').hidden = true; | 38 ManagedUserSetPassphraseOverlay.getInstance().updateDisplay_(); |
| 39 }); | 39 }); |
| 40 OptionsPage.closeOverlay(); | 40 OptionsPage.closeOverlay(); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 ManagedUserSetPassphraseOverlay.prototype = { | 43 ManagedUserSetPassphraseOverlay.prototype = { |
| 44 __proto__: OptionsPage.prototype, | 44 __proto__: OptionsPage.prototype, |
| 45 | 45 |
| 46 /** @override */ | 46 /** @override */ |
| 47 initializePage: function() { | 47 initializePage: function() { |
| 48 OptionsPage.prototype.initializePage.call(this); | 48 OptionsPage.prototype.initializePage.call(this); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 } | 130 } |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 // Export | 133 // Export |
| 134 return { | 134 return { |
| 135 ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay, | 135 ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay, |
| 136 ManagedUserSetPassphraseForTesting: ManagedUserSetPassphraseForTesting | 136 ManagedUserSetPassphraseForTesting: ManagedUserSetPassphraseForTesting |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 }); | 139 }); |
| OLD | NEW |