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

Unified Diff: chrome/browser/resources/settings/search_settings.js

Issue 2924013003: DO NOT SUBMIT, Closure Compiler crash with ES6 class. (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/search_settings.js
diff --git a/chrome/browser/resources/settings/search_settings.js b/chrome/browser/resources/settings/search_settings.js
index ad541dd43c290f012d82080607789645da34f083..658619a9c9794fd5f3caef333653dbad36b4fac0 100644
--- a/chrome/browser/resources/settings/search_settings.js
+++ b/chrome/browser/resources/settings/search_settings.js
@@ -479,58 +479,53 @@ cr.define('settings', function() {
},
};
- /**
- * @constructor
- *
- * @param {string} rawQuery
- * @param {!HTMLElement} root
- */
- var SearchRequest = function(rawQuery, root) {
- /** @private {string} */
- this.rawQuery_ = rawQuery;
-
- /** @private {!HTMLElement} */
- this.root_ = root;
-
- /** @type {?RegExp} */
- this.regExp = this.generateRegExp_();
-
+ class SearchRequest {
/**
- * Whether this request was canceled before completing.
- * @type {boolean}
+ * @param {string} rawQuery
+ * @param {!HTMLElement} root
*/
- this.canceled = false;
+ constructor(rawQuery, root) {
+ /** @private {string} */
+ this.rawQuery_ = rawQuery;
- /** @private {boolean} */
- this.foundMatches_ = false;
+ /** @private {!HTMLElement} */
+ this.root_ = root;
- /** @type {!PromiseResolver} */
- this.resolver = new PromiseResolver();
+ /** @type {?RegExp} */
+ this.regExp = this.generateRegExp_();
- /** @private {!TaskQueue} */
- this.queue_ = new TaskQueue(this);
- this.queue_.onEmpty(function() {
- this.resolver.resolve(this);
- }.bind(this));
- };
+ /**
+ * Whether this request was canceled before completing.
+ * @type {boolean}
+ */
+ this.canceled = false;
- /** @private {!RegExp} */
- SearchRequest.SANITIZE_REGEX_ = /[-[\]{}()*+?.,\\^$|#\s]/g;
+ /** @private {boolean} */
+ this.foundMatches_ = false;
+
+ /** @type {!PromiseResolver} */
+ this.resolver = new PromiseResolver();
+
+ /** @private {!TaskQueue} */
+ this.queue_ = new TaskQueue(this);
+ this.queue_.onEmpty(function() {
+ this.resolver.resolve(this);
+ }.bind(this));
+ }
- SearchRequest.prototype = {
/**
* Fires this search request.
*/
- start: function() {
+ start() {
this.queue_.addTopLevelSearchTask(
new TopLevelSearchTask(this, this.root_));
- },
+ }
/**
* @return {?RegExp}
* @private
*/
- generateRegExp_: function() {
+ generateRegExp_() {
var regExp = null;
// Generate search text by escaping any characters that would be
@@ -541,30 +536,33 @@ cr.define('settings', function() {
regExp = new RegExp('(' + searchText + ')', 'i');
return regExp;
- },
+ }
/**
* @param {string} rawQuery
* @return {boolean} Whether this SearchRequest refers to an identical
* query.
*/
- isSame: function(rawQuery) {
+ isSame(rawQuery) {
return this.rawQuery_ == rawQuery;
- },
+ }
/**
* Updates the result for this search request.
* @param {boolean} found
*/
- updateMatches: function(found) {
+ updateMatches(found) {
this.foundMatches_ = this.foundMatches_ || found;
- },
+ }
/** @return {boolean} Whether any matches were found. */
- didFindMatches: function() {
+ didFindMatches() {
return this.foundMatches_;
- },
- };
+ }
+ }
+
+ /** @private {!RegExp} */
+ SearchRequest.SANITIZE_REGEX_ = /[-[\]{}()*+?.,\\^$|#\s]/g;
/** @interface */
var SearchManager = function() {};
« 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