| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 * @override | 112 * @override |
| 113 * @return {!WebInspector.ResourceType} | 113 * @return {!WebInspector.ResourceType} |
| 114 */ | 114 */ |
| 115 contentType: function() | 115 contentType: function() |
| 116 { | 116 { |
| 117 return this._request.resourceType(); | 117 return this._request.resourceType(); |
| 118 }, | 118 }, |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * @override | 121 * @override |
| 122 * @param {function(?string)} callback | 122 * @return {!Promise<?string>} |
| 123 */ | 123 */ |
| 124 requestContent: function(callback) | 124 requestContent: function() |
| 125 { | 125 { |
| 126 /** | 126 /** |
| 127 * @param {?string} content | 127 * @param {?string} content |
| 128 * @this {WebInspector.RequestResponseView.ContentProvider} | 128 * @this {WebInspector.RequestResponseView.ContentProvider} |
| 129 */ | 129 */ |
| 130 function decodeContent(content) | 130 function decodeContent(content) |
| 131 { | 131 { |
| 132 callback(this._request.contentEncoded ? window.atob(content || "") :
content); | 132 return this._request.contentEncoded ? window.atob(content || "") : c
ontent; |
| 133 } | 133 } |
| 134 | 134 |
| 135 this._request.requestContent(decodeContent.bind(this)); | 135 return this._request.requestContent() |
| 136 .then(decodeContent.bind(this)); |
| 136 }, | 137 }, |
| 137 | 138 |
| 138 /** | 139 /** |
| 139 * @override | 140 * @override |
| 140 * @param {string} query | 141 * @param {string} query |
| 141 * @param {boolean} caseSensitive | 142 * @param {boolean} caseSensitive |
| 142 * @param {boolean} isRegex | 143 * @param {boolean} isRegex |
| 143 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback | 144 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback |
| 144 */ | 145 */ |
| 145 searchInContent: function(query, caseSensitive, isRegex, callback) | 146 searchInContent: function(query, caseSensitive, isRegex, callback) |
| 146 { | 147 { |
| 147 this._request.searchInContent(query, caseSensitive, isRegex, callback); | 148 this._request.searchInContent(query, caseSensitive, isRegex, callback); |
| 148 } | 149 } |
| 149 } | 150 } |
| OLD | NEW |