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