| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 /** | 130 /** |
| 131 * @param {!WebInspector.Event} event | 131 * @param {!WebInspector.Event} event |
| 132 */ | 132 */ |
| 133 _workingCopyChanged: function(event) | 133 _workingCopyChanged: function(event) |
| 134 { | 134 { |
| 135 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.targ
et); | 135 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.targ
et); |
| 136 this._scriptSnippetEdited(uiSourceCode); | 136 this._scriptSnippetEdited(uiSourceCode); |
| 137 }, | 137 }, |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * @param {string} path | 140 * @param {string} url |
| 141 */ | 141 */ |
| 142 deleteScriptSnippet: function(path) | 142 deleteScriptSnippet: function(url) |
| 143 { | 143 { |
| 144 var uiSourceCode = this._project.uiSourceCode(path); | 144 var uiSourceCode = this._project.uiSourceCodeForURL(url); |
| 145 if (!uiSourceCode) | 145 if (!uiSourceCode) |
| 146 return; | 146 return; |
| 147 var snippetId = this._snippetIdForUISourceCode.get(uiSourceCode) || ""; | 147 var snippetId = this._snippetIdForUISourceCode.get(uiSourceCode) || ""; |
| 148 var snippet = this._snippetStorage.snippetForId(snippetId); | 148 var snippet = this._snippetStorage.snippetForId(snippetId); |
| 149 this._snippetStorage.deleteSnippet(snippet); | 149 this._snippetStorage.deleteSnippet(snippet); |
| 150 this._removeBreakpoints(uiSourceCode); | 150 this._removeBreakpoints(uiSourceCode); |
| 151 this._releaseSnippetScript(uiSourceCode); | 151 this._releaseSnippetScript(uiSourceCode); |
| 152 delete this._uiSourceCodeForSnippetId[snippet.id]; | 152 delete this._uiSourceCodeForSnippetId[snippet.id]; |
| 153 this._snippetIdForUISourceCode.remove(uiSourceCode); | 153 this._snippetIdForUISourceCode.remove(uiSourceCode); |
| 154 this._project.removeFile(snippet.name); | 154 this._project.removeFile(snippet.name); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 }, | 615 }, |
| 616 | 616 |
| 617 /** | 617 /** |
| 618 * @override | 618 * @override |
| 619 * @param {!WebInspector.UISourceCode} uiSourceCode | 619 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 620 * @param {string} newContent | 620 * @param {string} newContent |
| 621 * @param {function(?string)} callback | 621 * @param {function(?string)} callback |
| 622 */ | 622 */ |
| 623 setFileContent: function(uiSourceCode, newContent, callback) | 623 setFileContent: function(uiSourceCode, newContent, callback) |
| 624 { | 624 { |
| 625 this._model._setScriptSnippetContent(uiSourceCode.path(), newContent); | 625 this._model._setScriptSnippetContent(uiSourceCode.url(), newContent); |
| 626 callback(""); | 626 callback(""); |
| 627 }, | 627 }, |
| 628 | 628 |
| 629 /** | 629 /** |
| 630 * @override | 630 * @override |
| 631 * @return {boolean} | 631 * @return {boolean} |
| 632 */ | 632 */ |
| 633 canRename: function() | 633 canRename: function() |
| 634 { | 634 { |
| 635 return true; | 635 return true; |
| 636 }, | 636 }, |
| 637 | 637 |
| 638 /** | 638 /** |
| 639 * @override | 639 * @override |
| 640 * @param {string} path | 640 * @param {string} url |
| 641 * @param {string} newName | 641 * @param {string} newName |
| 642 * @param {function(boolean, string=)} callback | 642 * @param {function(boolean, string=)} callback |
| 643 */ | 643 */ |
| 644 performRename: function(path, newName, callback) | 644 performRename: function(url, newName, callback) |
| 645 { | 645 { |
| 646 this._model.renameScriptSnippet(path, newName, callback); | 646 this._model.renameScriptSnippet(url, newName, callback); |
| 647 }, | 647 }, |
| 648 | 648 |
| 649 /** | 649 /** |
| 650 * @override | 650 * @override |
| 651 * @param {string} path | 651 * @param {string} url |
| 652 * @param {?string} name | 652 * @param {?string} name |
| 653 * @param {string} content | 653 * @param {string} content |
| 654 * @param {function(?WebInspector.UISourceCode)} callback | 654 * @param {function(?WebInspector.UISourceCode)} callback |
| 655 */ | 655 */ |
| 656 createFile: function(path, name, content, callback) | 656 createFile: function(url, name, content, callback) |
| 657 { | 657 { |
| 658 callback(this._model.createScriptSnippet(content)); | 658 callback(this._model.createScriptSnippet(content)); |
| 659 }, | 659 }, |
| 660 | 660 |
| 661 /** | 661 /** |
| 662 * @override | 662 * @override |
| 663 * @param {string} path | 663 * @param {string} url |
| 664 */ | 664 */ |
| 665 deleteFile: function(path) | 665 deleteFile: function(url) |
| 666 { | 666 { |
| 667 this._model.deleteScriptSnippet(path); | 667 this._model.deleteScriptSnippet(url); |
| 668 }, | 668 }, |
| 669 | 669 |
| 670 __proto__: WebInspector.ContentProviderBasedProject.prototype | 670 __proto__: WebInspector.ContentProviderBasedProject.prototype |
| 671 } | 671 } |
| 672 | 672 |
| 673 /** | 673 /** |
| 674 * @type {!WebInspector.ScriptSnippetModel} | 674 * @type {!WebInspector.ScriptSnippetModel} |
| 675 */ | 675 */ |
| 676 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); | 676 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); |
| OLD | NEW |