Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: Source/devtools/front_end/sdk/ContentProviderBasedProjectDelegate.js

Issue 376163002: DevTools: Search across files should work for file:folderName queries. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 210 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
211 */ 211 */
212 searchInFileContent: function(path, query, caseSensitive, isRegex, callback) 212 searchInFileContent: function(path, query, caseSensitive, isRegex, callback)
213 { 213 {
214 var contentProvider = this._contentProviders[path]; 214 var contentProvider = this._contentProviders[path];
215 contentProvider.searchInContent(query, caseSensitive, isRegex, callback) ; 215 contentProvider.searchInContent(query, caseSensitive, isRegex, callback) ;
216 }, 216 },
217 217
218 /** 218 /**
219 * @param {!WebInspector.ProjectSearchConfig} searchConfig 219 * @param {!WebInspector.ProjectSearchConfig} searchConfig
220 * @param {!Array.<string>} filesMathingFileQuery
220 * @param {!WebInspector.Progress} progress 221 * @param {!WebInspector.Progress} progress
221 * @param {function(!Array.<string>)} callback 222 * @param {function(!Array.<string>)} callback
222 */ 223 */
223 findFilesMatchingSearchRequest: function(searchConfig, progress, callback) 224 findFilesMatchingSearchRequest: function(searchConfig, filesMathingFileQuery , progress, callback)
224 { 225 {
225 var result = []; 226 var result = [];
226 var paths = Object.keys(this._contentProviders); 227 var paths = filesMathingFileQuery;
227 var totalCount = paths.length; 228 var totalCount = paths.length;
228 if (totalCount === 0) { 229 if (totalCount === 0) {
229 // searchInContent should call back later. 230 // searchInContent should call back later.
230 setTimeout(doneCallback, 0); 231 setTimeout(doneCallback, 0);
231 return; 232 return;
232 } 233 }
233 234
234 paths = paths.filter(searchConfig.filePathMatchesFileQuery.bind(searchCo nfig));
235 var barrier = new CallbackBarrier(); 235 var barrier = new CallbackBarrier();
236 progress.setTotalWork(paths.length); 236 progress.setTotalWork(paths.length);
237 for (var i = 0; i < paths.length; ++i) 237 for (var i = 0; i < paths.length; ++i)
238 searchInContent.call(this, paths[i], barrier.createCallback(searchIn ContentCallback.bind(null, paths[i]))); 238 searchInContent.call(this, paths[i], barrier.createCallback(searchIn ContentCallback.bind(null, paths[i])));
239 barrier.callWhenDone(doneCallback); 239 barrier.callWhenDone(doneCallback);
240 240
241 /** 241 /**
242 * @param {string} path 242 * @param {string} path
243 * @param {function(boolean)} callback 243 * @param {function(boolean)} callback
244 * @this {WebInspector.ContentProviderBasedProjectDelegate} 244 * @this {WebInspector.ContentProviderBasedProjectDelegate}
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 return this._contentProviders; 336 return this._contentProviders;
337 }, 337 },
338 338
339 reset: function() 339 reset: function()
340 { 340 {
341 this._contentProviders = {}; 341 this._contentProviders = {};
342 this._workspace.removeProject(this._id); 342 this._workspace.removeProject(this._id);
343 this._projectStore = this._workspace.addProject(this._id, this); 343 this._projectStore = this._workspace.addProject(this._id, this);
344 } 344 }
345 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698