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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 */ | 8 */ |
9 WebInspector.BlockedURLsPane = function() | 9 WebInspector.BlockedURLsPane = function() |
10 { | 10 { |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 this._listElement = this.contentElement.createChild("div", "blocked-urls-lis
t"); | 37 this._listElement = this.contentElement.createChild("div", "blocked-urls-lis
t"); |
38 | 38 |
39 /** @type {!Map<string, number>} */ | 39 /** @type {!Map<string, number>} */ |
40 this._blockedCountForUrl = new Map(); | 40 this._blockedCountForUrl = new Map(); |
41 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this); | 41 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this); |
42 | 42 |
43 this._updateThrottler = new WebInspector.Throttler(200); | 43 this._updateThrottler = new WebInspector.Throttler(200); |
44 | 44 |
45 this._update(); | 45 this._update(); |
46 } | 46 }; |
47 | 47 |
48 WebInspector.BlockedURLsPane.prototype = { | 48 WebInspector.BlockedURLsPane.prototype = { |
49 /** | 49 /** |
50 * @param {!Event} event | 50 * @param {!Event} event |
51 */ | 51 */ |
52 _emptyElementContextMenu: function(event) | 52 _emptyElementContextMenu: function(event) |
53 { | 53 { |
54 var contextMenu = new WebInspector.ContextMenu(event); | 54 var contextMenu = new WebInspector.ContextMenu(event); |
55 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^pattern"),
this._addButtonClicked.bind(this)); | 55 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^pattern"),
this._addButtonClicked.bind(this)); |
56 contextMenu.show(); | 56 contextMenu.show(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 { | 268 { |
269 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data); | 269 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data); |
270 if (request.wasBlocked()) { | 270 if (request.wasBlocked()) { |
271 var count = this._blockedCountForUrl.get(request.url) || 0; | 271 var count = this._blockedCountForUrl.get(request.url) || 0; |
272 this._blockedCountForUrl.set(request.url, count + 1); | 272 this._blockedCountForUrl.set(request.url, count + 1); |
273 this._updateThrottler.schedule(this._update.bind(this)); | 273 this._updateThrottler.schedule(this._update.bind(this)); |
274 } | 274 } |
275 }, | 275 }, |
276 | 276 |
277 __proto__: WebInspector.VBox.prototype | 277 __proto__: WebInspector.VBox.prototype |
278 } | 278 }; |
279 | 279 |
280 | 280 |
281 /** @type {?WebInspector.BlockedURLsPane} */ | 281 /** @type {?WebInspector.BlockedURLsPane} */ |
282 WebInspector.BlockedURLsPane._instance = null; | 282 WebInspector.BlockedURLsPane._instance = null; |
283 | 283 |
284 WebInspector.BlockedURLsPane.reset = function() | 284 WebInspector.BlockedURLsPane.reset = function() |
285 { | 285 { |
286 if (WebInspector.BlockedURLsPane._instance) | 286 if (WebInspector.BlockedURLsPane._instance) |
287 WebInspector.BlockedURLsPane._instance.reset(); | 287 WebInspector.BlockedURLsPane._instance.reset(); |
288 } | 288 }; |
289 | 289 |
290 /** | 290 /** |
291 * @constructor | 291 * @constructor |
292 * @implements {WebInspector.ActionDelegate} | 292 * @implements {WebInspector.ActionDelegate} |
293 */ | 293 */ |
294 WebInspector.BlockedURLsPane.ActionDelegate = function() | 294 WebInspector.BlockedURLsPane.ActionDelegate = function() |
295 { | 295 { |
296 } | 296 }; |
297 | 297 |
298 WebInspector.BlockedURLsPane.ActionDelegate.prototype = { | 298 WebInspector.BlockedURLsPane.ActionDelegate.prototype = { |
299 /** | 299 /** |
300 * @override | 300 * @override |
301 * @param {!WebInspector.Context} context | 301 * @param {!WebInspector.Context} context |
302 * @param {string} actionId | 302 * @param {string} actionId |
303 * @return {boolean} | 303 * @return {boolean} |
304 */ | 304 */ |
305 handleAction: function(context, actionId) | 305 handleAction: function(context, actionId) |
306 { | 306 { |
307 WebInspector.viewManager.showView("network.blocked-urls"); | 307 WebInspector.viewManager.showView("network.blocked-urls"); |
308 return true; | 308 return true; |
309 } | 309 } |
310 } | 310 }; |
311 | 311 |
OLD | NEW |