| 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._networkURLForFileSystemURL(fileSystemPath, uiSourceCode
.url()); |
| 81 } | 81 } |
| 82 return uiSourceCode.originURL(); | 82 return uiSourceCode.url(); |
| 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 hasMappingForNetworkURL: function(url) |
| 90 { | 90 { |
| 91 return this._fileSystemMapping.hasMappingForURL(url); | 91 return this._fileSystemMapping.hasMappingForNetworkURL(url); |
| 92 }, | 92 }, |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * @param {!WebInspector.Target} target | 95 * @param {!WebInspector.Target} target |
| 96 * @param {?WebInspector.ResourceTreeFrame} frame | 96 * @param {?WebInspector.ResourceTreeFrame} frame |
| 97 * @param {string} url | 97 * @param {string} url |
| 98 * @return {?WebInspector.UISourceCode} | 98 * @return {?WebInspector.UISourceCode} |
| 99 */ | 99 */ |
| 100 _networkUISourceCodeForURL: function(target, frame, url) | 100 _networkUISourceCodeForURL: function(target, frame, url) |
| 101 { | 101 { |
| 102 var project = this._workspace.project(WebInspector.NetworkProject.projec
tId(target, frame, false)); | 102 return this._workspace.uiSourceCode(WebInspector.NetworkProject.projectI
d(target, frame, false), url); |
| 103 return project ? project.uiSourceCode(url) : null; | |
| 104 }, | 103 }, |
| 105 | 104 |
| 106 /** | 105 /** |
| 107 * @param {!WebInspector.Target} target | 106 * @param {!WebInspector.Target} target |
| 108 * @param {?WebInspector.ResourceTreeFrame} frame | 107 * @param {?WebInspector.ResourceTreeFrame} frame |
| 109 * @param {string} url | 108 * @param {string} url |
| 110 * @return {?WebInspector.UISourceCode} | 109 * @return {?WebInspector.UISourceCode} |
| 111 */ | 110 */ |
| 112 _contentScriptUISourceCodeForURL: function(target, frame, url) | 111 _contentScriptUISourceCodeForURL: function(target, frame, url) |
| 113 { | 112 { |
| 114 var project = this._workspace.project(WebInspector.NetworkProject.projec
tId(target, frame, true)); | 113 return this._workspace.uiSourceCode(WebInspector.NetworkProject.projectI
d(target, frame, true), url); |
| 115 return project ? project.uiSourceCode(url) : null; | |
| 116 }, | 114 }, |
| 117 | 115 |
| 118 /** | 116 /** |
| 119 * @param {string} url | 117 * @param {string} url |
| 120 * @return {?WebInspector.UISourceCode} | 118 * @return {?WebInspector.UISourceCode} |
| 121 */ | 119 */ |
| 122 _fileSystemUISourceCodeForURL: function(url) | 120 _fileSystemUISourceCodeForURL: function(url) |
| 123 { | 121 { |
| 124 var file = this._fileSystemMapping.fileForURL(url); | 122 var file = this._fileSystemMapping.fileForURL(url); |
| 125 if (file) { | 123 if (file) { |
| 126 var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fi
le.fileSystemPath); | 124 var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fi
le.fileSystemPath); |
| 127 var project = this._workspace.project(projectId); | 125 return this._workspace.uiSourceCode(projectId, file.fileURL); |
| 128 return project ? project.uiSourceCode(file.fileURL) : null; | |
| 129 } | 126 } |
| 130 return null; | 127 return null; |
| 131 }, | 128 }, |
| 132 | 129 |
| 133 /** | 130 /** |
| 134 * @param {!WebInspector.Target} target | 131 * @param {!WebInspector.Target} target |
| 135 * @param {?WebInspector.ResourceTreeFrame} frame | 132 * @param {?WebInspector.ResourceTreeFrame} frame |
| 136 * @param {string} url | 133 * @param {string} url |
| 137 * @return {?WebInspector.UISourceCode} | 134 * @return {?WebInspector.UISourceCode} |
| 138 */ | 135 */ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 162 var frame = WebInspector.ResourceTreeFrame.fromStyleSheet(header); | 159 var frame = WebInspector.ResourceTreeFrame.fromStyleSheet(header); |
| 163 return this._uiSourceCodeForURL(header.target(), frame, url); | 160 return this._uiSourceCodeForURL(header.target(), frame, url); |
| 164 }, | 161 }, |
| 165 | 162 |
| 166 /** | 163 /** |
| 167 * @param {string} url | 164 * @param {string} url |
| 168 * @return {?WebInspector.UISourceCode} | 165 * @return {?WebInspector.UISourceCode} |
| 169 */ | 166 */ |
| 170 uiSourceCodeForURLForAnyTarget: function(url) | 167 uiSourceCodeForURLForAnyTarget: function(url) |
| 171 { | 168 { |
| 172 return this._fileSystemUISourceCodeForURL(url) || WebInspector.workspace
.uiSourceCodeForOriginURL(url); | 169 return this._fileSystemUISourceCodeForURL(url) || WebInspector.workspace
.uiSourceCodeForURL(url); |
| 173 }, | 170 }, |
| 174 | 171 |
| 175 /** | 172 /** |
| 176 * @param {string} fileSystemPath | 173 * @param {string} fileSystemPath |
| 177 * @param {string} filePath | 174 * @param {string} filePath |
| 178 * @return {string} | 175 * @return {string} |
| 179 */ | 176 */ |
| 180 _urlForPath: function(fileSystemPath, filePath) | 177 _networkURLForFileSystemURL: function(fileSystemPath, filePath) |
| 181 { | 178 { |
| 182 return this._fileSystemMapping.urlForPath(fileSystemPath, filePath); | 179 return this._fileSystemMapping.networkURLForFileSystemURL(fileSystemPath
, filePath); |
| 183 }, | 180 }, |
| 184 | 181 |
| 185 /** | 182 /** |
| 186 * @param {!WebInspector.UISourceCode} networkUISourceCode | 183 * @param {!WebInspector.UISourceCode} networkUISourceCode |
| 187 * @param {!WebInspector.UISourceCode} uiSourceCode | 184 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 188 */ | 185 */ |
| 189 addMapping: function(networkUISourceCode, uiSourceCode) | 186 addMapping: function(networkUISourceCode, uiSourceCode) |
| 190 { | 187 { |
| 191 var url = this.networkURL(networkUISourceCode); | 188 var url = this.networkURL(networkUISourceCode); |
| 192 var path = uiSourceCode.path(); | 189 var path = uiSourceCode.url(); |
| 193 var fileSystemPath = this._fileSystemWorkspaceBinding.fileSystemPath(uiS
ourceCode.project().id()); | 190 var fileSystemPath = this._fileSystemWorkspaceBinding.fileSystemPath(uiS
ourceCode.project().id()); |
| 194 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path)
; | 191 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path)
; |
| 195 }, | 192 }, |
| 196 | 193 |
| 197 /** | 194 /** |
| 198 * @param {!WebInspector.UISourceCode} uiSourceCode | 195 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 199 */ | 196 */ |
| 200 removeMapping: function(uiSourceCode) | 197 removeMapping: function(uiSourceCode) |
| 201 { | 198 { |
| 202 var networkURL = this.networkURL(uiSourceCode); | 199 var networkURL = this.networkURL(uiSourceCode); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 this._fileSystemWorkspaceBinding.fileSystemManager().removeEventListener
(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSyst
emRemoved, this); | 249 this._fileSystemWorkspaceBinding.fileSystemManager().removeEventListener
(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSyst
emRemoved, this); |
| 253 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingAdded, this._fileSystemMappingChanged, this); | 250 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingAdded, this._fileSystemMappingChanged, this); |
| 254 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingRemoved, this._fileSystemMappingChanged, this); | 251 this._fileSystemMapping.removeEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingRemoved, this._fileSystemMappingChanged, this); |
| 255 } | 252 } |
| 256 } | 253 } |
| 257 | 254 |
| 258 /** | 255 /** |
| 259 * @type {!WebInspector.NetworkMapping} | 256 * @type {!WebInspector.NetworkMapping} |
| 260 */ | 257 */ |
| 261 WebInspector.networkMapping; | 258 WebInspector.networkMapping; |
| OLD | NEW |