OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!WebInspector.TargetManager} targetManager | 7 * @param {!WebInspector.TargetManager} targetManager |
8 * @param {!WebInspector.Workspace} workspace | 8 * @param {!WebInspector.Workspace} workspace |
9 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding | 9 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding |
10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping | 10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 }, | 70 }, |
71 | 71 |
72 /** | 72 /** |
73 * @param {!WebInspector.UISourceCode} uiSourceCode | 73 * @param {!WebInspector.UISourceCode} uiSourceCode |
74 * @return {string} | 74 * @return {string} |
75 */ | 75 */ |
76 networkURL: function(uiSourceCode) | 76 networkURL: function(uiSourceCode) |
77 { | 77 { |
78 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) { | 78 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) { |
79 var fileSystemPath = this._fileSystemWorkspaceBinding.fileSystemPath (uiSourceCode.project().id()); | 79 var fileSystemPath = this._fileSystemWorkspaceBinding.fileSystemPath (uiSourceCode.project().id()); |
80 return this.urlForPath(fileSystemPath, uiSourceCode.path()); | 80 return this._urlForPath(fileSystemPath, uiSourceCode.path()); |
81 } | 81 } |
82 return uiSourceCode.originURL(); | 82 return uiSourceCode.originURL(); |
83 }, | 83 }, |
84 | 84 |
85 /** | 85 /** |
86 * @param {string} url | 86 * @param {string} url |
87 * @return {boolean} | 87 * @return {boolean} |
88 */ | 88 */ |
89 hasMappingForURL: function(url) | 89 hasMappingForURL: function(url) |
90 { | 90 { |
91 return this._fileSystemMapping.hasMappingForURL(url); | 91 return this._fileSystemMapping.hasMappingForURL(url); |
92 }, | 92 }, |
93 | 93 |
94 /** | 94 /** |
95 * @param {string} url | 95 * @param {string} url |
96 * @param {!WebInspector.Target} target | 96 * @param {!WebInspector.Target} target |
97 * @return {?WebInspector.UISourceCode} | 97 * @return {?WebInspector.UISourceCode} |
98 */ | 98 */ |
99 _networkUISourceCodeForURL: function(url, target) | 99 _networkUISourceCodeForURL: function(url, target) |
100 { | 100 { |
101 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); | 101 var project = this._workspace.project(WebInspector.NetworkProject.projec tId(target, false)); |
102 var projectId = WebInspector.NetworkProject.projectId(target, splitURL[0 ], false); | 102 return project ? project.uiSourceCode(url) : null; |
103 var project = this._workspace.project(projectId); | |
104 return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : nul l; | |
105 }, | 103 }, |
106 | 104 |
107 /** | 105 /** |
108 * @param {string} url | 106 * @param {string} url |
109 * @param {!WebInspector.Target} target | 107 * @param {!WebInspector.Target} target |
110 * @return {?WebInspector.UISourceCode} | 108 * @return {?WebInspector.UISourceCode} |
111 */ | 109 */ |
112 _contentScriptUISourceCodeForURL: function(url, target) | 110 _contentScriptUISourceCodeForURL: function(url, target) |
113 { | 111 { |
114 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); | 112 var project = this._workspace.project(WebInspector.NetworkProject.projec tId(target, true)); |
115 var projectId = WebInspector.NetworkProject.projectId(target, splitURL[0 ], true); | 113 return project ? project.uiSourceCode(url) : null; |
116 var project = this._workspace.project(projectId); | |
117 return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : nul l; | |
118 }, | 114 }, |
119 | 115 |
120 /** | 116 /** |
121 * @param {string} url | 117 * @param {string} url |
122 * @param {!WebInspector.Target} target | 118 * @param {!WebInspector.Target} target |
123 * @return {?WebInspector.UISourceCode} | 119 * @return {?WebInspector.UISourceCode} |
124 */ | 120 */ |
125 _uiSourceCodeForURL: function(url, target) | 121 _uiSourceCodeForURL: function(url, target) |
126 { | 122 { |
127 var file = this._fileSystemMapping.fileForURL(url); | 123 var file = this._fileSystemMapping.fileForURL(url); |
128 if (file) { | 124 if (file) { |
129 var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fi le.fileSystemPath); | 125 var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fi le.fileSystemPath); |
130 var project = this._workspace.project(projectId); | 126 var project = this._workspace.project(projectId); |
131 return project ? project.uiSourceCode(file.filePath) : null; | 127 return project ? project.uiSourceCode("file://" + file.fileSystemPat h + "/" + file.filePath) : null; |
132 } | 128 } |
133 | 129 |
134 return this._networkUISourceCodeForURL(url, target) || this._contentScri ptUISourceCodeForURL(url, target); | 130 return this._networkUISourceCodeForURL(url, target) || this._contentScri ptUISourceCodeForURL(url, target); |
135 }, | 131 }, |
136 | 132 |
137 /** | 133 /** |
138 * @param {string} url | 134 * @param {string} url |
139 * @param {!WebInspector.Script} script | 135 * @param {!WebInspector.Script} script |
140 * @return {?WebInspector.UISourceCode} | 136 * @return {?WebInspector.UISourceCode} |
141 */ | 137 */ |
(...skipping 24 matching lines...) Expand all Loading... | |
166 return result; | 162 return result; |
167 } | 163 } |
168 return null; | 164 return null; |
169 }, | 165 }, |
170 | 166 |
171 /** | 167 /** |
172 * @param {string} fileSystemPath | 168 * @param {string} fileSystemPath |
173 * @param {string} filePath | 169 * @param {string} filePath |
174 * @return {string} | 170 * @return {string} |
175 */ | 171 */ |
176 urlForPath: function(fileSystemPath, filePath) | 172 _urlForPath: function(fileSystemPath, filePath) |
dgozman
2015/12/15 22:22:47
Does anybody use it?
pfeldman
2015/12/16 01:34:28
Yep, line 80. And some tests.
| |
177 { | 173 { |
178 return this._fileSystemMapping.urlForPath(fileSystemPath, filePath); | 174 return this._fileSystemMapping.urlForPath(fileSystemPath, filePath); |
179 }, | 175 }, |
180 | 176 |
181 /** | 177 /** |
182 * @param {!WebInspector.UISourceCode} networkUISourceCode | 178 * @param {!WebInspector.UISourceCode} networkUISourceCode |
183 * @param {!WebInspector.UISourceCode} uiSourceCode | 179 * @param {!WebInspector.UISourceCode} uiSourceCode |
184 */ | 180 */ |
185 addMapping: function(networkUISourceCode, uiSourceCode) | 181 addMapping: function(networkUISourceCode, uiSourceCode) |
186 { | 182 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 this._fileSystemWorkspaceBinding.fileSystemManager().removeEventListener (WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSyst emRemoved, this); | 244 this._fileSystemWorkspaceBinding.fileSystemManager().removeEventListener (WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSyst emRemoved, this); |
249 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingAdded, this._fileSystemMappingChanged, this); | 245 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingAdded, this._fileSystemMappingChanged, this); |
250 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingRemoved, this._fileSystemMappingChanged, this); | 246 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingRemoved, this._fileSystemMappingChanged, this); |
251 } | 247 } |
252 } | 248 } |
253 | 249 |
254 /** | 250 /** |
255 * @type {!WebInspector.NetworkMapping} | 251 * @type {!WebInspector.NetworkMapping} |
256 */ | 252 */ |
257 WebInspector.networkMapping; | 253 WebInspector.networkMapping; |
OLD | NEW |