| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 * @implements {UI.ListWidget.Delegate} | 5 * @implements {UI.ListWidget.Delegate} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Network.BlockedURLsPane = class extends UI.VBox { | 8 Network.BlockedURLsPane = class extends UI.VBox { |
| 9 constructor() { | 9 constructor() { |
| 10 super(true); | 10 super(true); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 _removeAll() { | 169 _removeAll() { |
| 170 this._manager.setBlockedPatterns([]); | 170 this._manager.setBlockedPatterns([]); |
| 171 } | 171 } |
| 172 | 172 |
| 173 /** | 173 /** |
| 174 * @return {!Promise<?>} | 174 * @return {!Promise<?>} |
| 175 */ | 175 */ |
| 176 _update() { | 176 _update() { |
| 177 var enabled = this._manager.blockingEnabled(); | 177 var enabled = this._manager.blockingEnabled(); |
| 178 this._list.element.classList.toggle('blocking-disabled', !enabled); | 178 this._list.element.classList.toggle('blocking-disabled', !enabled && !!this.
_manager.blockedPatterns().length); |
| 179 this._enabledCheckbox.setChecked(enabled); | 179 this._enabledCheckbox.setChecked(enabled); |
| 180 this._list.clear(); | 180 this._list.clear(); |
| 181 for (var pattern of this._manager.blockedPatterns()) | 181 for (var pattern of this._manager.blockedPatterns()) |
| 182 this._list.appendItem(pattern, true); | 182 this._list.appendItem(pattern, true); |
| 183 return Promise.resolve(); | 183 return Promise.resolve(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * @param {string} url | 187 * @param {string} url |
| 188 * @return {number} | 188 * @return {number} |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (request.wasBlocked()) { | 232 if (request.wasBlocked()) { |
| 233 var count = this._blockedCountForUrl.get(request.url()) || 0; | 233 var count = this._blockedCountForUrl.get(request.url()) || 0; |
| 234 this._blockedCountForUrl.set(request.url(), count + 1); | 234 this._blockedCountForUrl.set(request.url(), count + 1); |
| 235 this._updateThrottler.schedule(this._update.bind(this)); | 235 this._updateThrottler.schedule(this._update.bind(this)); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 /** @type {?Network.BlockedURLsPane} */ | 240 /** @type {?Network.BlockedURLsPane} */ |
| 241 Network.BlockedURLsPane._instance = null; | 241 Network.BlockedURLsPane._instance = null; |
| OLD | NEW |