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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 function maybeSearchFinished() | 49 function maybeSearchFinished() |
50 { | 50 { |
51 if (callbacksLeft === 0) | 51 if (callbacksLeft === 0) |
52 searchFinishedCallback(); | 52 searchFinishedCallback(); |
53 } | 53 } |
54 | 54 |
55 function searchCallbackWrapper(uiSourceCode, searchMatches) | 55 function searchCallbackWrapper(uiSourceCode, searchMatches) |
56 { | 56 { |
57 if (searchMatches.length) { | 57 if (searchMatches.length) { |
58 var searchResult = {file: uiSourceCode, searchMatches: searchMat
ches}; | 58 var searchResult = new WebInspector.FileBasedSearchResultsPane.S
earchResult(uiSourceCode, searchMatches); |
59 searchResultCallback(searchResult); | 59 searchResultCallback(searchResult); |
60 } | 60 } |
61 --callbacksLeft; | 61 --callbacksLeft; |
62 maybeSearchFinished(); | 62 maybeSearchFinished(); |
63 } | 63 } |
64 | 64 |
65 var uiSourceCodes = this._sortedUISourceCodes(); | 65 var uiSourceCodes = this._sortedUISourceCodes(); |
66 // FIXME: Enable support for counting matches for incremental search. | 66 // FIXME: Enable support for counting matches for incremental search. |
67 // FIXME: Enable support for bounding search results/matches number to k
eep inspector responsive. | 67 // FIXME: Enable support for bounding search results/matches number to k
eep inspector responsive. |
68 for (var i = 0; i < uiSourceCodes.length; i++) { | 68 for (var i = 0; i < uiSourceCodes.length; i++) { |
69 var uiSourceCode = uiSourceCodes[i]; | 69 var uiSourceCode = uiSourceCodes[i]; |
70 // FIXME: Add setting to search in content scripts as well. | 70 // FIXME: Add setting to search in content scripts as well. |
71 if (!uiSourceCode.isContentScript) { | 71 if (!uiSourceCode.isContentScript) { |
72 // Increase callbacksLeft first because searchInContent call cou
ld be synchronous. | 72 // Increase callbacksLeft first because searchInContent call cou
ld be synchronous. |
73 callbacksLeft++; | 73 callbacksLeft++; |
74 // FIXME: We should not request next searchInContent unless prev
ious one is already finished. | 74 // FIXME: We should not request next searchInContent unless prev
ious one is already finished. |
75 uiSourceCode.searchInContent(searchConfig.query, searchCallbackW
rapper.bind(this, uiSourceCode)); | 75 uiSourceCode.searchInContent(searchConfig.query, !searchConfig.i
gnoreCase, searchConfig.isRegex, searchCallbackWrapper.bind(this, uiSourceCode))
; |
76 } | 76 } |
77 } | 77 } |
78 maybeSearchFinished(); | 78 maybeSearchFinished(); |
79 }, | 79 }, |
80 | 80 |
81 stopSearch: function() | 81 stopSearch: function() |
82 { | 82 { |
83 // FIXME: Implement search so that it could be stopped. | 83 // FIXME: Implement search so that it could be stopped. |
84 }, | 84 }, |
85 | 85 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 * @return {string} | 150 * @return {string} |
151 */ | 151 */ |
152 fileName: function(file) | 152 fileName: function(file) |
153 { | 153 { |
154 var uiSourceCode = file; | 154 var uiSourceCode = file; |
155 return uiSourceCode.url; | 155 return uiSourceCode.url; |
156 }, | 156 }, |
157 } | 157 } |
158 | 158 |
159 WebInspector.ScriptsSearchResultsPane.prototype.__proto__ = WebInspector.FileBas
edSearchResultsPane.prototype; | 159 WebInspector.ScriptsSearchResultsPane.prototype.__proto__ = WebInspector.FileBas
edSearchResultsPane.prototype; |
OLD | NEW |