| 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() {};
|
|
|