| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 isCookiesCategory_: function(category) { | 45 isCookiesCategory_: function(category) { |
| 46 return category == settings.ContentSettingsTypes.COOKIES; | 46 return category == settings.ContentSettingsTypes.COOKIES; |
| 47 }, | 47 }, |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Sets the site to display. | 50 * Sets the site to display. |
| 51 * @param {!SiteException} site The site to display. | 51 * @param {!SiteException} site The site to display. |
| 52 * @private | 52 * @private |
| 53 */ | 53 */ |
| 54 siteChanged_: function(site) { | 54 siteChanged_: function(site) { |
| 55 this.$.details.hidden = true; | |
| 56 | 55 |
| 57 this.browserProxy.getExceptionList(this.category).then( | 56 this.browserProxy.getExceptionList(this.category).then( |
| 58 function(exceptionList) { | 57 function(exceptionList) { |
| 59 for (var i = 0; i < exceptionList.length; ++i) { | 58 for (var i = 0; i < exceptionList.length; ++i) { |
| 60 if (exceptionList[i].embeddingOrigin == site.embeddingOrigin && | 59 if (exceptionList[i].embeddingOrigin == site.embeddingOrigin && |
| 61 this.sameOrigin_(exceptionList[i].origin, site.origin)) { | 60 this.sameOrigin_(exceptionList[i].origin, site.origin)) { |
| 62 this.$.permission.value = exceptionList[i].setting; | 61 this.$.permission.value = exceptionList[i].setting; |
| 63 this.$.details.hidden = false; | |
| 64 break; | 62 break; |
| 65 } | 63 } |
| 66 } | 64 } |
| 67 }.bind(this)); | 65 }.bind(this)); |
| 68 }, | 66 }, |
| 69 | 67 |
| 70 /** | 68 /** |
| 71 * Called when a site within a category has been changed. | 69 * Called when a site within a category has been changed. |
| 72 * @param {number} category The category that changed. | 70 * @param {number} category The category that changed. |
| 73 * @param {string} origin The origin of the site that changed. | 71 * @param {string} origin The origin of the site that changed. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 87 } | 85 } |
| 88 }, | 86 }, |
| 89 | 87 |
| 90 /** | 88 /** |
| 91 * Resets the category permission for this origin. | 89 * Resets the category permission for this origin. |
| 92 */ | 90 */ |
| 93 resetPermission: function() { | 91 resetPermission: function() { |
| 94 this.browserProxy.resetCategoryPermissionForOrigin( | 92 this.browserProxy.resetCategoryPermissionForOrigin( |
| 95 this.site.origin, this.site.embeddingOrigin, this.category, | 93 this.site.origin, this.site.embeddingOrigin, this.category, |
| 96 this.site.incognito); | 94 this.site.incognito); |
| 97 this.$.details.hidden = true; | |
| 98 }, | 95 }, |
| 99 | 96 |
| 100 /** | 97 /** |
| 101 * Handles the category permission changing for this origin. | 98 * Handles the category permission changing for this origin. |
| 102 * @private | 99 * @private |
| 103 */ | 100 */ |
| 104 onPermissionSelectionChange_: function() { | 101 onPermissionSelectionChange_: function() { |
| 105 this.browserProxy.setCategoryPermissionForOrigin( | 102 this.browserProxy.setCategoryPermissionForOrigin( |
| 106 this.site.origin, this.site.embeddingOrigin, this.category, | 103 this.site.origin, this.site.embeddingOrigin, this.category, |
| 107 this.$.permission.value, this.site.incognito); | 104 this.$.permission.value, this.site.incognito); |
| 108 }, | 105 }, |
| 109 }); | 106 }); |
| OLD | NEW |