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 fc13095d5eec9c815c1c54e713b4f6206a0a0f11..6811e1b6ea128795cef8fab251befde116205e39 100644 |
| --- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js |
| +++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js |
| @@ -15,12 +15,23 @@ Polymer({ |
| is: 'cr-dialog', |
| extends: 'dialog', |
| + properties: { |
| + /** |
| + * True if the dialog should remain open on 'popstate' events. This is used |
| + * for navigable dialogs that have their separate navigation handling code. |
| + */ |
| + disableAutocloseOnPopstate: { |
|
Dan Beam
2016/10/25 01:24:08
nit: ignorePopstate
tommycli
2016/10/25 01:29:33
Done.
|
| + type: Boolean, |
| + value: false, |
| + }, |
| + }, |
| + |
| /** @override */ |
| - created: function() { |
| + ready: function() { |
| // If the active history entry changes (i.e. user clicks back button), |
| // all open dialogs should be cancelled. |
| window.addEventListener('popstate', function() { |
| - if (this.open) |
| + if (!this.disableAutocloseOnPopstate && this.open) |
| this.cancel(); |
| }.bind(this)); |
| }, |