Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 112 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBind ing |
| 108 */ | 113 */ |
| 109 addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceB inding) | 114 addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceB inding) |
| 110 { | 115 { |
| 111 var url = this.networkURL(networkUISourceCode); | 116 var url = this.networkURL(networkUISourceCode); |
| 112 var path = uiSourceCode.path(); | 117 var path = uiSourceCode.path(); |
| 113 var fileSystemPath = fileSystemWorkspaceBinding.fileSystemPath(uiSourceC ode.project().id()); | 118 var fileSystemPath = fileSystemWorkspaceBinding.fileSystemPath(uiSourceC ode.project().id()); |
|
dgozman
2015/09/25 00:29:19
Use this._fswb version.
| |
| 114 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path) ; | 119 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path) ; |
| 115 }, | 120 }, |
| 116 | 121 |
| 117 /** | 122 /** |
| 118 * @param {!WebInspector.UISourceCode} uiSourceCode | 123 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 119 */ | 124 */ |
| 120 removeMapping: function(uiSourceCode) | 125 removeMapping: function(uiSourceCode) |
| 121 { | 126 { |
| 122 var networkURL = this.networkURL(uiSourceCode); | 127 var networkURL = this.networkURL(uiSourceCode); |
| 123 this._fileSystemMapping.removeMappingForURL(networkURL); | 128 this._fileSystemMapping.removeMappingForURL(networkURL); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 152 } | 157 } |
| 153 | 158 |
| 154 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this); | 159 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this); |
| 155 }, | 160 }, |
| 156 } | 161 } |
| 157 | 162 |
| 158 /** | 163 /** |
| 159 * @type {!WebInspector.NetworkMapping} | 164 * @type {!WebInspector.NetworkMapping} |
| 160 */ | 165 */ |
| 161 WebInspector.networkMapping; | 166 WebInspector.networkMapping; |
| OLD | NEW |