| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 /** @type {!Map.<!WebInspector.UISourceCode, string>} */ | 42 /** @type {!Map.<!WebInspector.UISourceCode, string>} */ |
| 43 this._snippetIdForUISourceCode = new Map(); | 43 this._snippetIdForUISourceCode = new Map(); |
| 44 | 44 |
| 45 /** @type {!Map.<!WebInspector.Target, !WebInspector.SnippetScriptMapping>}
*/ | 45 /** @type {!Map.<!WebInspector.Target, !WebInspector.SnippetScriptMapping>}
*/ |
| 46 this._mappingForTarget = new Map(); | 46 this._mappingForTarget = new Map(); |
| 47 this._snippetStorage = new WebInspector.SnippetStorage("script", "Script sni
ppet #"); | 47 this._snippetStorage = new WebInspector.SnippetStorage("script", "Script sni
ppet #"); |
| 48 this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSettin
g("lastSnippetEvaluationIndex", 0); | 48 this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSettin
g("lastSnippetEvaluationIndex", 0); |
| 49 this._projectId = WebInspector.projectTypes.Snippets + ":"; | 49 this._projectId = WebInspector.projectTypes.Snippets + ":"; |
| 50 this._projectDelegate = new WebInspector.SnippetsProjectDelegate(workspace,
this, this._projectId); | 50 this._projectDelegate = new WebInspector.SnippetsProjectDelegate(workspace,
this, this._projectId); |
| 51 this._project = this._workspace.project(this._projectId); | 51 this._project = this._workspace.project(this._projectId); |
| 52 this.reset(); | 52 this._loadSnippets(); |
| 53 WebInspector.targetManager.observeTargets(this); | 53 WebInspector.targetManager.observeTargets(this); |
| 54 } | 54 } |
| 55 | 55 |
| 56 WebInspector.ScriptSnippetModel.prototype = { | 56 WebInspector.ScriptSnippetModel.prototype = { |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * @param {!WebInspector.Target} target | 59 * @param {!WebInspector.Target} target |
| 60 */ | 60 */ |
| 61 targetAdded: function(target) | 61 targetAdded: function(target) |
| 62 { | 62 { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 _snippetIdForSourceURL: function(sourceURL) | 364 _snippetIdForSourceURL: function(sourceURL) |
| 365 { | 365 { |
| 366 var snippetPrefix = WebInspector.Script.snippetSourceURLPrefix; | 366 var snippetPrefix = WebInspector.Script.snippetSourceURLPrefix; |
| 367 if (!sourceURL.startsWith(snippetPrefix)) | 367 if (!sourceURL.startsWith(snippetPrefix)) |
| 368 return null; | 368 return null; |
| 369 var splitURL = sourceURL.substring(snippetPrefix.length).split("_"); | 369 var splitURL = sourceURL.substring(snippetPrefix.length).split("_"); |
| 370 var snippetId = splitURL[0]; | 370 var snippetId = splitURL[0]; |
| 371 return snippetId; | 371 return snippetId; |
| 372 }, | 372 }, |
| 373 | 373 |
| 374 reset: function() | |
| 375 { | |
| 376 this._mappingForTarget.values().forEach(function(mapping){mapping._reset
()}); | |
| 377 /** @type {!Object.<string, !WebInspector.UISourceCode>} */ | |
| 378 this._uiSourceCodeForSnippetId = {}; | |
| 379 this._snippetIdForUISourceCode = new Map(); | |
| 380 this._projectDelegate.reset(); | |
| 381 this._loadSnippets(); | |
| 382 }, | |
| 383 | |
| 384 __proto__: WebInspector.Object.prototype | 374 __proto__: WebInspector.Object.prototype |
| 385 } | 375 } |
| 386 | 376 |
| 387 /** | 377 /** |
| 388 * @constructor | 378 * @constructor |
| 389 * @implements {WebInspector.ScriptSourceMapping} | 379 * @implements {WebInspector.ScriptSourceMapping} |
| 390 * @param {!WebInspector.Target} target | 380 * @param {!WebInspector.Target} target |
| 391 * @param {!WebInspector.ScriptSnippetModel} scriptSnippetModel | 381 * @param {!WebInspector.ScriptSnippetModel} scriptSnippetModel |
| 392 */ | 382 */ |
| 393 WebInspector.SnippetScriptMapping = function(target, scriptSnippetModel) | 383 WebInspector.SnippetScriptMapping = function(target, scriptSnippetModel) |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 this._model.deleteScriptSnippet(path); | 663 this._model.deleteScriptSnippet(path); |
| 674 }, | 664 }, |
| 675 | 665 |
| 676 __proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype | 666 __proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype |
| 677 } | 667 } |
| 678 | 668 |
| 679 /** | 669 /** |
| 680 * @type {!WebInspector.ScriptSnippetModel} | 670 * @type {!WebInspector.ScriptSnippetModel} |
| 681 */ | 671 */ |
| 682 WebInspector.scriptSnippetModel; | 672 WebInspector.scriptSnippetModel; |
| OLD | NEW |