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 | 55 this.$.permission.value = this.site.setting; |
56 this.browserProxy.getExceptionList(this.category).then( | |
57 function(exceptionList) { | |
58 for (var i = 0; i < exceptionList.length; ++i) { | |
59 if (exceptionList[i].embeddingOrigin == site.embeddingOrigin && | |
60 this.sameOrigin_(exceptionList[i].origin, site.origin)) { | |
61 this.$.permission.value = exceptionList[i].setting; | |
62 break; | |
63 } | |
64 } | |
65 }.bind(this)); | |
66 }, | 56 }, |
67 | 57 |
68 /** | 58 /** |
69 * Called when a site within a category has been changed. | 59 * Called when a site within a category has been changed. |
70 * @param {number} category The category that changed. | 60 * @param {number} category The category that changed. |
71 * @param {string} origin The origin of the site that changed. | 61 * @param {string} origin The origin of the site that changed. |
72 * @param {string} embeddingOrigin The embedding origin of the site that | 62 * @param {string} embeddingOrigin The embedding origin of the site that |
73 * changed. | 63 * changed. |
74 * @private | 64 * @private |
75 */ | 65 */ |
(...skipping 21 matching lines...) Expand all Loading... |
97 /** | 87 /** |
98 * Handles the category permission changing for this origin. | 88 * Handles the category permission changing for this origin. |
99 * @private | 89 * @private |
100 */ | 90 */ |
101 onPermissionSelectionChange_: function() { | 91 onPermissionSelectionChange_: function() { |
102 this.browserProxy.setCategoryPermissionForOrigin( | 92 this.browserProxy.setCategoryPermissionForOrigin( |
103 this.site.origin, this.site.embeddingOrigin, this.category, | 93 this.site.origin, this.site.embeddingOrigin, this.category, |
104 this.$.permission.value, this.site.incognito); | 94 this.$.permission.value, this.site.incognito); |
105 }, | 95 }, |
106 }); | 96 }); |
OLD | NEW |