| OLD | NEW |
| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 }, | 128 }, |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * @param {string} url | 131 * @param {string} url |
| 132 * @param {!WebInspector.ContentProvider} contentProvider | 132 * @param {!WebInspector.ContentProvider} contentProvider |
| 133 * @param {boolean=} isContentScript | 133 * @param {boolean=} isContentScript |
| 134 * @return {!WebInspector.UISourceCode} | 134 * @return {!WebInspector.UISourceCode} |
| 135 */ | 135 */ |
| 136 addFileForURL: function(url, contentProvider, isContentScript) | 136 addFileForURL: function(url, contentProvider, isContentScript) |
| 137 { | 137 { |
| 138 var splitURL = WebInspector.ParsedURL.splitURL(url); | 138 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
| 139 var projectName = splitURL[0]; | 139 var projectName = splitURL[0]; |
| 140 var parentPath = splitURL.slice(1, -1).join("/"); | 140 var parentPath = splitURL.slice(1, -1).join("/"); |
| 141 try { | 141 try { |
| 142 parentPath = decodeURI(parentPath); | 142 parentPath = parentPath; |
| 143 } catch (e) { } | 143 } catch (e) { } |
| 144 var name = splitURL.peekLast() || ""; | 144 var name = splitURL.peekLast() || ""; |
| 145 try { | 145 try { |
| 146 name = decodeURI(name); | 146 name = name; |
| 147 } catch (e) { } | 147 } catch (e) { } |
| 148 var projectDelegate = this._projectDelegate(projectName, isContentScript
|| false); | 148 var projectDelegate = this._projectDelegate(projectName, isContentScript
|| false); |
| 149 var path = projectDelegate.addFile(parentPath, name, url, contentProvide
r); | 149 var path = projectDelegate.addFile(parentPath, name, url, contentProvide
r); |
| 150 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._work
space.uiSourceCode(projectDelegate.id(), path)); | 150 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._work
space.uiSourceCode(projectDelegate.id(), path)); |
| 151 console.assert(uiSourceCode); | 151 console.assert(uiSourceCode); |
| 152 return uiSourceCode; | 152 return uiSourceCode; |
| 153 }, | 153 }, |
| 154 | 154 |
| 155 /** | 155 /** |
| 156 * @param {string} url | 156 * @param {string} url |
| 157 */ | 157 */ |
| 158 removeFileForURL: function(url) | 158 removeFileForURL: function(url) |
| 159 { | 159 { |
| 160 var splitURL = WebInspector.ParsedURL.splitURL(url); | 160 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
| 161 var projectName = splitURL[0]; | 161 var projectName = splitURL[0]; |
| 162 var projectDelegate = this._projectDelegates[projectName]; | 162 var projectDelegate = this._projectDelegates[projectName]; |
| 163 projectDelegate.removeFile(url); | 163 projectDelegate.removeFile(url); |
| 164 }, | 164 }, |
| 165 | 165 |
| 166 reset: function() | 166 reset: function() |
| 167 { | 167 { |
| 168 for (var projectId in this._projectDelegates) | 168 for (var projectId in this._projectDelegates) |
| 169 this._projectDelegates[projectId].reset(); | 169 this._projectDelegates[projectId].reset(); |
| 170 this._projectDelegates = {}; | 170 this._projectDelegates = {}; |
| 171 }, | 171 }, |
| 172 | 172 |
| 173 __proto__: WebInspector.Object.prototype | 173 __proto__: WebInspector.Object.prototype |
| 174 } | 174 } |
| OLD | NEW |