OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Polymer({ | 5 Polymer({ |
6 is: 'viewer-password-screen', | 6 is: 'viewer-password-screen', |
7 | 7 |
8 properties: { | 8 properties: { |
9 invalid: Boolean, | 9 invalid: Boolean, |
10 | 10 |
11 strings: Object, | 11 strings: Object, |
12 }, | 12 }, |
13 | 13 |
14 get active() { | 14 get active() { |
15 return this.$.dialog.open; | 15 return this.$.dialog.open; |
16 }, | 16 }, |
17 | 17 |
18 show: function() { | 18 show: function() { |
19 this.$.dialog.showModal(); | 19 this.$.dialog.showModal(); |
20 }, | 20 }, |
21 | 21 |
22 close: function() { | 22 close: function() { |
23 if (this.active) | 23 if (this.active) |
24 this.$.dialog.close(); | 24 this.$.dialog.close(); |
25 }, | 25 }, |
26 | 26 |
27 deny: function() { | 27 deny: function() { |
28 this.$.password.disabled = false; | 28 var password = /** @type {!PaperInputElement} */ (this.$.password); |
| 29 password.disabled = false; |
29 this.$.submit.disabled = false; | 30 this.$.submit.disabled = false; |
30 this.invalid = true; | 31 this.invalid = true; |
31 this.$.password.focus(); | 32 password.focus(); |
32 this.$.password.inputElement.select(); | 33 password.inputElement.select(); |
33 }, | 34 }, |
34 | 35 |
35 submit: function() { | 36 submit: function() { |
36 if (this.$.password.value.length == 0) | 37 var password = /** @type {!PaperInputElement} */ (this.$.password); |
| 38 if (password.value.length == 0) |
37 return; | 39 return; |
38 this.$.password.disabled = true; | 40 password.disabled = true; |
39 this.$.submit.disabled = true; | 41 this.$.submit.disabled = true; |
40 this.fire('password-submitted', {password: this.$.password.value}); | 42 this.fire('password-submitted', {password: password.value}); |
41 }, | 43 }, |
42 }); | 44 }); |
OLD | NEW |