Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4981)

Unified Diff: chrome/browser/resources/settings/site_settings/add_site_dialog.js

Issue 2044963003: Site Settings Desktop: Change how adding site exceptions work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3a2c55907da70c8605203b952ccd5d7041be7b57 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();
},
@@ -41,10 +51,13 @@ Polymer({
* the dialog).
* @private
*/
- onAddTap_: function() {
+ onSubmit_: function() {
+ 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();
},
});

Powered by Google App Engine
This is Rietveld 408576698