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

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

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline Created 4 years, 11 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 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @implements {WebInspector.SourcesView.EditorAction} 8 * @implements {WebInspector.SourcesView.EditorAction}
9 */ 9 */
10 WebInspector.InplaceFormatterEditorAction = function() 10 WebInspector.InplaceFormatterEditorAction = function()
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 _formatSourceInPlace: function() 77 _formatSourceInPlace: function()
78 { 78 {
79 var uiSourceCode = this._sourcesView.currentUISourceCode(); 79 var uiSourceCode = this._sourcesView.currentUISourceCode();
80 if (!this._isFormattable(uiSourceCode)) 80 if (!this._isFormattable(uiSourceCode))
81 return; 81 return;
82 82
83 if (uiSourceCode.isDirty()) 83 if (uiSourceCode.isDirty())
84 contentLoaded.call(this, uiSourceCode.workingCopy()); 84 contentLoaded.call(this, uiSourceCode.workingCopy());
85 else 85 else
86 uiSourceCode.requestContent(contentLoaded.bind(this)); 86 uiSourceCode.requestContent().then(contentLoaded.bind(this));
87 87
88 /** 88 /**
89 * @this {WebInspector.InplaceFormatterEditorAction} 89 * @this {WebInspector.InplaceFormatterEditorAction}
90 * @param {?string} content 90 * @param {?string} content
91 */ 91 */
92 function contentLoaded(content) 92 function contentLoaded(content)
93 { 93 {
94 var highlighterType = WebInspector.NetworkProject.uiSourceCodeMimeTy pe(uiSourceCode); 94 var highlighterType = WebInspector.NetworkProject.uiSourceCodeMimeTy pe(uiSourceCode);
95 WebInspector.Formatter.format(uiSourceCode.contentType(), highlighte rType, content || "", innerCallback.bind(this)); 95 WebInspector.Formatter.format(uiSourceCode.contentType(), highlighte rType, content || "", innerCallback.bind(this));
96 } 96 }
(...skipping 11 matching lines...) Expand all
108 var start = [0, 0]; 108 var start = [0, 0];
109 if (sourceFrame) { 109 if (sourceFrame) {
110 var selection = sourceFrame.selection(); 110 var selection = sourceFrame.selection();
111 start = formatterMapping.originalToFormatted(selection.startLine , selection.startColumn); 111 start = formatterMapping.originalToFormatted(selection.startLine , selection.startColumn);
112 } 112 }
113 uiSourceCode.setWorkingCopy(formattedContent); 113 uiSourceCode.setWorkingCopy(formattedContent);
114 this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1 ]); 114 this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1 ]);
115 } 115 }
116 }, 116 },
117 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698