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

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js b/third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js
index 7829c9f9b55fa14302f80ba9378dbf8fcb065882..529e9bc96a2e919b17e219293e4cb59f5360c164 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js
@@ -27,120 +27,114 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
/**
- * @constructor
- * @extends {WebInspector.RequestContentView}
- * @param {!WebInspector.NetworkRequest} request
+ * @unrestricted
*/
-WebInspector.RequestResponseView = function(request)
-{
- WebInspector.RequestContentView.call(this, request);
-};
+WebInspector.RequestResponseView = class extends WebInspector.RequestContentView {
+ /**
+ * @param {!WebInspector.NetworkRequest} request
+ */
+ constructor(request) {
+ super(request);
+ }
-WebInspector.RequestResponseView.prototype = {
- get sourceView()
- {
- if (this._sourceView || !WebInspector.RequestView.hasTextContent(this.request))
- return this._sourceView;
+ get sourceView() {
+ if (this._sourceView || !WebInspector.RequestView.hasTextContent(this.request))
+ return this._sourceView;
- var contentProvider = new WebInspector.RequestResponseView.ContentProvider(this.request);
- var highlighterType = this.request.resourceType().canonicalMimeType() || this.request.mimeType;
- this._sourceView = WebInspector.ResourceSourceFrame.createSearchableView(contentProvider, highlighterType);
- return this._sourceView;
- },
-
- /**
- * @param {string} message
- * @return {!WebInspector.EmptyWidget}
- */
- _createMessageView: function(message)
- {
- return new WebInspector.EmptyWidget(message);
- },
+ var contentProvider = new WebInspector.RequestResponseView.ContentProvider(this.request);
+ var highlighterType = this.request.resourceType().canonicalMimeType() || this.request.mimeType;
+ this._sourceView = WebInspector.ResourceSourceFrame.createSearchableView(contentProvider, highlighterType);
+ return this._sourceView;
+ }
- contentLoaded: function()
- {
- if ((!this.request.content || !this.sourceView) && !this.request.contentError()) {
- if (!this._emptyWidget) {
- this._emptyWidget = this._createMessageView(WebInspector.UIString("This request has no response data available."));
- this._emptyWidget.show(this.element);
- }
- } else {
- if (this._emptyWidget) {
- this._emptyWidget.detach();
- delete this._emptyWidget;
- }
+ /**
+ * @param {string} message
+ * @return {!WebInspector.EmptyWidget}
+ */
+ _createMessageView(message) {
+ return new WebInspector.EmptyWidget(message);
+ }
- if (this.request.content && this.sourceView) {
- this.sourceView.show(this.element);
- } else {
- if (!this._errorView)
- this._errorView = this._createMessageView(WebInspector.UIString("Failed to load response data"));
- this._errorView.show(this.element);
- }
- }
- },
+ /**
+ * @override
+ */
+ contentLoaded() {
+ if ((!this.request.content || !this.sourceView) && !this.request.contentError()) {
+ if (!this._emptyWidget) {
+ this._emptyWidget =
+ this._createMessageView(WebInspector.UIString('This request has no response data available.'));
+ this._emptyWidget.show(this.element);
+ }
+ } else {
+ if (this._emptyWidget) {
+ this._emptyWidget.detach();
+ delete this._emptyWidget;
+ }
- __proto__: WebInspector.RequestContentView.prototype
+ if (this.request.content && this.sourceView) {
+ this.sourceView.show(this.element);
+ } else {
+ if (!this._errorView)
+ this._errorView = this._createMessageView(WebInspector.UIString('Failed to load response data'));
+ this._errorView.show(this.element);
+ }
+ }
+ }
};
/**
- * @constructor
* @implements {WebInspector.ContentProvider}
- * @param {!WebInspector.NetworkRequest} request
+ * @unrestricted
*/
-WebInspector.RequestResponseView.ContentProvider = function(request) {
+WebInspector.RequestResponseView.ContentProvider = class {
+ /**
+ * @param {!WebInspector.NetworkRequest} request
+ */
+ constructor(request) {
this._request = request;
-};
+ }
-WebInspector.RequestResponseView.ContentProvider.prototype = {
- /**
- * @override
- * @return {string}
- */
- contentURL: function()
- {
- return this._request.contentURL();
- },
+ /**
+ * @override
+ * @return {string}
+ */
+ contentURL() {
+ return this._request.contentURL();
+ }
- /**
- * @override
- * @return {!WebInspector.ResourceType}
- */
- contentType: function()
- {
- return this._request.resourceType();
- },
+ /**
+ * @override
+ * @return {!WebInspector.ResourceType}
+ */
+ contentType() {
+ return this._request.resourceType();
+ }
+ /**
+ * @override
+ * @return {!Promise<?string>}
+ */
+ requestContent() {
/**
- * @override
- * @return {!Promise<?string>}
+ * @param {?string} content
+ * @this {WebInspector.RequestResponseView.ContentProvider}
*/
- requestContent: function()
- {
- /**
- * @param {?string} content
- * @this {WebInspector.RequestResponseView.ContentProvider}
- */
- function decodeContent(content)
- {
- return this._request.contentEncoded ? window.atob(content || "") : content;
- }
+ function decodeContent(content) {
+ return this._request.contentEncoded ? window.atob(content || '') : content;
+ }
- return this._request.requestContent()
- .then(decodeContent.bind(this));
- },
+ return this._request.requestContent().then(decodeContent.bind(this));
+ }
- /**
- * @override
- * @param {string} query
- * @param {boolean} caseSensitive
- * @param {boolean} isRegex
- * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
- */
- searchInContent: function(query, caseSensitive, isRegex, callback)
- {
- this._request.searchInContent(query, caseSensitive, isRegex, callback);
- }
+ /**
+ * @override
+ * @param {string} query
+ * @param {boolean} caseSensitive
+ * @param {boolean} isRegex
+ * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
+ */
+ searchInContent(query, caseSensitive, isRegex, callback) {
+ this._request.searchInContent(query, caseSensitive, isRegex, callback);
+ }
};

Powered by Google App Engine
This is Rietveld 408576698