| OLD | NEW |
| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (Persistence.persistence.binding(uiSourceCode)) | 209 if (Persistence.persistence.binding(uiSourceCode)) |
| 210 return false; | 210 return false; |
| 211 var supportedProjectTypes = | 211 if (Bindings.NetworkProject.isNetworkUISourceCode(uiSourceCode) || |
| 212 [Workspace.projectTypes.Network, Workspace.projectTypes.Debugger, Worksp
ace.projectTypes.ContentScripts]; | 212 Bindings.DefaultScriptMapping.isDebuggerUISourceCode(uiSourceCode)) |
| 213 if (supportedProjectTypes.indexOf(uiSourceCode.project().type()) === -1) | 213 return uiSourceCode.contentType().hasScripts(); |
| 214 return false; | 214 return false; |
| 215 return uiSourceCode.contentType().hasScripts(); | |
| 216 } | 215 } |
| 217 | 216 |
| 218 _toggleFormatScriptSource() { | 217 _toggleFormatScriptSource() { |
| 219 var uiSourceCode = this._sourcesView.currentUISourceCode(); | 218 var uiSourceCode = this._sourcesView.currentUISourceCode(); |
| 220 if (this._isFormatableScript(uiSourceCode)) | 219 if (this._isFormatableScript(uiSourceCode)) |
| 221 this._formatUISourceCodeScript(uiSourceCode); | 220 this._formatUISourceCodeScript(uiSourceCode); |
| 222 } | 221 } |
| 223 | 222 |
| 224 /** | 223 /** |
| 225 * @param {!Workspace.UISourceCode} uiSourceCode | 224 * @param {!Workspace.UISourceCode} uiSourceCode |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 var targets = SDK.targetManager.targets(); | 376 var targets = SDK.targetManager.targets(); |
| 378 for (var i = 0; i < targets.length; ++i) { | 377 for (var i = 0; i < targets.length; ++i) { |
| 379 var scriptMapping = | 378 var scriptMapping = |
| 380 /** @type {!Sources.FormatterScriptMapping} */ (this._scriptMappingB
yTarget.get(targets[i])); | 379 /** @type {!Sources.FormatterScriptMapping} */ (this._scriptMappingB
yTarget.get(targets[i])); |
| 381 Bindings.debuggerWorkspaceBinding.setSourceMapping(targets[i], formatted
UISourceCode, scriptMapping); | 380 Bindings.debuggerWorkspaceBinding.setSourceMapping(targets[i], formatted
UISourceCode, scriptMapping); |
| 382 } | 381 } |
| 383 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMapping); | 382 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMapping); |
| 384 } | 383 } |
| 385 } | 384 } |
| 386 }; | 385 }; |
| OLD | NEW |