| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 * @private | 418 * @private |
| 419 */ | 419 */ |
| 420 onOriginTap_: function(event) { | 420 onOriginTap_: function(event) { |
| 421 this.selectedSite = event.model.item; | 421 this.selectedSite = event.model.item; |
| 422 settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS, | 422 settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS, |
| 423 new URLSearchParams('site=' + this.selectedSite.origin)); | 423 new URLSearchParams('site=' + this.selectedSite.origin)); |
| 424 }, | 424 }, |
| 425 | 425 |
| 426 /** | 426 /** |
| 427 * A handler for activating one of the menu action items. | 427 * A handler for activating one of the menu action items. |
| 428 * @param {!{model: !{item: !{origin: string}}, | 428 * @param {!{model: !{item: !{origin: string}}}} event |
| 429 * detail: !{selected: string}}} event | 429 * @param {string} action The permission to set (Allow, Block, SessionOnly, |
| 430 * etc). |
| 430 * @private | 431 * @private |
| 431 */ | 432 */ |
| 432 onActionMenuIronActivate_: function(event) { | 433 onActionMenuActivate_: function(event, action) { |
| 433 var origin = event.model.item.origin; | 434 var origin = event.model.item.origin; |
| 434 var incognito = event.model.item.incognito; | 435 var incognito = event.model.item.incognito; |
| 435 var embeddingOrigin = event.model.item.embeddingOrigin; | 436 var embeddingOrigin = event.model.item.embeddingOrigin; |
| 436 var action = event.detail.selected; | |
| 437 if (action == settings.PermissionValues.DEFAULT) { | 437 if (action == settings.PermissionValues.DEFAULT) { |
| 438 this.browserProxy.resetCategoryPermissionForOrigin( | 438 this.browserProxy.resetCategoryPermissionForOrigin( |
| 439 origin, embeddingOrigin, this.category, incognito); | 439 origin, embeddingOrigin, this.category, incognito); |
| 440 } else { | 440 } else { |
| 441 this.browserProxy.setCategoryPermissionForOrigin( | 441 this.browserProxy.setCategoryPermissionForOrigin( |
| 442 origin, embeddingOrigin, this.category, action, incognito); | 442 origin, embeddingOrigin, this.category, action, incognito); |
| 443 } | 443 } |
| 444 }, | 444 }, |
| 445 | 445 |
| 446 /** @private */ |
| 447 onAllowTap_: function(event) { |
| 448 this.onActionMenuActivate_(event, settings.PermissionValues.ALLOW); |
| 449 }, |
| 450 |
| 451 /** @private */ |
| 452 onBlockTap_: function(event) { |
| 453 this.onActionMenuActivate_(event, settings.PermissionValues.BLOCK); |
| 454 }, |
| 455 |
| 456 /** @private */ |
| 457 onSessionOnlyTap_: function(event) { |
| 458 this.onActionMenuActivate_(event, settings.PermissionValues.SESSION_ONLY); |
| 459 }, |
| 460 |
| 461 /** @private */ |
| 462 onResetTap_: function(event) { |
| 463 this.onActionMenuActivate_(event, settings.PermissionValues.DEFAULT); |
| 464 }, |
| 465 |
| 446 /** | 466 /** |
| 447 * Returns the appropriate header value for display. | 467 * Returns the appropriate header value for display. |
| 448 * @param {Array<string>} siteList The list of all sites to display for this | 468 * @param {Array<string>} siteList The list of all sites to display for this |
| 449 * category subtype. | 469 * category subtype. |
| 450 * @param {boolean} toggleState The state of the global toggle for this | 470 * @param {boolean} toggleState The state of the global toggle for this |
| 451 * category. | 471 * category. |
| 452 * @private | 472 * @private |
| 453 */ | 473 */ |
| 454 computeSiteListHeader_: function(siteList, toggleState) { | 474 computeSiteListHeader_: function(siteList, toggleState) { |
| 455 var title = ''; | 475 var title = ''; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 // is redundant to also list all the sites that are blocked. | 533 // is redundant to also list all the sites that are blocked. |
| 514 if (this.isAllowList_()) | 534 if (this.isAllowList_()) |
| 515 return true; | 535 return true; |
| 516 | 536 |
| 517 if (this.isSessionOnlyList_()) | 537 if (this.isSessionOnlyList_()) |
| 518 return siteList.length > 0; | 538 return siteList.length > 0; |
| 519 | 539 |
| 520 return toggleState; | 540 return toggleState; |
| 521 }, | 541 }, |
| 522 }); | 542 }); |
| OLD | NEW |