| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @implements {Common.ContentProvider} | 5 * @implements {Common.ContentProvider} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Common.StaticContentProvider = class { | 8 Common.StaticContentProvider = class { |
| 9 /** | 9 /** |
| 10 * @param {string} contentURL | 10 * @param {string} contentURL |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 */ | 42 */ |
| 43 contentType() { | 43 contentType() { |
| 44 return this._contentType; | 44 return this._contentType; |
| 45 } | 45 } |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @override | 48 * @override |
| 49 * @return {!Promise<?string>} | 49 * @return {!Promise<?string>} |
| 50 */ | 50 */ |
| 51 requestContent() { | 51 requestContent() { |
| 52 return /** @type {!Promise<?string>} */ (this._lazyContent()); | 52 return this._lazyContent(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * @override | 56 * @override |
| 57 * @param {string} query | 57 * @param {string} query |
| 58 * @param {boolean} caseSensitive | 58 * @param {boolean} caseSensitive |
| 59 * @param {boolean} isRegex | 59 * @param {boolean} isRegex |
| 60 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback | 60 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback |
| 61 */ | 61 */ |
| 62 searchInContent(query, caseSensitive, isRegex, callback) { | 62 searchInContent(query, caseSensitive, isRegex, callback) { |
| 63 /** | 63 /** |
| 64 * @param {?string} content | 64 * @param {?string} content |
| 65 */ | 65 */ |
| 66 function performSearch(content) { | 66 function performSearch(content) { |
| 67 if (!content) { | 67 if (!content) { |
| 68 callback(/** @type {!Array<!Common.ContentProvider.SearchMatch>} */ ([])
); | 68 callback(/** @type {!Array<!Common.ContentProvider.SearchMatch>} */ ([])
); |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 callback(Common.ContentProvider.performSearchInContent(content, query, cas
eSensitive, isRegex)); | 71 callback(Common.ContentProvider.performSearchInContent(content, query, cas
eSensitive, isRegex)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 this._lazyContent().then(performSearch); | 74 this._lazyContent().then(performSearch); |
| 75 } | 75 } |
| 76 }; | 76 }; |
| OLD | NEW |