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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js

Issue 2501883002: DevTools: kill Bindings.NetworkMapping (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 * @return {string} 55 * @return {string}
56 */ 56 */
57 Bindings.displayNameForURL = function(url) { 57 Bindings.displayNameForURL = function(url) {
58 if (!url) 58 if (!url)
59 return ''; 59 return '';
60 60
61 var resource = Bindings.resourceForURL(url); 61 var resource = Bindings.resourceForURL(url);
62 if (resource) 62 if (resource)
63 return resource.displayName; 63 return resource.displayName;
64 64
65 var uiSourceCode = Bindings.networkMapping.uiSourceCodeForURLForAnyTarget(url) ; 65 var uiSourceCode = Workspace.workspace.uiSourceCodeForURL(url);
66 if (uiSourceCode) 66 if (uiSourceCode)
67 return uiSourceCode.displayName(); 67 return uiSourceCode.displayName();
68 68
69 var mainTarget = SDK.targetManager.mainTarget(); 69 var mainTarget = SDK.targetManager.mainTarget();
70 var inspectedURL = mainTarget && mainTarget.inspectedURL(); 70 var inspectedURL = mainTarget && mainTarget.inspectedURL();
71 if (!inspectedURL) 71 if (!inspectedURL)
72 return url.trimURL(''); 72 return url.trimURL('');
73 73
74 var parsedURL = inspectedURL.asParsedURL(); 74 var parsedURL = inspectedURL.asParsedURL();
75 var lastPathComponent = parsedURL ? parsedURL.lastPathComponent : parsedURL; 75 var lastPathComponent = parsedURL ? parsedURL.lastPathComponent : parsedURL;
76 var index = inspectedURL.indexOf(lastPathComponent); 76 var index = inspectedURL.indexOf(lastPathComponent);
77 if (index !== -1 && index + lastPathComponent.length === inspectedURL.length) { 77 if (index !== -1 && index + lastPathComponent.length === inspectedURL.length) {
78 var baseURL = inspectedURL.substring(0, index); 78 var baseURL = inspectedURL.substring(0, index);
79 if (url.startsWith(baseURL)) 79 if (url.startsWith(baseURL))
80 return url.substring(index); 80 return url.substring(index);
81 } 81 }
82 82
83 if (!parsedURL) 83 if (!parsedURL)
84 return url; 84 return url;
85 85
86 var displayName = url.trimURL(parsedURL.host); 86 var displayName = url.trimURL(parsedURL.host);
87 return displayName === '/' ? parsedURL.host + '/' : displayName; 87 return displayName === '/' ? parsedURL.host + '/' : displayName;
88 }; 88 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698