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 'cr-dialog' is a component for showing a modal dialog. | 6 * @fileoverview 'cr-dialog' is a component for showing a modal dialog. If the |
| 7 * dialog is closed via close(), a 'close' event is fired. If the dialog is |
| 8 * canceled via cancel(), a 'cancel' event is fired followed by a 'close' event. |
7 */ | 9 */ |
8 Polymer({ | 10 Polymer({ |
9 is: 'cr-dialog', | 11 is: 'cr-dialog', |
| 12 extends: 'dialog', |
10 | 13 |
11 properties: { | 14 cancel: function() { |
12 /** @override */ | 15 this.fire('cancel'); |
13 noCancelOnOutsideClick: { | 16 HTMLDialogElement.prototype.close.call(this, /* wasCanceled */ 'true'); |
14 type: Boolean, | |
15 value: true, | |
16 }, | |
17 | |
18 /** @override */ | |
19 noCancelOnEscKey: { | |
20 type: Boolean, | |
21 value: false, | |
22 }, | |
23 | |
24 /** | |
25 * @type {!Element} | |
26 * @override | |
27 */ | |
28 sizingTarget: { | |
29 type: Element, | |
30 value: function() { | |
31 return assert(this.$$('.body-container')); | |
32 }, | |
33 }, | |
34 | |
35 /** @override */ | |
36 withBackdrop: { | |
37 type: Boolean, | |
38 value: true, | |
39 }, | |
40 }, | 17 }, |
41 | 18 |
42 behaviors: [Polymer.PaperDialogBehavior], | |
43 | |
44 /** @return {!PaperIconButtonElement} */ | 19 /** @return {!PaperIconButtonElement} */ |
45 getCloseButton: function() { | 20 getCloseButton: function() { |
46 return this.$.close; | 21 return this.$.close; |
47 }, | 22 }, |
48 }); | 23 }); |
OLD | NEW |