Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 * @return {boolean} | 152 * @return {boolean} |
| 153 */ | 153 */ |
| 154 accept: function(uiSourceCode) | 154 accept: function(uiSourceCode) |
| 155 { | 155 { |
| 156 if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode)) | 156 if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode)) |
| 157 return false; | 157 return false; |
| 158 return uiSourceCode.project().type() !== WebInspector.projectTypes.Conte ntScripts && uiSourceCode.project().type() !== WebInspector.projectTypes.Snippet s; | 158 return uiSourceCode.project().type() !== WebInspector.projectTypes.Conte ntScripts && uiSourceCode.project().type() !== WebInspector.projectTypes.Snippet s; |
| 159 }, | 159 }, |
| 160 | 160 |
| 161 /** | 161 /** |
| 162 * @param {!WebInspector.UISourceCode} uiSourceCode | |
| 163 */ | |
| 164 _revealIfMainTarget: function(uiSourceCode) | |
|
dgozman
2016/07/27 20:24:23
Let's inline this back.
eostroukhov-old
2016/07/27 21:39:46
Done.
| |
| 165 { | |
| 166 var mainTarget = WebInspector.targetManager.mainTarget(); | |
| 167 var inspectedURL = mainTarget && mainTarget.inspectedURL(); | |
| 168 if (inspectedURL && WebInspector.networkMapping.networkURL(uiSourceCode) === inspectedURL) | |
| 169 this.revealUISourceCode(uiSourceCode, true); | |
| 170 }, | |
| 171 | |
| 172 /** | |
| 162 * @param {!WebInspector.Event} event | 173 * @param {!WebInspector.Event} event |
| 163 */ | 174 */ |
| 164 _inspectedURLChanged: function(event) | 175 _inspectedURLChanged: function(event) |
| 165 { | 176 { |
|
dgozman
2016/07/27 20:24:23
Early return if event.data is not a main target.
eostroukhov-old
2016/07/27 21:39:46
Done.
| |
| 166 var nodes = this._uiSourceCodeNodes.valuesArray(); | 177 this._uiSourceCodeNodes.valuesArray().forEach((node) => this._revealIfMa inTarget(node.uiSourceCode())); |
|
dgozman
2016/07/27 20:24:23
Using forEach here could be slow compared to old-s
eostroukhov-old
2016/07/27 21:39:46
Done.
| |
| 167 for (var i = 0; i < nodes.length; ++i) { | |
| 168 var uiSourceCode = nodes[i].uiSourceCode(); | |
| 169 var inspectedPageURL = WebInspector.targetManager.inspectedPageURL() ; | |
| 170 if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSou rceCode) === inspectedPageURL) | |
| 171 this.revealUISourceCode(uiSourceCode, true); | |
| 172 } | |
| 173 }, | 178 }, |
| 174 | 179 |
| 175 /** | 180 /** |
| 176 * @override | 181 * @override |
| 177 * @param {!WebInspector.UISourceCode} uiSourceCode | 182 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 178 */ | 183 */ |
| 179 uiSourceCodeAdded: function(uiSourceCode) | 184 uiSourceCodeAdded: function(uiSourceCode) |
| 180 { | 185 { |
| 181 var inspectedPageURL = WebInspector.targetManager.inspectedPageURL(); | 186 this._revealIfMainTarget(uiSourceCode); |
| 182 if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSourceC ode) === inspectedPageURL) | |
| 183 this.revealUISourceCode(uiSourceCode, true); | |
| 184 }, | 187 }, |
| 185 | 188 |
| 186 __proto__: WebInspector.NavigatorView.prototype | 189 __proto__: WebInspector.NavigatorView.prototype |
| 187 } | 190 } |
| 188 | 191 |
| 189 /** | 192 /** |
| 190 * @constructor | 193 * @constructor |
| 191 * @extends {WebInspector.NavigatorView} | 194 * @extends {WebInspector.NavigatorView} |
| 192 */ | 195 */ |
| 193 WebInspector.ContentScriptsNavigatorView = function() | 196 WebInspector.ContentScriptsNavigatorView = function() |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 /** | 292 /** |
| 290 * @override | 293 * @override |
| 291 */ | 294 */ |
| 292 sourceDeleted: function(uiSourceCode) | 295 sourceDeleted: function(uiSourceCode) |
| 293 { | 296 { |
| 294 this._handleRemoveSnippet(uiSourceCode); | 297 this._handleRemoveSnippet(uiSourceCode); |
| 295 }, | 298 }, |
| 296 | 299 |
| 297 __proto__: WebInspector.NavigatorView.prototype | 300 __proto__: WebInspector.NavigatorView.prototype |
| 298 } | 301 } |
| OLD | NEW |