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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/ScriptFormatterEditorAction.js

Issue 1957053002: DevTools: simplify NetworkProject.addFileForURL method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 7 months 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.DebuggerSourceMapping} 7 * @implements {WebInspector.DebuggerSourceMapping}
8 * @param {!WebInspector.DebuggerModel} debuggerModel 8 * @param {!WebInspector.DebuggerModel} debuggerModel
9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction
10 */ 10 */
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 361 }
362 362
363 /** 363 /**
364 * @this {WebInspector.ScriptFormatterEditorAction} 364 * @this {WebInspector.ScriptFormatterEditorAction}
365 * @param {string} formattedContent 365 * @param {string} formattedContent
366 * @param {!WebInspector.FormatterSourceMapping} formatterMapping 366 * @param {!WebInspector.FormatterSourceMapping} formatterMapping
367 */ 367 */
368 function innerCallback(formattedContent, formatterMapping) 368 function innerCallback(formattedContent, formatterMapping)
369 { 369 {
370 var scripts = this._scriptsForUISourceCode(uiSourceCode); 370 var scripts = this._scriptsForUISourceCode(uiSourceCode);
371 var contentProvider = new WebInspector.StaticContentProvider(uiSourc eCode.contentType(), formattedContent); 371 var contentProvider = new WebInspector.StaticContentProvider(uiSourc eCode.contentType(), formattedContent, uiSourceCode.contentURL());
dgozman 2016/05/09 21:55:35 uiSourceCode.url() + ":formatted"
lushnikov 2016/05/09 22:06:59 Done.
372 var formattedUISourceCode = this._project.addContentProvider(uiSourc eCode.url() + ":formatted", contentProvider); 372 var formattedUISourceCode = this._project.addContentProvider(uiSourc eCode.url() + ":formatted", contentProvider);
373 var formattedPath = formattedUISourceCode.url(); 373 var formattedPath = formattedUISourceCode.url();
374 var formatData = new WebInspector.FormatterScriptMapping.FormatData( uiSourceCode.project().id(), uiSourceCode.url(), formatterMapping, scripts); 374 var formatData = new WebInspector.FormatterScriptMapping.FormatData( uiSourceCode.project().id(), uiSourceCode.url(), formatterMapping, scripts);
375 this._formatData.set(formattedUISourceCode, formatData); 375 this._formatData.set(formattedUISourceCode, formatData);
376 var path = uiSourceCode.project().id() + ":" + uiSourceCode.url(); 376 var path = uiSourceCode.project().id() + ":" + uiSourceCode.url();
377 this._formattedPaths.set(path, formattedPath); 377 this._formattedPaths.set(path, formattedPath);
378 this._pathsToFormatOnLoad.add(path); 378 this._pathsToFormatOnLoad.add(path);
379 for (var i = 0; i < scripts.length; ++i) { 379 for (var i = 0; i < scripts.length; ++i) {
380 this._uiSourceCodes.set(scripts[i], formattedUISourceCode); 380 this._uiSourceCodes.set(scripts[i], formattedUISourceCode);
381 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(scripts[i].target())); 381 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(scripts[i].target()));
382 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(scripts[ i], scriptMapping); 382 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(scripts[ i], scriptMapping);
383 } 383 }
384 384
385 var targets = WebInspector.targetManager.targets(); 385 var targets = WebInspector.targetManager.targets();
386 for (var i = 0; i < targets.length; ++i) { 386 for (var i = 0; i < targets.length; ++i) {
387 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i])); 387 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i]));
388 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping); 388 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping);
389 } 389 }
390 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping); 390 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
391 } 391 }
392 } 392 }
393 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698