Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
| 119 updateIconVisibility.call(this); | |
| 120 | |
| 121 /** | |
| 122 * @this {Network.NetworkPanel} | |
| 123 */ | |
| 124 function updateIconVisibility() { | |
|
dgozman
2017/03/20 18:05:47
Note this does not work in case you do throttling
| |
| 125 var icon = null; | |
| 126 if (SDK.multitargetNetworkManager.isThrottling()) { | |
| 127 icon = UI.Icon.create('smallicon-warning'); | |
| 128 icon.title = Common.UIString('Network throttling is enabled'); | |
| 129 } else if (requestBlockingEnabledSetting.get() && blockedURLsSetting.get() .length) { | |
| 130 icon = UI.Icon.create('smallicon-warning'); | |
| 131 icon.title = Common.UIString('Requests may be blocked'); | |
| 132 } | |
| 133 UI.inspectorView.setPanelIcon(this.name, icon); | |
| 134 } | |
| 113 } | 135 } |
| 114 | 136 |
| 115 /** | 137 /** |
| 116 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters | 138 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters |
| 117 */ | 139 */ |
| 118 static revealAndFilter(filters) { | 140 static revealAndFilter(filters) { |
| 119 var panel = Network.NetworkPanel._instance(); | 141 var panel = Network.NetworkPanel._instance(); |
| 120 var filterString = ''; | 142 var filterString = ''; |
| 121 for (var filter of filters) | 143 for (var filter of filters) |
| 122 filterString += `${filter.filterType}:${filter.filterValue} `; | 144 filterString += `${filter.filterType}:${filter.filterValue} `; |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 * @param {string} actionId | 769 * @param {string} actionId |
| 748 * @return {boolean} | 770 * @return {boolean} |
| 749 */ | 771 */ |
| 750 handleAction(context, actionId) { | 772 handleAction(context, actionId) { |
| 751 var panel = UI.context.flavor(Network.NetworkPanel); | 773 var panel = UI.context.flavor(Network.NetworkPanel); |
| 752 console.assert(panel && panel instanceof Network.NetworkPanel); | 774 console.assert(panel && panel instanceof Network.NetworkPanel); |
| 753 panel._toggleRecording(); | 775 panel._toggleRecording(); |
| 754 return true; | 776 return true; |
| 755 } | 777 } |
| 756 }; | 778 }; |
| OLD | NEW |