| 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({ |
| 11 is: 'site-details-permission', | 11 is: 'site-details-permission', |
| 12 | 12 |
| 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], | 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], |
| 14 | 14 |
| 15 properties: { | 15 properties: { |
| 16 /** | 16 /** |
| 17 * The site that this widget is showing details for. | 17 * The site that this widget is showing details for. |
| 18 * @type {SiteException} | 18 * @type {SiteException} |
| 19 */ | 19 */ |
| 20 site: { | 20 site: Object, |
| 21 type: Object, | |
| 22 observer: 'siteChanged_', | |
| 23 }, | |
| 24 | 21 |
| 25 i18n_: { | 22 i18n_: { |
| 26 readOnly: true, | 23 readOnly: true, |
| 27 type: Object, | 24 type: Object, |
| 28 value: function() { | 25 value: function() { |
| 29 return { | 26 return { |
| 30 allowAction: loadTimeData.getString('siteSettingsActionAllow'), | 27 allowAction: loadTimeData.getString('siteSettingsActionAllow'), |
| 31 blockAction: loadTimeData.getString('siteSettingsActionBlock'), | 28 blockAction: loadTimeData.getString('siteSettingsActionBlock'), |
| 32 }; | 29 }; |
| 33 }, | 30 }, |
| 34 }, | 31 }, |
| 35 }, | 32 }, |
| 36 | 33 |
| 34 observers: ['siteChanged_(site, category)'], |
| 35 |
| 37 /** @override */ | 36 /** @override */ |
| 38 attached: function() { | 37 attached: function() { |
| 39 this.addWebUIListener('contentSettingSitePermissionChanged', | 38 this.addWebUIListener('contentSettingSitePermissionChanged', |
| 40 this.sitePermissionChanged_.bind(this)); | 39 this.sitePermissionChanged_.bind(this)); |
| 41 }, | 40 }, |
| 42 | 41 |
| 43 /** | 42 /** |
| 44 * Sets the site to display. | 43 * Sets the site to display. |
| 45 * @param {!SiteException} site The site to display. | 44 * @param {!SiteException} site The site to display. |
| 46 * @private | 45 * @private |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // TODO(finnur): Compare with event.detail.item.dataset.permission directly | 94 // TODO(finnur): Compare with event.detail.item.dataset.permission directly |
| 96 // once attrForSelected is in use. | 95 // once attrForSelected is in use. |
| 97 var action = event.detail.item.innerText; | 96 var action = event.detail.item.innerText; |
| 98 var value = (action == this.i18n_.allowAction) ? | 97 var value = (action == this.i18n_.allowAction) ? |
| 99 settings.PermissionValues.ALLOW : | 98 settings.PermissionValues.ALLOW : |
| 100 settings.PermissionValues.BLOCK; | 99 settings.PermissionValues.BLOCK; |
| 101 this.setCategoryPermissionForOrigin( | 100 this.setCategoryPermissionForOrigin( |
| 102 this.site.origin, '', value, this.category); | 101 this.site.origin, '', value, this.category); |
| 103 }, | 102 }, |
| 104 }); | 103 }); |
| OLD | NEW |