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

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: Merge branch 'BLOCK_REQUEST_REMOVE_CONTEXT_MENU' into ADD_ENABLE_DISABLE_REQUEST_BLOCKINg Created 3 years, 10 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, updateVisibility);
113 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateVisibility);
114 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
115 blockedURLsSetting.addChangeListener(updateVisibility);
116
117 function updateVisibility() {
118 var icon = null;
119 if (manager.isThrottling()) {
120 icon = UI.Icon.create('smallicon-warning');
121 icon.title = Common.UIString('Network throttling is enabled');
122 } else if (SDK.multitargetNetworkManager.isRequestBlockingEnabled() && blo ckedURLsSetting.get().length) {
pfeldman 2017/02/13 18:24:26 You don't need to check the blocked url length. se
allada 2017/02/16 21:42:02 I thought it'd be better to allow the user to keep
123 icon = UI.Icon.create('smallicon-warning');
124 icon.title = Common.UIString('Requests may be blocked');
125 }
126 UI.inspectorView.setPanelIcon('network', icon);
pfeldman 2017/02/13 18:24:26 this.name
allada 2017/02/16 21:42:03 Done.
127 }
110 } 128 }
111 129
112 /** 130 /**
113 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters 131 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters
114 */ 132 */
115 static revealAndFilter(filters) { 133 static revealAndFilter(filters) {
116 var panel = Network.NetworkPanel._instance(); 134 var panel = Network.NetworkPanel._instance();
117 var filterString = ''; 135 var filterString = '';
118 for (var filter of filters) 136 for (var filter of filters)
119 filterString += `${filter.filterType}:${filter.filterValue} `; 137 filterString += `${filter.filterType}:${filter.filterValue} `;
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 * @param {string} actionId 744 * @param {string} actionId
727 * @return {boolean} 745 * @return {boolean}
728 */ 746 */
729 handleAction(context, actionId) { 747 handleAction(context, actionId) {
730 var panel = UI.context.flavor(Network.NetworkPanel); 748 var panel = UI.context.flavor(Network.NetworkPanel);
731 console.assert(panel && panel instanceof Network.NetworkPanel); 749 console.assert(panel && panel instanceof Network.NetworkPanel);
732 panel._toggleRecording(); 750 panel._toggleRecording();
733 return true; 751 return true;
734 } 752 }
735 }; 753 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698