Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) { |
| 49 this.$.details.hidden = true; | 49 this.$.details.hidden = true; |
| 50 | 50 |
| 51 this.browserProxy.getExceptionList(this.category).then( | 51 this.browserProxy.getExceptionList(this.category).then( |
| 52 function(exceptionList) { | 52 function(exceptionList) { |
| 53 for (var i = 0; i < exceptionList.length; ++i) { | 53 for (var i = 0; i < exceptionList.length; ++i) { |
| 54 if (exceptionList[i].origin == site.origin) { | 54 var origin = this.removePatternWildcard_(exceptionList[i].origin); |
| 55 if (origin == this.removePatternWildcard_(site.origin)) { | |
|
michaelpg
2016/06/02 12:58:30
nit: you could make a comparison function instead
Finnur
2016/06/02 17:31:36
Done.
michaelpg
2016/06/03 13:37:14
Thanks, definitely more readable!
| |
| 55 this.$.permission.selected = exceptionList[i].setting; | 56 this.$.permission.selected = exceptionList[i].setting; |
| 56 this.$.details.hidden = false; | 57 this.$.details.hidden = false; |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 }.bind(this)); | 60 }.bind(this)); |
| 60 }, | 61 }, |
| 61 | 62 |
| 62 /** | 63 /** |
| 63 * Called when a site within a category has been changed. | 64 * Called when a site within a category has been changed. |
| 64 * @param {number} category The category that changed. | 65 * @param {number} category The category that changed. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 89 /** | 90 /** |
| 90 * Handles the category permission changing for this origin. | 91 * Handles the category permission changing for this origin. |
| 91 * @param {!{detail: !{item: !{dataset: !{permissionValue: string}}}}} event | 92 * @param {!{detail: !{item: !{dataset: !{permissionValue: string}}}}} event |
| 92 */ | 93 */ |
| 93 onPermissionMenuIronActivate_: function(event) { | 94 onPermissionMenuIronActivate_: function(event) { |
| 94 var value = event.detail.item.dataset.permissionValue; | 95 var value = event.detail.item.dataset.permissionValue; |
| 95 this.setCategoryPermissionForOrigin( | 96 this.setCategoryPermissionForOrigin( |
| 96 this.site.origin, '', this.category, value); | 97 this.site.origin, '', this.category, value); |
| 97 }, | 98 }, |
| 98 }); | 99 }); |
| OLD | NEW |