Chromium Code Reviews| 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({ |
| 11 is: 'add-site-dialog', | 11 is: 'add-site-dialog', |
| 12 | 12 |
| 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], | 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], |
| 14 | 14 |
| 15 properties: { | 15 properties: { |
| 16 /** | 16 /** |
| 17 * Whether this is an allow exception this dialog is adding. | |
| 18 */ | |
| 19 allowException: Boolean, | |
|
dpapad
2016/11/07 21:59:35
This was used when calling browserProxy.setCategor
dschuyler
2016/11/07 23:54:04
Done.
| |
| 20 | |
| 21 contentSetting: String, | |
|
dpapad
2016/11/07 21:59:35
Can you add a comment explaining what does this me
dschuyler
2016/11/07 23:54:04
Done.
| |
| 22 | |
| 23 /** | |
| 17 * The site to add an exception for. | 24 * The site to add an exception for. |
| 18 * @private | 25 * @private |
| 19 */ | 26 */ |
| 20 site_: String, | 27 site_: String, |
| 21 | |
| 22 /** | |
| 23 * Whether this is an allow exception this dialog is adding. | |
| 24 */ | |
| 25 allowException: Boolean, | |
| 26 }, | 28 }, |
| 27 | 29 |
| 28 /** | 30 /** |
| 29 * Opens the dialog. | 31 * Opens the dialog. |
| 30 * @param {string} type Whether this was launched from an Allow list or a | 32 * @param {string} type Whether this was launched from an Allow list or a |
| 31 * Block list. | 33 * Block list. |
| 32 */ | 34 */ |
| 33 open: function(type) { | 35 open: function(type) { |
| 34 this.addWebUIListener('onIncognitoStatusChanged', | 36 this.addWebUIListener('onIncognitoStatusChanged', |
| 35 this.onIncognitoStatusChanged_.bind(this)); | 37 this.onIncognitoStatusChanged_.bind(this)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 /** | 71 /** |
| 70 * The tap handler for the Add [Site] button (adds the pattern and closes | 72 * The tap handler for the Add [Site] button (adds the pattern and closes |
| 71 * the dialog). | 73 * the dialog). |
| 72 * @private | 74 * @private |
| 73 */ | 75 */ |
| 74 onSubmit_: function() { | 76 onSubmit_: function() { |
| 75 if (this.$.add.disabled) | 77 if (this.$.add.disabled) |
| 76 return; // Can happen when Enter is pressed. | 78 return; // Can happen when Enter is pressed. |
| 77 var pattern = this.addPatternWildcard(this.site_); | 79 var pattern = this.addPatternWildcard(this.site_); |
| 78 this.browserProxy.setCategoryPermissionForOrigin( | 80 this.browserProxy.setCategoryPermissionForOrigin( |
| 79 pattern, pattern, this.category, this.allowException ? | 81 pattern, pattern, this.category, this.contentSetting, |
|
dpapad
2016/11/07 21:59:35
Are we assuming that |contentSettings| has been po
dschuyler
2016/11/07 23:54:04
I added asserts in attached so that they would be
| |
| 80 settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK, | |
| 81 this.$.incognito.checked); | 82 this.$.incognito.checked); |
| 82 this.$.dialog.close(); | 83 this.$.dialog.close(); |
| 83 }, | 84 }, |
| 84 }); | 85 }); |
| OLD | NEW |