| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium OS Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * @suppress {globalThis|missingProperties} | |
| 8 */ | |
| 9 | |
| 10 Polymer({ | |
| 11 i18n: function(name) { | |
| 12 // For tests, chrome.i18n API is not available. | |
| 13 return chrome.i18n ? chrome.i18n.getMessage(name) : name; | |
| 14 }, | |
| 15 | |
| 16 cancel: function() { | |
| 17 window.close(); | |
| 18 }, | |
| 19 | |
| 20 accept: function() { | |
| 21 window.onPassphraseSuccess(this.$.input.value, this.$.remember.checked); | |
| 22 window.close(); | |
| 23 }, | |
| 24 | |
| 25 ready: function() { | |
| 26 document.addEventListener('keydown', function(event) { | |
| 27 if (event.keyCode == 13) // Enter | |
| 28 this.$.acceptButton.click(); | |
| 29 | |
| 30 if (event.keyCode == 27) // Escape | |
| 31 this.$.cancelButton.click(); | |
| 32 }.bind(this)); | |
| 33 | |
| 34 // Show the window once ready. Not available for tests. | |
| 35 if (chrome.app && chrome.app.window) | |
| 36 chrome.app.window.current().show(); | |
| 37 | |
| 38 if (window.onEverythingLoaded) | |
| 39 window.onEverythingLoaded(); | |
| 40 } | |
| 41 }); | |
| OLD | NEW |