Index: chrome/browser/resources/options/managed_user_set_passphrase.js |
diff --git a/chrome/browser/resources/options/managed_user_set_passphrase.js b/chrome/browser/resources/options/managed_user_set_passphrase.js |
index 930cfcc0523a26e8f9abf5661ff7ded4af67da91..bfb8502b8504d2ee84aaf1d8d6d30752c4ce2de0 100644 |
--- a/chrome/browser/resources/options/managed_user_set_passphrase.js |
+++ b/chrome/browser/resources/options/managed_user_set_passphrase.js |
@@ -22,24 +22,6 @@ cr.define('options', function() { |
cr.addSingletonGetter(ManagedUserSetPassphraseOverlay); |
- /** Closes the page and resets the passphrase fields */ |
- var closePage = function(container) { |
- // Reseting the fields directly would lead to a flicker, so listen to |
- // webkitTransitionEnd to clear them after that. Similar to how it is done |
- // in setOverlayVisible_ in options_page.js. |
- container.addEventListener('webkitTransitionEnd', function f(e) { |
- if (e.target != e.currentTarget || e.propertyName != 'opacity') |
- return; |
- container.removeEventListener('webkitTransitionEnd', f); |
- |
- // Reset the fields. |
- $('managed-user-passphrase').value = ''; |
- $('passphrase-confirm').value = ''; |
- $('passphrase-mismatch').hidden = true; |
- }); |
- OptionsPage.closeOverlay(); |
- }; |
- |
ManagedUserSetPassphraseOverlay.prototype = { |
__proto__: OptionsPage.prototype, |
@@ -71,7 +53,7 @@ cr.define('options', function() { |
}; |
$('cancel-passphrase').onclick = function(event) { |
- closePage(self.container); |
+ self.closePage(); |
}; |
}, |
@@ -92,7 +74,7 @@ cr.define('options', function() { |
*/ |
setPassphrase_: function(event) { |
chrome.send('setPassphrase', [$('managed-user-passphrase').value]); |
- closePage(this.container); |
+ this.closePage(); |
}, |
/** @override */ |
@@ -110,7 +92,26 @@ cr.define('options', function() { |
* Make sure that we reset the fields on cancel. |
*/ |
handleCancel: function() { |
- closePage(this.container); |
+ this.closePage(); |
+ }, |
+ |
+ /** Closes the page and resets the passphrase fields */ |
+ closePage: function() { |
+ // Reseting the fields directly would lead to a flicker, so listen to |
+ // webkitTransitionEnd to clear them after that. Similar to how it is done |
+ // in setOverlayVisible_ in options_page.js. |
+ var self = this; |
+ this.container.addEventListener('webkitTransitionEnd', function f(e) { |
+ if (e.target != e.currentTarget || e.propertyName != 'opacity') |
+ return; |
+ self.container.removeEventListener('webkitTransitionEnd', f); |
+ |
+ // Reset the fields. |
+ $('managed-user-passphrase').value = ''; |
+ $('passphrase-confirm').value = ''; |
+ self.updateDisplay_(); |
+ }); |
+ OptionsPage.closeOverlay(); |
} |
}; |