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

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

Issue 2349343002: DevTools: introduce persistence/ module (Closed)
Patch Set: simplify test Created 4 years, 2 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 }, 207 },
208 208
209 /** 209 /**
210 * @param {?WebInspector.UISourceCode} uiSourceCode 210 * @param {?WebInspector.UISourceCode} uiSourceCode
211 * @return {boolean} 211 * @return {boolean}
212 */ 212 */
213 _isFormatableScript: function(uiSourceCode) 213 _isFormatableScript: function(uiSourceCode)
214 { 214 {
215 if (!uiSourceCode) 215 if (!uiSourceCode)
216 return false; 216 return false;
217 if (WebInspector.persistence.binding(uiSourceCode))
218 return false;
217 var supportedProjectTypes = [WebInspector.projectTypes.Network, WebInspe ctor.projectTypes.Debugger, WebInspector.projectTypes.ContentScripts]; 219 var supportedProjectTypes = [WebInspector.projectTypes.Network, WebInspe ctor.projectTypes.Debugger, WebInspector.projectTypes.ContentScripts];
218 if (supportedProjectTypes.indexOf(uiSourceCode.project().type()) === -1) 220 if (supportedProjectTypes.indexOf(uiSourceCode.project().type()) === -1)
219 return false; 221 return false;
220 return uiSourceCode.contentType().hasScripts(); 222 return uiSourceCode.contentType().hasScripts();
221 }, 223 },
222 224
223 _toggleFormatScriptSource: function() 225 _toggleFormatScriptSource: function()
224 { 226 {
225 var uiSourceCode = this._sourcesView.currentUISourceCode(); 227 var uiSourceCode = this._sourcesView.currentUISourceCode();
226 if (this._isFormatableScript(uiSourceCode)) 228 if (this._isFormatableScript(uiSourceCode))
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 388
387 var targets = WebInspector.targetManager.targets(); 389 var targets = WebInspector.targetManager.targets();
388 for (var i = 0; i < targets.length; ++i) { 390 for (var i = 0; i < targets.length; ++i) {
389 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i])); 391 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i]));
390 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping); 392 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping);
391 } 393 }
392 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping); 394 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
393 } 395 }
394 } 396 }
395 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698