OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
6 * @fileoverview 'error-dialog' is a popup dialog that displays error messages | 6 * @fileoverview 'error-dialog' is a dialog that displays error messages |
7 * in the user manager. | 7 * in the user manager. |
8 */ | 8 */ |
9 (function() { | 9 (function() { |
10 Polymer({ | 10 Polymer({ |
11 is: 'error-dialog', | 11 is: 'error-dialog', |
12 | 12 |
13 properties: { | 13 properties: { |
14 /** | 14 /** |
15 * True if the element is currently hidden. | |
16 * @private {boolean} | |
17 */ | |
18 popupHidden_: { | |
19 type: Boolean, | |
20 value: true | |
21 }, | |
22 | |
23 /** | |
24 * The message shown in the dialog. | 15 * The message shown in the dialog. |
25 * @private {string} | 16 * @private {string} |
26 */ | 17 */ |
27 message_: { | 18 message_: { |
28 type: String, | 19 type: String, |
29 value: '' | 20 value: '' |
30 } | 21 } |
31 }, | 22 }, |
32 | 23 |
33 /** | 24 /** |
34 * Displays the popup populated with the given message. | 25 * Displays the dialog populated with the given message. |
35 * @param {string} message Error message to show. | 26 * @param {string} message Error message to show. |
36 */ | 27 */ |
37 show: function(message) { | 28 show: function(message) { |
38 this.message_ = message; | 29 this.message_ = message; |
39 this.popupHidden_ = false; | 30 this.$.dialog.open(); |
40 | |
41 this.async(function() { | |
42 this.$$('paper-icon-button').focus(); | |
43 }.bind(this)); | |
44 }, | |
45 | |
46 /** | |
47 * Hides the popup. | |
48 * @private | |
49 */ | |
50 onCloseTap_: function() { | |
51 this.popupHidden_ = true; | |
52 } | 31 } |
53 }); | 32 }); |
54 })(); | 33 })(); |
OLD | NEW |