Chromium Code Reviews| Index: chrome/browser/resources/settings/site_settings/add_site_dialog.js |
| diff --git a/chrome/browser/resources/settings/site_settings/add_site_dialog.js b/chrome/browser/resources/settings/site_settings/add_site_dialog.js |
| index e00838e4d414cf100f3a5f76e57864c8d45abee0..99f14a9387cd1f64f1829d3a706ecb25aebcb70e 100644 |
| --- a/chrome/browser/resources/settings/site_settings/add_site_dialog.js |
| +++ b/chrome/browser/resources/settings/site_settings/add_site_dialog.js |
| @@ -18,10 +18,20 @@ Polymer({ |
| * @private |
| */ |
| site_: String, |
| + |
| + /** |
| + * Whether this is an allow exception this dialog is adding. |
| + */ |
| + allowException: Boolean, |
| }, |
| - /** Opens the dialog. */ |
| - open: function() { |
| + /** |
| + * Opens the dialog. |
| + * @param {string} type Whether this was launched from an Allow list or a |
| + * Block list. |
| + */ |
| + open: function(type) { |
| + this.allowException = type == settings.PermissionValues.ALLOW; |
| this.$.dialog.open(); |
| }, |
| @@ -37,14 +47,24 @@ Polymer({ |
| }, |
| /** |
| + * Handles Enter key presses for the paper-input. |
| + */ |
|
michaelpg
2016/06/09 17:38:00
@private
Finnur
2016/06/09 21:53:08
Done.
|
| + onEnterPressed_: function(e) { |
| + this.onAddTap_(); |
| + }, |
| + |
| + /** |
| * The tap handler for the Add [Site] button (adds the pattern and closes |
| * the dialog). |
| * @private |
| */ |
| onAddTap_: function() { |
|
michaelpg
2016/06/09 17:38:00
maybe rename "onSubmit_" or something, and make bo
Finnur
2016/06/09 21:53:08
Renamed. But... both HTML events? I presume you me
michaelpg
2016/06/09 22:31:05
I meant to additionally change
on-keys-pressed=
|
| + if (this.$.add.disabled) |
| + return; // Can happen when Enter is pressed. |
| var pattern = this.addPatternWildcard_(this.site_); |
| this.setCategoryPermissionForOrigin( |
| - pattern, '', this.category, settings.PermissionValues.ALLOW); |
| + pattern, '', this.category, this.allowException ? |
| + settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK); |
| this.$.dialog.close(); |
| }, |
| }); |