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