Index: third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js b/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js |
index ffaa5bb644d70a1c9db30afa00009cefeb1778ac..87130c1b4f07386548dcf2bd9080712aebdfd3e9 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js |
+++ b/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js |
@@ -1,78 +1,74 @@ |
// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
- |
/** |
- * @constructor |
* @implements {WebInspector.ContentProvider} |
- * @param {string} contentURL |
- * @param {!WebInspector.ResourceType} contentType |
- * @param {function():!Promise<string>} lazyContent |
+ * @unrestricted |
*/ |
-WebInspector.StaticContentProvider = function(contentURL, contentType, lazyContent) |
-{ |
+WebInspector.StaticContentProvider = class { |
+ /** |
+ * @param {string} contentURL |
+ * @param {!WebInspector.ResourceType} contentType |
+ * @param {function():!Promise<string>} lazyContent |
+ */ |
+ constructor(contentURL, contentType, lazyContent) { |
this._contentURL = contentURL; |
this._contentType = contentType; |
this._lazyContent = lazyContent; |
-}; |
+ } |
-/** |
- * @param {string} contentURL |
- * @param {!WebInspector.ResourceType} contentType |
- * @param {string} content |
- * @return {!WebInspector.StaticContentProvider} |
- */ |
-WebInspector.StaticContentProvider.fromString = function(contentURL, contentType, content) |
-{ |
+ /** |
+ * @param {string} contentURL |
+ * @param {!WebInspector.ResourceType} contentType |
+ * @param {string} content |
+ * @return {!WebInspector.StaticContentProvider} |
+ */ |
+ static fromString(contentURL, contentType, content) { |
var lazyContent = () => Promise.resolve(content); |
return new WebInspector.StaticContentProvider(contentURL, contentType, lazyContent); |
-}; |
+ } |
-WebInspector.StaticContentProvider.prototype = { |
- /** |
- * @override |
- * @return {string} |
- */ |
- contentURL: function() |
- { |
- return this._contentURL; |
- }, |
+ /** |
+ * @override |
+ * @return {string} |
+ */ |
+ contentURL() { |
+ return this._contentURL; |
+ } |
- /** |
- * @override |
- * @return {!WebInspector.ResourceType} |
- */ |
- contentType: function() |
- { |
- return this._contentType; |
- }, |
+ /** |
+ * @override |
+ * @return {!WebInspector.ResourceType} |
+ */ |
+ contentType() { |
+ return this._contentType; |
+ } |
- /** |
- * @override |
- * @return {!Promise<?string>} |
- */ |
- requestContent: function() |
- { |
- return /** @type {!Promise<?string>} */(this._lazyContent()); |
- }, |
+ /** |
+ * @override |
+ * @return {!Promise<?string>} |
+ */ |
+ requestContent() { |
+ return /** @type {!Promise<?string>} */ (this._lazyContent()); |
+ } |
+ /** |
+ * @override |
+ * @param {string} query |
+ * @param {boolean} caseSensitive |
+ * @param {boolean} isRegex |
+ * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback |
+ */ |
+ searchInContent(query, caseSensitive, isRegex, callback) { |
/** |
- * @override |
- * @param {string} query |
- * @param {boolean} caseSensitive |
- * @param {boolean} isRegex |
- * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback |
+ * @param {string} content |
*/ |
- searchInContent: function(query, caseSensitive, isRegex, callback) |
- { |
- /** |
- * @param {string} content |
- */ |
- function performSearch(content) |
- { |
- callback(WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex)); |
- } |
- |
- this._lazyContent().then(performSearch); |
+ function performSearch(content) { |
+ callback(WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex)); |
} |
+ |
+ this._lazyContent().then(performSearch); |
+ } |
}; |
+ |
+ |