| 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.Workspace} workspace | 7 * @param {!WebInspector.Workspace} workspace |
| 8 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding |
| 8 * @param {!WebInspector.FileSystemMapping} fileSystemMapping | 9 * @param {!WebInspector.FileSystemMapping} fileSystemMapping |
| 9 */ | 10 */ |
| 10 WebInspector.NetworkMapping = function(workspace, fileSystemMapping) | 11 WebInspector.NetworkMapping = function(workspace, fileSystemWorkspaceBinding, fi
leSystemMapping) |
| 11 { | 12 { |
| 12 this._workspace = workspace; | 13 this._workspace = workspace; |
| 13 this._fileSystemMapping = fileSystemMapping; | 14 this._fileSystemMapping = fileSystemMapping; |
| 15 this._fileSystemWorkspaceBinding = fileSystemWorkspaceBinding; |
| 14 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.RevealSourceLine, this._revealSourceLine, this); | 16 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.RevealSourceLine, this._revealSourceLine, this); |
| 15 } | 17 } |
| 16 | 18 |
| 17 WebInspector.NetworkMapping.prototype = { | 19 WebInspector.NetworkMapping.prototype = { |
| 18 /** | 20 /** |
| 19 * @param {!WebInspector.UISourceCode} uiSourceCode | 21 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 20 * @return {string} | 22 * @return {string} |
| 21 */ | 23 */ |
| 22 networkURL: function(uiSourceCode) | 24 networkURL: function(uiSourceCode) |
| 23 { | 25 { |
| 24 // FIXME: This should use fileSystemMapping to determine url. | 26 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst
em) { |
| 25 return uiSourceCode.networkURL(); | 27 var fileSystemPath = this._fileSystemWorkspaceBinding.fileSystemPath
(uiSourceCode.project().id()); |
| 28 return this.urlForPath(fileSystemPath, uiSourceCode.path()); |
| 29 } |
| 30 return uiSourceCode.originURL(); |
| 26 }, | 31 }, |
| 27 | 32 |
| 28 /** | 33 /** |
| 29 * @param {string} url | 34 * @param {string} url |
| 30 * @return {boolean} | 35 * @return {boolean} |
| 31 */ | 36 */ |
| 32 hasMappingForURL: function(url) | 37 hasMappingForURL: function(url) |
| 33 { | 38 { |
| 34 return this._fileSystemMapping.hasMappingForURL(url); | 39 return this._fileSystemMapping.hasMappingForURL(url); |
| 35 }, | 40 }, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 * @return {string} | 102 * @return {string} |
| 98 */ | 103 */ |
| 99 urlForPath: function(fileSystemPath, filePath) | 104 urlForPath: function(fileSystemPath, filePath) |
| 100 { | 105 { |
| 101 return this._fileSystemMapping.urlForPath(fileSystemPath, filePath); | 106 return this._fileSystemMapping.urlForPath(fileSystemPath, filePath); |
| 102 }, | 107 }, |
| 103 | 108 |
| 104 /** | 109 /** |
| 105 * @param {!WebInspector.UISourceCode} networkUISourceCode | 110 * @param {!WebInspector.UISourceCode} networkUISourceCode |
| 106 * @param {!WebInspector.UISourceCode} uiSourceCode | 111 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 107 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBind
ing | |
| 108 */ | 112 */ |
| 109 addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceB
inding) | 113 addMapping: function(networkUISourceCode, uiSourceCode) |
| 110 { | 114 { |
| 111 var url = this.networkURL(networkUISourceCode); | 115 var url = this.networkURL(networkUISourceCode); |
| 112 var path = uiSourceCode.path(); | 116 var path = uiSourceCode.path(); |
| 113 var fileSystemPath = fileSystemWorkspaceBinding.fileSystemPath(uiSourceC
ode.project().id()); | 117 var fileSystemPath = this._fileSystemWorkspaceBinding.fileSystemPath(uiS
ourceCode.project().id()); |
| 114 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path)
; | 118 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path)
; |
| 115 }, | 119 }, |
| 116 | 120 |
| 117 /** | 121 /** |
| 118 * @param {!WebInspector.UISourceCode} uiSourceCode | 122 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 119 */ | 123 */ |
| 120 removeMapping: function(uiSourceCode) | 124 removeMapping: function(uiSourceCode) |
| 121 { | 125 { |
| 122 var networkURL = this.networkURL(uiSourceCode); | 126 var networkURL = this.networkURL(uiSourceCode); |
| 123 this._fileSystemMapping.removeMappingForURL(networkURL); | 127 this._fileSystemMapping.removeMappingForURL(networkURL); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 152 } | 156 } |
| 153 | 157 |
| 154 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeAdded, listener, this); | 158 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeAdded, listener, this); |
| 155 }, | 159 }, |
| 156 } | 160 } |
| 157 | 161 |
| 158 /** | 162 /** |
| 159 * @type {!WebInspector.NetworkMapping} | 163 * @type {!WebInspector.NetworkMapping} |
| 160 */ | 164 */ |
| 161 WebInspector.networkMapping; | 165 WebInspector.networkMapping; |
| OLD | NEW |