| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.Automapping = class { | 7 WebInspector.Automapping = class { |
| 8 /** | 8 /** |
| 9 * @param {!WebInspector.Workspace} workspace | 9 * @param {!WebInspector.Workspace} workspace |
| 10 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated | 10 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 this._activeFoldersIndex.removeFolder(projectFolder); | 191 this._activeFoldersIndex.removeFolder(projectFolder); |
| 192 } | 192 } |
| 193 this._onBindingRemoved.call(null, binding); | 193 this._onBindingRemoved.call(null, binding); |
| 194 } | 194 } |
| 195 | 195 |
| 196 /** | 196 /** |
| 197 * @param {!WebInspector.UISourceCode} networkSourceCode | 197 * @param {!WebInspector.UISourceCode} networkSourceCode |
| 198 * @return {!Promise<?WebInspector.PersistenceBinding>} | 198 * @return {!Promise<?WebInspector.PersistenceBinding>} |
| 199 */ | 199 */ |
| 200 _createBinding(networkSourceCode) { | 200 _createBinding(networkSourceCode) { |
| 201 if (networkSourceCode.url().startsWith('file://')) { |
| 202 var fileSourceCode = this._fileSystemUISourceCodes.get(networkSourceCode.u
rl()); |
| 203 var binding = fileSourceCode ? new WebInspector.PersistenceBinding(network
SourceCode, fileSourceCode, false) : null; |
| 204 return Promise.resolve(binding); |
| 205 } |
| 206 |
| 201 var networkPath = WebInspector.ParsedURL.extractPath(networkSourceCode.url()
); | 207 var networkPath = WebInspector.ParsedURL.extractPath(networkSourceCode.url()
); |
| 202 if (networkPath === null) | 208 if (networkPath === null) |
| 203 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu
ll)); | 209 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu
ll)); |
| 204 | 210 |
| 205 if (networkPath.endsWith('/')) | 211 if (networkPath.endsWith('/')) |
| 206 networkPath += 'index.html'; | 212 networkPath += 'index.html'; |
| 207 var similarFiles = this._filesIndex.similarFiles(networkPath).map(path => th
is._fileSystemUISourceCodes.get(path)); | 213 var similarFiles = this._filesIndex.similarFiles(networkPath).map(path => th
is._fileSystemUISourceCodes.get(path)); |
| 208 if (!similarFiles.length) | 214 if (!similarFiles.length) |
| 209 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu
ll)); | 215 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu
ll)); |
| 210 | 216 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 /** | 398 /** |
| 393 * @param {string} path | 399 * @param {string} path |
| 394 * @return {string} | 400 * @return {string} |
| 395 */ | 401 */ |
| 396 closestParentFolder(path) { | 402 closestParentFolder(path) { |
| 397 var encodedPath = this._encoder.encode(path); | 403 var encodedPath = this._encoder.encode(path); |
| 398 var commonPrefix = this._index.longestPrefix(encodedPath, true); | 404 var commonPrefix = this._index.longestPrefix(encodedPath, true); |
| 399 return this._encoder.decode(commonPrefix); | 405 return this._encoder.decode(commonPrefix); |
| 400 } | 406 } |
| 401 }; | 407 }; |
| OLD | NEW |