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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @implements {WebInspector.ContentProvider} | 7 * @implements {WebInspector.ContentProvider} |
8 * @param {string} contentURL | 8 * @param {string} contentURL |
9 * @param {!WebInspector.ResourceType} contentType | 9 * @param {!WebInspector.ResourceType} contentType |
10 * @param {function():!Promise<string>} lazyContent | 10 * @param {function():!Promise<string>} lazyContent |
11 */ | 11 */ |
12 WebInspector.StaticContentProvider = function(contentURL, contentType, lazyConte
nt) | 12 WebInspector.StaticContentProvider = function(contentURL, contentType, lazyConte
nt) |
13 { | 13 { |
14 this._contentURL = contentURL; | 14 this._contentURL = contentURL; |
15 this._contentType = contentType; | 15 this._contentType = contentType; |
16 this._lazyContent = lazyContent; | 16 this._lazyContent = lazyContent; |
17 } | 17 }; |
18 | 18 |
19 /** | 19 /** |
20 * @param {string} contentURL | 20 * @param {string} contentURL |
21 * @param {!WebInspector.ResourceType} contentType | 21 * @param {!WebInspector.ResourceType} contentType |
22 * @param {string} content | 22 * @param {string} content |
23 * @return {!WebInspector.StaticContentProvider} | 23 * @return {!WebInspector.StaticContentProvider} |
24 */ | 24 */ |
25 WebInspector.StaticContentProvider.fromString = function(contentURL, contentType
, content) | 25 WebInspector.StaticContentProvider.fromString = function(contentURL, contentType
, content) |
26 { | 26 { |
27 var lazyContent = () => Promise.resolve(content); | 27 var lazyContent = () => Promise.resolve(content); |
28 return new WebInspector.StaticContentProvider(contentURL, contentType, lazyC
ontent); | 28 return new WebInspector.StaticContentProvider(contentURL, contentType, lazyC
ontent); |
29 } | 29 }; |
30 | 30 |
31 WebInspector.StaticContentProvider.prototype = { | 31 WebInspector.StaticContentProvider.prototype = { |
32 /** | 32 /** |
33 * @override | 33 * @override |
34 * @return {string} | 34 * @return {string} |
35 */ | 35 */ |
36 contentURL: function() | 36 contentURL: function() |
37 { | 37 { |
38 return this._contentURL; | 38 return this._contentURL; |
39 }, | 39 }, |
(...skipping 28 matching lines...) Expand all Loading... |
68 /** | 68 /** |
69 * @param {string} content | 69 * @param {string} content |
70 */ | 70 */ |
71 function performSearch(content) | 71 function performSearch(content) |
72 { | 72 { |
73 callback(WebInspector.ContentProvider.performSearchInContent(content
, query, caseSensitive, isRegex)); | 73 callback(WebInspector.ContentProvider.performSearchInContent(content
, query, caseSensitive, isRegex)); |
74 } | 74 } |
75 | 75 |
76 this._lazyContent().then(performSearch); | 76 this._lazyContent().then(performSearch); |
77 } | 77 } |
78 } | 78 }; |
OLD | NEW |