| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * @interface | 31 * @interface |
| 32 */ | 32 */ |
| 33 Common.ContentProvider = function() {}; | 33 Common.ContentProvider = function() {}; |
| 34 | 34 |
| 35 Common.ContentProvider.prototype = { | 35 Common.ContentProvider.prototype = { |
| 36 /** | 36 /** |
| 37 * @return {string} | 37 * @return {string} |
| 38 */ | 38 */ |
| 39 contentURL: function() {}, | 39 contentURL() {}, |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * @return {!Common.ResourceType} | 42 * @return {!Common.ResourceType} |
| 43 */ | 43 */ |
| 44 contentType: function() {}, | 44 contentType() {}, |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * @return {!Promise<?string>} | 47 * @return {!Promise<?string>} |
| 48 */ | 48 */ |
| 49 requestContent: function() {}, | 49 requestContent() {}, |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * @param {string} query | 52 * @param {string} query |
| 53 * @param {boolean} caseSensitive | 53 * @param {boolean} caseSensitive |
| 54 * @param {boolean} isRegex | 54 * @param {boolean} isRegex |
| 55 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback | 55 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback |
| 56 */ | 56 */ |
| 57 searchInContent: function(query, caseSensitive, isRegex, callback) {} | 57 searchInContent(query, caseSensitive, isRegex, callback) {} |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * @unrestricted | 61 * @unrestricted |
| 62 */ | 62 */ |
| 63 Common.ContentProvider.SearchMatch = class { | 63 Common.ContentProvider.SearchMatch = class { |
| 64 /** | 64 /** |
| 65 * @param {number} lineNumber | 65 * @param {number} lineNumber |
| 66 * @param {string} lineContent | 66 * @param {string} lineContent |
| 67 */ | 67 */ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 * @return {?string} | 100 * @return {?string} |
| 101 */ | 101 */ |
| 102 Common.ContentProvider.contentAsDataURL = function(content, mimeType, contentEnc
oded, charset) { | 102 Common.ContentProvider.contentAsDataURL = function(content, mimeType, contentEnc
oded, charset) { |
| 103 const maxDataUrlSize = 1024 * 1024; | 103 const maxDataUrlSize = 1024 * 1024; |
| 104 if (content === null || content.length > maxDataUrlSize) | 104 if (content === null || content.length > maxDataUrlSize) |
| 105 return null; | 105 return null; |
| 106 | 106 |
| 107 return 'data:' + mimeType + (charset ? ';charset=' + charset : '') + (contentE
ncoded ? ';base64' : '') + ',' + | 107 return 'data:' + mimeType + (charset ? ';charset=' + charset : '') + (contentE
ncoded ? ';base64' : '') + ',' + |
| 108 content; | 108 content; |
| 109 }; | 109 }; |
| OLD | NEW |