Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js

Issue 2692653003: [Devtools] Added Enable/Disable for request blocking in network (Closed)
Patch Set: changes Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); 100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this);
101 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); 101 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this);
102 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); 102 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this);
103 this._networkLogView.addEventListener( 103 this._networkLogView.addEventListener(
104 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this); 104 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this);
105 this._networkLogView.addEventListener( 105 this._networkLogView.addEventListener(
106 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this); 106 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this);
107 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this); 107 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this);
108 108
109 Components.DataSaverInfobar.maybeShowInPanel(this); 109 Components.DataSaverInfobar.maybeShowInPanel(this);
110
111 var manager = SDK.multitargetNetworkManager;
112 manager.on(SDK.MultitargetNetworkManager.RequestBlockingEnabledChangedEvent, updateIconVisibility.bind(this));
113 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateIconVisibility.bind(this));
114 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
115 blockedURLsSetting.addChangeListener(updateIconVisibility.bind(this));
116
117 updateIconVisibility.call(this);
118
119 /**
120 * @this {Network.NetworkPanel}
121 */
122 function updateIconVisibility() {
123 var icon = null;
124 if (manager.isThrottling()) {
125 icon = UI.Icon.create('smallicon-warning');
126 icon.title = Common.UIString('Network throttling is enabled');
127 } else if (SDK.multitargetNetworkManager.isRequestBlockingEnabled() && blo ckedURLsSetting.get().length) {
128 icon = UI.Icon.create('smallicon-warning');
129 icon.title = Common.UIString('Requests may be blocked');
130 }
131 UI.inspectorView.setPanelIcon(this.name, icon);
132 }
110 } 133 }
111 134
112 /** 135 /**
113 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters 136 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters
114 */ 137 */
115 static revealAndFilter(filters) { 138 static revealAndFilter(filters) {
116 var panel = Network.NetworkPanel._instance(); 139 var panel = Network.NetworkPanel._instance();
117 var filterString = ''; 140 var filterString = '';
118 for (var filter of filters) 141 for (var filter of filters)
119 filterString += `${filter.filterType}:${filter.filterValue} `; 142 filterString += `${filter.filterType}:${filter.filterValue} `;
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 * @param {string} actionId 749 * @param {string} actionId
727 * @return {boolean} 750 * @return {boolean}
728 */ 751 */
729 handleAction(context, actionId) { 752 handleAction(context, actionId) {
730 var panel = UI.context.flavor(Network.NetworkPanel); 753 var panel = UI.context.flavor(Network.NetworkPanel);
731 console.assert(panel && panel instanceof Network.NetworkPanel); 754 console.assert(panel && panel instanceof Network.NetworkPanel);
732 panel._toggleRecording(); 755 panel._toggleRecording();
733 return true; 756 return true;
734 } 757 }
735 }; 758 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698