| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * 'site-details-permission' handles showing the state of one permission, such | 7 * 'site-details-permission' handles showing the state of one permission, such |
| 8 * as Geolocation, for a given origin. | 8 * as Geolocation, for a given origin. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 blockAction: loadTimeData.getString('siteSettingsActionBlock'), | 28 blockAction: loadTimeData.getString('siteSettingsActionBlock'), |
| 29 }; | 29 }; |
| 30 }, | 30 }, |
| 31 }, | 31 }, |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 observers: ['siteChanged_(site, category)'], | 34 observers: ['siteChanged_(site, category)'], |
| 35 | 35 |
| 36 /** @override */ | 36 /** @override */ |
| 37 attached: function() { | 37 attached: function() { |
| 38 this.PermissionStringValues = settings.PermissionStringValues; | 38 this.PermissionValues = settings.PermissionValues; |
| 39 this.addWebUIListener('contentSettingSitePermissionChanged', | 39 this.addWebUIListener('contentSettingSitePermissionChanged', |
| 40 this.sitePermissionChanged_.bind(this)); | 40 this.sitePermissionChanged_.bind(this)); |
| 41 }, | 41 }, |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Sets the site to display. | 44 * Sets the site to display. |
| 45 * @param {!SiteException} site The site to display. | 45 * @param {!SiteException} site The site to display. |
| 46 * @private | 46 * @private |
| 47 */ | 47 */ |
| 48 siteChanged_: function(site) { | 48 siteChanged_: function(site) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 /** | 81 /** |
| 82 * Resets the category permission for this origin. | 82 * Resets the category permission for this origin. |
| 83 */ | 83 */ |
| 84 resetPermission: function() { | 84 resetPermission: function() { |
| 85 this.resetCategoryPermissionForOrigin(this.site.origin, '', this.category); | 85 this.resetCategoryPermissionForOrigin(this.site.origin, '', this.category); |
| 86 this.$.details.hidden = true; | 86 this.$.details.hidden = true; |
| 87 }, | 87 }, |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Handles the category permission changing for this origin. | 90 * Handles the category permission changing for this origin. |
| 91 * @param {!{detail: !{item: !{innerText: string}}}} event | 91 * @param {!{detail: !{item: !{dataset: !{permissionValue: string}}}}} event |
| 92 */ | 92 */ |
| 93 onPermissionMenuIronActivate_: function(event) { | 93 onPermissionMenuIronActivate_: function(event) { |
| 94 var action = event.detail.item.dataset.permissionValue; | 94 var value = event.detail.item.dataset.permissionValue; |
| 95 var value = ''; | |
| 96 if (action == settings.PermissionStringValues.ALLOW) | |
| 97 value = settings.PermissionValues.ALLOW; | |
| 98 else if (action == settings.PermissionStringValues.BLOCK) | |
| 99 value = settings.PermissionValues.BLOCK; | |
| 100 else | |
| 101 assertNotReached('Invalid menu item ' + action); | |
| 102 | |
| 103 this.setCategoryPermissionForOrigin( | 95 this.setCategoryPermissionForOrigin( |
| 104 this.site.origin, '', value, this.category); | 96 this.site.origin, '', this.category, value); |
| 105 }, | 97 }, |
| 106 }); | 98 }); |
| OLD | NEW |