Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.js

Issue 1523193002: DevTools: merge UISourceCode's parentPath, name, originURL and uri. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 FileMappingRemoved: "FileMappingRemoved" 46 FileMappingRemoved: "FileMappingRemoved"
47 } 47 }
48 48
49 WebInspector.FileSystemMapping.prototype = { 49 WebInspector.FileSystemMapping.prototype = {
50 _loadFromSettings: function() 50 _loadFromSettings: function()
51 { 51 {
52 var savedMapping = this._fileSystemMappingSetting.get(); 52 var savedMapping = this._fileSystemMappingSetting.get();
53 this._fileSystemMappings = {}; 53 this._fileSystemMappings = {};
54 for (var fileSystemPath in savedMapping) { 54 for (var fileSystemPath in savedMapping) {
55 var savedFileSystemMappings = savedMapping[fileSystemPath]; 55 var savedFileSystemMappings = savedMapping[fileSystemPath];
56
57 this._fileSystemMappings[fileSystemPath] = []; 56 this._fileSystemMappings[fileSystemPath] = [];
58 var fileSystemMappings = this._fileSystemMappings[fileSystemPath]; 57 var fileSystemMappings = this._fileSystemMappings[fileSystemPath];
59 58
60 for (var i = 0; i < savedFileSystemMappings.length; ++i) { 59 for (var i = 0; i < savedFileSystemMappings.length; ++i) {
61 var savedEntry = savedFileSystemMappings[i]; 60 var savedEntry = savedFileSystemMappings[i];
62 var entry = new WebInspector.FileSystemMapping.Entry(savedEntry. fileSystemPath, savedEntry.urlPrefix, savedEntry.pathPrefix, true); 61 var entry = new WebInspector.FileSystemMapping.Entry(fileSystemP ath, savedEntry.urlPrefix, savedEntry.pathPrefix, true);
dgozman 2015/12/15 22:22:47 Why change this?
pfeldman 2015/12/16 01:34:28 Done. (there were more changes)
63 fileSystemMappings.push(entry); 62 fileSystemMappings.push(entry);
64 } 63 }
65 } 64 }
66 65
67 this._rebuildIndexes(); 66 this._rebuildIndexes();
68 }, 67 },
69 68
70 _saveToSettings: function() 69 _saveToSettings: function()
71 { 70 {
72 var setting = {}; 71 var setting = {};
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return null; 201 return null;
203 202
204 var entry = null; 203 var entry = null;
205 for (var i = 0; i < entries.length; ++i) { 204 for (var i = 0; i < entries.length; ++i) {
206 var pathPrefix = entries[i].pathPrefix; 205 var pathPrefix = entries[i].pathPrefix;
207 if (entry && entry.configurable && !entries[i].configurable) 206 if (entry && entry.configurable && !entries[i].configurable)
208 continue; 207 continue;
209 // We are looking for the longest pathPrefix match. 208 // We are looking for the longest pathPrefix match.
210 if (entry && entry.pathPrefix.length > pathPrefix.length) 209 if (entry && entry.pathPrefix.length > pathPrefix.length)
211 continue; 210 continue;
212 if (filePath.startsWith(pathPrefix.substr(1))) 211 if (filePath.startsWith(pathPrefix))
213 entry = entries[i]; 212 entry = entries[i];
214 } 213 }
215 return entry; 214 return entry;
216 }, 215 },
217 216
218 /** 217 /**
219 * @param {string} fileSystemPath 218 * @param {string} fileSystemPath
220 * @param {string} pathPrefix 219 * @param {string} pathPrefix
221 * @return {?WebInspector.FileSystemMapping.Entry} 220 * @return {?WebInspector.FileSystemMapping.Entry}
222 */ 221 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return file; 262 return file;
264 }, 263 },
265 264
266 /** 265 /**
267 * @param {string} fileSystemPath 266 * @param {string} fileSystemPath
268 * @param {string} filePath 267 * @param {string} filePath
269 * @return {string} 268 * @return {string}
270 */ 269 */
271 urlForPath: function(fileSystemPath, filePath) 270 urlForPath: function(fileSystemPath, filePath)
272 { 271 {
273 var entry = this._mappingEntryForPath(fileSystemPath, filePath); 272 var relativePath = filePath.substring("file://".length + fileSystemPath. length);
273 var entry = this._mappingEntryForPath(fileSystemPath, relativePath);
274 if (!entry) 274 if (!entry)
275 return ""; 275 return "";
276 return entry.urlPrefix + filePath.substring(entry.pathPrefix.length - 1) ; 276 return entry.urlPrefix + relativePath.substring(entry.pathPrefix.length) ;
277 }, 277 },
278 278
279 /** 279 /**
280 * @param {string} url 280 * @param {string} url
281 */ 281 */
282 removeMappingForURL: function(url) 282 removeMappingForURL: function(url)
283 { 283 {
284 var entry = this._mappingEntryForURL(url); 284 var entry = this._mappingEntryForURL(url);
285 if (!entry || !entry.configurable) 285 if (!entry || !entry.configurable)
286 return; 286 return;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 this.fileSystemPath = fileSystemPath; 330 this.fileSystemPath = fileSystemPath;
331 this.urlPrefix = urlPrefix; 331 this.urlPrefix = urlPrefix;
332 this.pathPrefix = pathPrefix; 332 this.pathPrefix = pathPrefix;
333 this.configurable = configurable; 333 this.configurable = configurable;
334 } 334 }
335 335
336 /** 336 /**
337 * @type {!WebInspector.FileSystemMapping} 337 * @type {!WebInspector.FileSystemMapping}
338 */ 338 */
339 WebInspector.fileSystemMapping; 339 WebInspector.fileSystemMapping;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698