OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 if (this._content || this._contentLoaded) { | 237 if (this._content || this._contentLoaded) { |
238 callback(this._content); | 238 callback(this._content); |
239 return; | 239 return; |
240 } | 240 } |
241 this._requestContentCallbacks.push(callback); | 241 this._requestContentCallbacks.push(callback); |
242 if (this._requestContentCallbacks.length === 1) | 242 if (this._requestContentCallbacks.length === 1) |
243 this._project.requestFileContent(this, this._fireContentAvailable.bi
nd(this)); | 243 this._project.requestFileContent(this, this._fireContentAvailable.bi
nd(this)); |
244 }, | 244 }, |
245 | 245 |
246 /** | 246 /** |
| 247 * @return {!Promise.<?string>} |
| 248 */ |
| 249 requestContentPromise: function() |
| 250 { |
| 251 return new Promise(promiseConstructor.bind(this)); |
| 252 |
| 253 function promiseConstructor(succ, fail) |
| 254 { |
| 255 this.requestContent(succ); |
| 256 } |
| 257 }, |
| 258 |
| 259 /** |
247 * @param {function()} callback | 260 * @param {function()} callback |
248 */ | 261 */ |
249 _pushCheckContentUpdatedCallback: function(callback) | 262 _pushCheckContentUpdatedCallback: function(callback) |
250 { | 263 { |
251 if (!this._checkContentUpdatedCallbacks) | 264 if (!this._checkContentUpdatedCallbacks) |
252 this._checkContentUpdatedCallbacks = []; | 265 this._checkContentUpdatedCallbacks = []; |
253 this._checkContentUpdatedCallbacks.push(callback); | 266 this._checkContentUpdatedCallbacks.push(callback); |
254 }, | 267 }, |
255 | 268 |
256 _terminateContentCheck: function() | 269 _terminateContentCheck: function() |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 * @param {string} query | 732 * @param {string} query |
720 * @param {boolean} caseSensitive | 733 * @param {boolean} caseSensitive |
721 * @param {boolean} isRegex | 734 * @param {boolean} isRegex |
722 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback | 735 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback |
723 */ | 736 */ |
724 searchInContent: function(query, caseSensitive, isRegex, callback) | 737 searchInContent: function(query, caseSensitive, isRegex, callback) |
725 { | 738 { |
726 callback([]); | 739 callback([]); |
727 } | 740 } |
728 } | 741 } |
OLD | NEW |