| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'add-site-dialog' provides a dialog to add exceptions for a given Content | 7 * 'add-site-dialog' provides a dialog to add exceptions for a given Content |
| 8 * Settings category. | 8 * Settings category. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 assert(this.category); | 40 assert(this.category); |
| 41 assert(this.contentSetting); | 41 assert(this.contentSetting); |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Opens the dialog. | 45 * Opens the dialog. |
| 46 * @param {string} type Whether this was launched from an Allow list or a | 46 * @param {string} type Whether this was launched from an Allow list or a |
| 47 * Block list. | 47 * Block list. |
| 48 */ | 48 */ |
| 49 open: function(type) { | 49 open: function(type) { |
| 50 this.addWebUIListener('onIncognitoStatusChanged', function(isActive) { | 50 this.addWebUIListener('onIncognitoStatusChanged', function(hasIncognito) { |
| 51 this.showIncognitoSessionOnly_ = isActive && | 51 this.$.incognito.checked = false; |
| 52 this.showIncognitoSessionOnly_ = hasIncognito && |
| 52 this.contentSetting != settings.PermissionValues.SESSION_ONLY; | 53 this.contentSetting != settings.PermissionValues.SESSION_ONLY; |
| 53 }.bind(this)); | 54 }.bind(this)); |
| 54 this.browserProxy.updateIncognitoStatus(); | 55 this.browserProxy.updateIncognitoStatus(); |
| 55 this.$.dialog.showModal(); | 56 this.$.dialog.showModal(); |
| 56 }, | 57 }, |
| 57 | 58 |
| 58 /** | 59 /** |
| 59 * Validates that the pattern entered is valid. | 60 * Validates that the pattern entered is valid. |
| 60 * @private | 61 * @private |
| 61 */ | 62 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 86 */ | 87 */ |
| 87 onSubmit_: function() { | 88 onSubmit_: function() { |
| 88 if (this.$.add.disabled) | 89 if (this.$.add.disabled) |
| 89 return; // Can happen when Enter is pressed. | 90 return; // Can happen when Enter is pressed. |
| 90 this.browserProxy.setCategoryPermissionForOrigin( | 91 this.browserProxy.setCategoryPermissionForOrigin( |
| 91 this.site_, this.site_, this.category, this.contentSetting, | 92 this.site_, this.site_, this.category, this.contentSetting, |
| 92 this.$.incognito.checked); | 93 this.$.incognito.checked); |
| 93 this.$.dialog.close(); | 94 this.$.dialog.close(); |
| 94 }, | 95 }, |
| 95 }); | 96 }); |
| OLD | NEW |