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

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

Issue 658293003: DevTools: initialize "format script" button with current UISourceCode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.Target} target 8 * @param {!WebInspector.Target} target
9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction
10 */ 10 */
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (this._button) 224 if (this._button)
225 return this._button.element; 225 return this._button.element;
226 226
227 this._sourcesView = sourcesView; 227 this._sourcesView = sourcesView;
228 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito rSelected, this._editorSelected.bind(this)); 228 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito rSelected, this._editorSelected.bind(this));
229 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito rClosed, this._editorClosed.bind(this)); 229 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito rClosed, this._editorClosed.bind(this));
230 230
231 this._button = new WebInspector.StatusBarButton(WebInspector.UIString("P retty print"), "sources-toggle-pretty-print-status-bar-item"); 231 this._button = new WebInspector.StatusBarButton(WebInspector.UIString("P retty print"), "sources-toggle-pretty-print-status-bar-item");
232 this._button.toggled = false; 232 this._button.toggled = false;
233 this._button.addEventListener("click", this._toggleFormatScriptSource, t his); 233 this._button.addEventListener("click", this._toggleFormatScriptSource, t his);
234 this._updateButton(null); 234 this._updateButton(sourcesView.currentUISourceCode());
235 235
236 return this._button.element; 236 return this._button.element;
237 }, 237 },
238 238
239 /** 239 /**
240 * @param {?WebInspector.UISourceCode} uiSourceCode 240 * @param {?WebInspector.UISourceCode} uiSourceCode
241 * @return {boolean} 241 * @return {boolean}
242 */ 242 */
243 _isFormatableScript: function(uiSourceCode) 243 _isFormatableScript: function(uiSourceCode)
244 { 244 {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 var targets = WebInspector.targetManager.targets(); 428 var targets = WebInspector.targetManager.targets();
429 for (var i = 0; i < targets.length; ++i) { 429 for (var i = 0; i < targets.length; ++i) {
430 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i])); 430 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i]));
431 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping); 431 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping);
432 } 432 }
433 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping); 433 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
434 } 434 }
435 } 435 }
436 } 436 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698