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..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(); |
|
dschuyler
2016/09/01 23:13:49
Optional: does the UI going into the dialog
flicke
Finnur
2016/09/02 15:44:14
No, I haven't noticed that but I'll keep an eye on
|
| 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(); |
| }, |
| }); |