| 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 * Enumeration mapping all possible controlled-by values for exceptions to | 6 * Enumeration mapping all possible controlled-by values for exceptions to |
| 7 * icons. | 7 * icons. |
| 8 * @enum {string} | 8 * @enum {string} |
| 9 */ | 9 */ |
| 10 var iconControlledBy = { | 10 var iconControlledBy = { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 this.onIncognitoStatusChanged_.bind(this)); | 123 this.onIncognitoStatusChanged_.bind(this)); |
| 124 }, | 124 }, |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * Called when a site changes permission. | 127 * Called when a site changes permission. |
| 128 * @param {string} category The category of the site that changed. | 128 * @param {string} category The category of the site that changed. |
| 129 * @param {string} site The site that changed. | 129 * @param {string} site The site that changed. |
| 130 * @private | 130 * @private |
| 131 */ | 131 */ |
| 132 siteWithinCategoryChanged_: function(category, site) { | 132 siteWithinCategoryChanged_: function(category, site) { |
| 133 if (category == this.category || this.category == settings.ALL_SITES) | 133 if (category == this.category || this.allSites) |
| 134 this.configureWidget_(); | 134 this.configureWidget_(); |
| 135 }, | 135 }, |
| 136 | 136 |
| 137 onIncognitoStatusChanged_: function(incognitoEnabled) { | 137 onIncognitoStatusChanged_: function(incognitoEnabled) { |
| 138 // A change notification is not sent for each site that is deleted during | 138 // A change notification is not sent for each site that is deleted during |
| 139 // incognito profile destruction. Therefore, we reconfigure the list when | 139 // incognito profile destruction. Therefore, we reconfigure the list when |
| 140 // the incognito profile is destroyed, except for SESSION_ONLY, which won't | 140 // the incognito profile is destroyed, except for SESSION_ONLY, which won't |
| 141 // have any incognito exceptions. | 141 // have any incognito exceptions. |
| 142 if (this.categorySubtype == settings.PermissionValues.SESSION_ONLY) | 142 if (this.categorySubtype == settings.PermissionValues.SESSION_ONLY) |
| 143 return; | 143 return; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 }, | 198 }, |
| 199 | 199 |
| 200 /** | 200 /** |
| 201 * Returns which icon, if any, should represent the fact that this exception | 201 * Returns which icon, if any, should represent the fact that this exception |
| 202 * is controlled. | 202 * is controlled. |
| 203 * @param {!SiteException} item The item from the list we're computing the | 203 * @param {!SiteException} item The item from the list we're computing the |
| 204 * icon for. | 204 * icon for. |
| 205 * @return {string} The icon to show (or blank, if none). | 205 * @return {string} The icon to show (or blank, if none). |
| 206 */ | 206 */ |
| 207 computeIconControlledBy_: function(item) { | 207 computeIconControlledBy_: function(item) { |
| 208 if (this.allSites) |
| 209 return ''; |
| 208 return iconControlledBy[item.source] || ''; | 210 return iconControlledBy[item.source] || ''; |
| 209 }, | 211 }, |
| 210 | 212 |
| 211 /** | 213 /** |
| 212 * @param {string} source Where the setting came from. | 214 * @param {string} source Where the setting came from. |
| 213 * @return {boolean} | 215 * @return {boolean} |
| 214 * @private | 216 * @private |
| 215 */ | 217 */ |
| 216 shouldShowMenu_: function(source) { | 218 shouldShowMenu_: function(source) { |
| 217 return !(this.isExceptionControlled_(source) || this.allSites); | 219 return !(this.isExceptionControlled_(source) || this.allSites); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 /** | 315 /** |
| 314 * Appends to |list| the sites for a given category and subtype. | 316 * Appends to |list| the sites for a given category and subtype. |
| 315 * @param {!Array<SiteException>} sites The site list to add to. | 317 * @param {!Array<SiteException>} sites The site list to add to. |
| 316 * @param {!Array<SiteException>} exceptionList List of sites (exceptions) to | 318 * @param {!Array<SiteException>} exceptionList List of sites (exceptions) to |
| 317 * add. | 319 * add. |
| 318 * @return {!Array<SiteException>} The list of sites. | 320 * @return {!Array<SiteException>} The list of sites. |
| 319 * @private | 321 * @private |
| 320 */ | 322 */ |
| 321 appendSiteList_: function(sites, exceptionList) { | 323 appendSiteList_: function(sites, exceptionList) { |
| 322 for (var i = 0; i < exceptionList.length; ++i) { | 324 for (var i = 0; i < exceptionList.length; ++i) { |
| 323 if (this.category != settings.ALL_SITES) { | 325 if (!this.allSites) { |
| 324 if (exceptionList[i].setting == settings.PermissionValues.DEFAULT) | 326 if (exceptionList[i].setting == settings.PermissionValues.DEFAULT) |
| 325 continue; | 327 continue; |
| 326 | 328 |
| 327 if (exceptionList[i].setting != this.categorySubtype) | 329 if (exceptionList[i].setting != this.categorySubtype) |
| 328 continue; | 330 continue; |
| 329 } | 331 } |
| 330 | 332 |
| 331 sites.push(exceptionList[i]); | 333 sites.push(exceptionList[i]); |
| 332 } | 334 } |
| 333 return sites; | 335 return sites; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // is redundant to also list all the sites that are blocked. | 513 // is redundant to also list all the sites that are blocked. |
| 512 if (this.isAllowList_()) | 514 if (this.isAllowList_()) |
| 513 return true; | 515 return true; |
| 514 | 516 |
| 515 if (this.isSessionOnlyList_()) | 517 if (this.isSessionOnlyList_()) |
| 516 return siteList.length > 0; | 518 return siteList.length > 0; |
| 517 | 519 |
| 518 return toggleState; | 520 return toggleState; |
| 519 }, | 521 }, |
| 520 }); | 522 }); |
| OLD | NEW |