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

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

Issue 2546473005: [DevTools] Remove unnecessary checks for project types. (Closed)
Patch Set: fixed comment Created 4 years 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 * @implements {Bindings.DebuggerSourceMapping} 5 * @implements {Bindings.DebuggerSourceMapping}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Sources.FormatterScriptMapping = class { 8 Sources.FormatterScriptMapping = class {
9 /** 9 /**
10 * @param {!SDK.DebuggerModel} debuggerModel 10 * @param {!SDK.DebuggerModel} debuggerModel
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return this._button; 199 return this._button;
200 } 200 }
201 201
202 /** 202 /**
203 * @param {?Workspace.UISourceCode} uiSourceCode 203 * @param {?Workspace.UISourceCode} uiSourceCode
204 * @return {boolean} 204 * @return {boolean}
205 */ 205 */
206 _isFormatableScript(uiSourceCode) { 206 _isFormatableScript(uiSourceCode) {
207 if (!uiSourceCode) 207 if (!uiSourceCode)
208 return false; 208 return false;
209 if (uiSourceCode.project().canSetFileContent())
210 return false;
211 if (uiSourceCode.project().type() === Workspace.projectTypes.Formatter)
212 return false;
209 if (Persistence.persistence.binding(uiSourceCode)) 213 if (Persistence.persistence.binding(uiSourceCode))
210 return false; 214 return false;
211 var supportedProjectTypes =
212 [Workspace.projectTypes.Network, Workspace.projectTypes.Debugger, Worksp ace.projectTypes.ContentScripts];
213 if (supportedProjectTypes.indexOf(uiSourceCode.project().type()) === -1)
214 return false;
215 return uiSourceCode.contentType().hasScripts(); 215 return uiSourceCode.contentType().hasScripts();
216 } 216 }
217 217
218 _toggleFormatScriptSource() { 218 _toggleFormatScriptSource() {
219 var uiSourceCode = this._sourcesView.currentUISourceCode(); 219 var uiSourceCode = this._sourcesView.currentUISourceCode();
220 if (this._isFormatableScript(uiSourceCode)) 220 if (this._isFormatableScript(uiSourceCode))
221 this._formatUISourceCodeScript(uiSourceCode); 221 this._formatUISourceCodeScript(uiSourceCode);
222 } 222 }
223 223
224 /** 224 /**
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 var targets = SDK.targetManager.targets(); 377 var targets = SDK.targetManager.targets();
378 for (var i = 0; i < targets.length; ++i) { 378 for (var i = 0; i < targets.length; ++i) {
379 var scriptMapping = 379 var scriptMapping =
380 /** @type {!Sources.FormatterScriptMapping} */ (this._scriptMappingB yTarget.get(targets[i])); 380 /** @type {!Sources.FormatterScriptMapping} */ (this._scriptMappingB yTarget.get(targets[i]));
381 Bindings.debuggerWorkspaceBinding.setSourceMapping(targets[i], formatted UISourceCode, scriptMapping); 381 Bindings.debuggerWorkspaceBinding.setSourceMapping(targets[i], formatted UISourceCode, scriptMapping);
382 } 382 }
383 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMapping); 383 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMapping);
384 } 384 }
385 } 385 }
386 }; 386 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698