| 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 26 matching lines...) Expand all Loading... |
| 37 assert(this.category); | 37 assert(this.category); |
| 38 assert(this.contentSetting); | 38 assert(this.contentSetting); |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Opens the dialog. | 42 * Opens the dialog. |
| 43 * @param {string} type Whether this was launched from an Allow list or a | 43 * @param {string} type Whether this was launched from an Allow list or a |
| 44 * Block list. | 44 * Block list. |
| 45 */ | 45 */ |
| 46 open: function(type) { | 46 open: function(type) { |
| 47 this.addWebUIListener('onIncognitoStatusChanged', | 47 this.addWebUIListener( |
| 48 this.onIncognitoStatusChanged_.bind(this)); | 48 'onIncognitoStatusChanged', this.onIncognitoStatusChanged_.bind(this)); |
| 49 this.browserProxy.updateIncognitoStatus(); | 49 this.browserProxy.updateIncognitoStatus(); |
| 50 this.$.dialog.showModal(); | 50 this.$.dialog.showModal(); |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Validates that the pattern entered is valid. | 54 * Validates that the pattern entered is valid. |
| 55 * @private | 55 * @private |
| 56 */ | 56 */ |
| 57 validate_: function() { | 57 validate_: function() { |
| 58 this.browserProxy.isPatternValid(this.site_).then(function(isValid) { | 58 this.browserProxy.isPatternValid(this.site_).then(function(isValid) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 onSubmit_: function() { | 86 onSubmit_: function() { |
| 87 if (this.$.add.disabled) | 87 if (this.$.add.disabled) |
| 88 return; // Can happen when Enter is pressed. | 88 return; // Can happen when Enter is pressed. |
| 89 var pattern = this.addPatternWildcard(this.site_); | 89 var pattern = this.addPatternWildcard(this.site_); |
| 90 this.browserProxy.setCategoryPermissionForOrigin( | 90 this.browserProxy.setCategoryPermissionForOrigin( |
| 91 pattern, pattern, this.category, this.contentSetting, | 91 pattern, pattern, this.category, this.contentSetting, |
| 92 this.$.incognito.checked); | 92 this.$.incognito.checked); |
| 93 this.$.dialog.close(); | 93 this.$.dialog.close(); |
| 94 }, | 94 }, |
| 95 }); | 95 }); |
| OLD | NEW |