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 e7ceeed3a5363371a2980eb12ebdfa2e3e22affa..bec0645b734b62d781378f6a49048567de44ea82 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(); |
| }, |
| @@ -60,9 +63,23 @@ 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(); |
| }, |
| + |
| + /** |
| + * 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 |
| + */ |
|
dschuyler
2016/08/31 21:48:52
nit: This function could sort alphabetically
above
Finnur
2016/09/01 11:10:15
Done.
|
| + onIncognitoStatusChanged_: function(incognitoEnabled) { |
| + this.$.incognito.disabled = !incognitoEnabled; |
| + if (!incognitoEnabled) |
| + this.$.incognito.checked = false; |
| + }, |
| }); |