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

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

Issue 2765443005: [Devtools] Fixed network indicator icon for throttling (Closed)
Patch Set: added tests Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/main/Main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); 103 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this);
104 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); 104 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this);
105 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); 105 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this);
106 this._networkLogView.addEventListener( 106 this._networkLogView.addEventListener(
107 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this); 107 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this);
108 this._networkLogView.addEventListener( 108 this._networkLogView.addEventListener(
109 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this); 109 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this);
110 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this); 110 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this);
111 111
112 Components.DataSaverInfobar.maybeShowInPanel(this); 112 Components.DataSaverInfobar.maybeShowInPanel(this);
113
114 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
115 blockedURLsSetting.addChangeListener(updateIconVisibility.bind(this));
116 var requestBlockingEnabledSetting = Common.moduleSetting('requestBlockingEna bled');
117 requestBlockingEnabledSetting.addChangeListener(updateIconVisibility.bind(th is));
118 SDK.multitargetNetworkManager.addEventListener(
119 SDK.MultitargetNetworkManager.Events.ConditionsChanged, updateIconVisibi lity.bind(this));
120
121 updateIconVisibility.call(this);
122
123 /**
124 * @this {Network.NetworkPanel}
125 */
126 function updateIconVisibility() {
127 var icon = null;
128 if (SDK.multitargetNetworkManager.isThrottling()) {
129 icon = UI.Icon.create('smallicon-warning');
130 icon.title = Common.UIString('Network throttling is enabled');
131 } else if (requestBlockingEnabledSetting.get() && blockedURLsSetting.get() .length) {
132 icon = UI.Icon.create('smallicon-warning');
133 icon.title = Common.UIString('Requests may be blocked');
134 }
135 UI.inspectorView.setPanelIcon(this.name, icon);
136 }
137 } 113 }
138 114
139 /** 115 /**
140 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters 116 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters
141 */ 117 */
142 static revealAndFilter(filters) { 118 static revealAndFilter(filters) {
143 var panel = Network.NetworkPanel._instance(); 119 var panel = Network.NetworkPanel._instance();
144 var filterString = ''; 120 var filterString = '';
145 for (var filter of filters) 121 for (var filter of filters)
146 filterString += `${filter.filterType}:${filter.filterValue} `; 122 filterString += `${filter.filterType}:${filter.filterValue} `;
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 * @param {string} actionId 747 * @param {string} actionId
772 * @return {boolean} 748 * @return {boolean}
773 */ 749 */
774 handleAction(context, actionId) { 750 handleAction(context, actionId) {
775 var panel = UI.context.flavor(Network.NetworkPanel); 751 var panel = UI.context.flavor(Network.NetworkPanel);
776 console.assert(panel && panel instanceof Network.NetworkPanel); 752 console.assert(panel && panel instanceof Network.NetworkPanel);
777 panel._toggleRecording(); 753 panel._toggleRecording();
778 return true; 754 return true;
779 } 755 }
780 }; 756 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/main/Main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698