| 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-list' shows a list of Allowed and Blocked sites for a given | 7 * 'site-list' shows a list of Allowed and Blocked sites for a given |
| 8 * category. | 8 * category. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 values: { | 102 values: { |
| 103 ALLOW: 'Allow', | 103 ALLOW: 'Allow', |
| 104 BLOCK: 'Block', | 104 BLOCK: 'Block', |
| 105 RESET: 'Reset', | 105 RESET: 'Reset', |
| 106 SESSION_ONLY: 'SessionOnly', | 106 SESSION_ONLY: 'SessionOnly', |
| 107 } | 107 } |
| 108 }, | 108 }, |
| 109 }, | 109 }, |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * The element to return focus to, when the currntly active dialog is closed. | 112 * The element to return focus to, when the currently active dialog is closed. |
| 113 * @private {?HTMLElement} | 113 * @private {?HTMLElement} |
| 114 */ | 114 */ |
| 115 activeDialogAnchor_: null, | 115 activeDialogAnchor_: null, |
| 116 | 116 |
| 117 observers: ['configureWidget_(category, categorySubtype)'], | 117 observers: ['configureWidget_(category, categorySubtype)'], |
| 118 | 118 |
| 119 ready: function() { | 119 ready: function() { |
| 120 this.addWebUIListener('contentSettingSitePermissionChanged', | 120 this.addWebUIListener('contentSettingSitePermissionChanged', |
| 121 this.siteWithinCategoryChanged_.bind(this)); | 121 this.siteWithinCategoryChanged_.bind(this)); |
| 122 this.addWebUIListener('onIncognitoStatusChanged', | 122 this.addWebUIListener('onIncognitoStatusChanged', |
| 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.allSites) | 133 if (category == this.category || this.allSites) |
| 134 this.configureWidget_(); | 134 this.configureWidget_(); |
| 135 }, | 135 }, |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Called for each site list when incognito is enabled or disabled. Only | 138 * Called for each site list when incognito is enabled or disabled. Only |
| 139 * called on change (opening N incogito windows only fires one message). | 139 * called on change (opening N incognito windows only fires one message). |
| 140 * Another message is sent when the *last* incognito window closes. | 140 * Another message is sent when the *last* incognito window closes. |
| 141 * @private | 141 * @private |
| 142 */ | 142 */ |
| 143 onIncognitoStatusChanged_: function() { | 143 onIncognitoStatusChanged_: function() { |
| 144 // The SESSION_ONLY list won't have any incognito exceptions. (Minor | 144 // The SESSION_ONLY list won't have any incognito exceptions. (Minor |
| 145 // optimization, not required). | 145 // optimization, not required). |
| 146 if (this.categorySubtype == settings.PermissionValues.SESSION_ONLY) | 146 if (this.categorySubtype == settings.PermissionValues.SESSION_ONLY) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 // A change notification is not sent for each site. So we repopulate the | 149 // A change notification is not sent for each site. So we repopulate the |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 /** @private */ | 494 /** @private */ |
| 495 closeActionMenu_: function() { | 495 closeActionMenu_: function() { |
| 496 this.actionMenuSite_ = null; | 496 this.actionMenuSite_ = null; |
| 497 this.activeDialogAnchor_ = null; | 497 this.activeDialogAnchor_ = null; |
| 498 var actionMenu = /** @type {!CrActionMenuElement} */ ( | 498 var actionMenu = /** @type {!CrActionMenuElement} */ ( |
| 499 this.$$('dialog[is=cr-action-menu]')); | 499 this.$$('dialog[is=cr-action-menu]')); |
| 500 if (actionMenu.open) | 500 if (actionMenu.open) |
| 501 actionMenu.close(); | 501 actionMenu.close(); |
| 502 }, | 502 }, |
| 503 }); | 503 }); |
| OLD | NEW |