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

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

Issue 2298283002: Site Settings Desktop: Support adding exceptions for incognito mode. (Closed)
Patch Set: Fix test Created 4 years, 3 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 e7ceeed3a5363371a2980eb12ebdfa2e3e22affa..2ee28d4dba2615c41873cc222f6c1ebd246cf386 100644
--- a/chrome/browser/resources/settings/site_settings/add_site_dialog.js
+++ b/chrome/browser/resources/settings/site_settings/add_site_dialog.js
@@ -10,7 +10,7 @@
Polymer({
is: 'add-site-dialog',
- behaviors: [SiteSettingsBehavior],
+ behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
properties: {
/**
@@ -31,7 +31,10 @@ Polymer({
* Block list.
*/
open: function(type) {
+ this.addWebUIListener('onIncognitoStatusChanged',
+ this.onIncognitoStatusChanged_.bind(this));
this.allowException = type == settings.PermissionValues.ALLOW;
+ this.browserProxy.updateIncognitoStatus();
this.$.dialog.showModal();
},
@@ -52,6 +55,19 @@ Polymer({
},
/**
+ * A handler for when we get notified of the current profile creating or
+ * destroying their incognito counterpart.
+ * @param {boolean} incognitoEnabled Whether the current profile has an
+ * incognito profile.
+ * @private
+ */
+ onIncognitoStatusChanged_: function(incognitoEnabled) {
+ this.$.incognito.disabled = !incognitoEnabled;
+ if (!incognitoEnabled)
+ this.$.incognito.checked = false;
+ },
+
+ /**
* The tap handler for the Add [Site] button (adds the pattern and closes
* the dialog).
* @private
@@ -60,9 +76,10 @@ Polymer({
if (this.$.add.disabled)
return; // Can happen when Enter is pressed.
var pattern = this.addPatternWildcard(this.site_);
- this.setCategoryPermissionForOrigin(
+ this.browserProxy.setCategoryPermissionForOrigin(
pattern, pattern, this.category, this.allowException ?
- settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK);
+ settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK,
+ this.$.incognito.checked);
this.$.dialog.close();
},
});

Powered by Google App Engine
This is Rietveld 408576698