Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js |
| diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js |
| index 9c9d73fdb7eeaf95bb10574131a0d56d354a5b8b..058e914c0ddb16d556c001f74523cc9f44db3379 100644 |
| --- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js |
| +++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js |
| @@ -3,43 +3,30 @@ |
| // found in the LICENSE file. |
| /** |
| - * @fileoverview 'cr-dialog' is a component for showing a modal dialog. |
| + * @fileoverview 'cr-dialog' is a component for showing a modal dialog. If the |
| + * dialog is closed via close(), a 'close' event is fired. If the dialog is |
| + * canceled via cancel(), a 'cancel' event is fired followed by a 'close' event. |
| + * Additionally clients can inspect the dialog's |returnValue| property inisde |
|
Dan Beam
2016/07/26 23:36:12
inisde -> inside
dpapad
2016/07/27 01:21:47
Done.
|
| + * the 'close' callback to determine whether it was canceled or just closed, |
| + * where a truthy value means it was not canceled, and a falsy value means it |
|
Dan Beam
2016/07/26 23:36:12
where a truthy value means success, and a falsy va
dpapad
2016/07/27 01:21:47
Done.
|
| + * was canceled. |
| */ |
| Polymer({ |
| is: 'cr-dialog', |
| + extends: 'dialog', |
| - properties: { |
| - /** @override */ |
| - noCancelOnOutsideClick: { |
| - type: Boolean, |
| - value: true, |
| - }, |
| - |
| - /** @override */ |
| - noCancelOnEscKey: { |
| - type: Boolean, |
| - value: false, |
| - }, |
| - |
| - /** |
| - * @type {!Element} |
| - * @override |
| - */ |
| - sizingTarget: { |
| - type: Element, |
| - value: function() { |
| - return assert(this.$$('.body-container')); |
| - }, |
| - }, |
| - |
| - /** @override */ |
| - withBackdrop: { |
| - type: Boolean, |
| - value: true, |
| - }, |
| + cancel: function() { |
| + this.fire('cancel'); |
| + HTMLDialogElement.prototype.close.call(this); |
| }, |
| - behaviors: [Polymer.PaperDialogBehavior], |
| + /** |
| + * @param {string=} opt_returnValue |
| + * @override |
| + */ |
| + close: function(opt_returnValue) { |
| + HTMLDialogElement.prototype.close.call(this, 'success'); |
| + }, |
| /** @return {!PaperIconButtonElement} */ |
| getCloseButton: function() { |