| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 /** | |
| 5 * @unrestricted | |
| 6 */ | |
| 7 Bindings.NetworkMapping = class { | |
| 8 /** | |
| 9 * @param {!Workspace.Workspace} workspace | |
| 10 */ | |
| 11 constructor(workspace) { | |
| 12 this._workspace = workspace; | |
| 13 } | |
| 14 | |
| 15 /** | |
| 16 * @param {!SDK.Target} target | |
| 17 * @param {?SDK.ResourceTreeFrame} frame | |
| 18 * @param {string} url | |
| 19 * @return {?Workspace.UISourceCode} | |
| 20 */ | |
| 21 _networkUISourceCodeForURL(target, frame, url) { | |
| 22 return this._workspace.uiSourceCode(Bindings.NetworkProject.projectId(target
, frame, false), url); | |
| 23 } | |
| 24 | |
| 25 /** | |
| 26 * @param {!SDK.Target} target | |
| 27 * @param {?SDK.ResourceTreeFrame} frame | |
| 28 * @param {string} url | |
| 29 * @return {?Workspace.UISourceCode} | |
| 30 */ | |
| 31 _contentScriptUISourceCodeForURL(target, frame, url) { | |
| 32 return this._workspace.uiSourceCode(Bindings.NetworkProject.projectId(target
, frame, true), url); | |
| 33 } | |
| 34 | |
| 35 /** | |
| 36 * @param {!SDK.Target} target | |
| 37 * @param {?SDK.ResourceTreeFrame} frame | |
| 38 * @param {string} url | |
| 39 * @return {?Workspace.UISourceCode} | |
| 40 */ | |
| 41 _uiSourceCodeForURL(target, frame, url) { | |
| 42 return this._networkUISourceCodeForURL(target, frame, url) || | |
| 43 this._contentScriptUISourceCodeForURL(target, frame, url); | |
| 44 } | |
| 45 | |
| 46 /** | |
| 47 * @param {string} url | |
| 48 * @param {!SDK.Script} script | |
| 49 * @return {?Workspace.UISourceCode} | |
| 50 */ | |
| 51 uiSourceCodeForScriptURL(url, script) { | |
| 52 var frame = SDK.ResourceTreeFrame.fromScript(script); | |
| 53 return this._uiSourceCodeForURL(script.target(), frame, url); | |
| 54 } | |
| 55 | |
| 56 /** | |
| 57 * @param {string} url | |
| 58 * @param {!SDK.CSSStyleSheetHeader} header | |
| 59 * @return {?Workspace.UISourceCode} | |
| 60 */ | |
| 61 uiSourceCodeForStyleURL(url, header) { | |
| 62 var frame = SDK.ResourceTreeFrame.fromStyleSheet(header); | |
| 63 return this._uiSourceCodeForURL(header.target(), frame, url); | |
| 64 } | |
| 65 | |
| 66 /** | |
| 67 * @param {string} url | |
| 68 * @return {?Workspace.UISourceCode} | |
| 69 */ | |
| 70 uiSourceCodeForURLForAnyTarget(url) { | |
| 71 return Workspace.workspace.uiSourceCodeForURL(url); | |
| 72 } | |
| 73 }; | |
| 74 | |
| 75 /** | |
| 76 * @type {!Bindings.NetworkMapping} | |
| 77 */ | |
| 78 Bindings.networkMapping; | |
| OLD | NEW |