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

Side by Side Diff: Source/devtools/front_end/sources/AdvancedSearchView.js

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Small cleanups - prefer URIs to contentURLs, revert protocol unifications, remove lambdas Created 5 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.AdvancedSearchView = function() 9 WebInspector.AdvancedSearchView = function()
10 { 10 {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 performIndexing: function(progress) { }, 407 performIndexing: function(progress) { },
408 408
409 stopSearch: function() { }, 409 stopSearch: function() { },
410 410
411 /** 411 /**
412 * @param {!WebInspector.ProjectSearchConfig} searchConfig 412 * @param {!WebInspector.ProjectSearchConfig} searchConfig
413 * @return {!WebInspector.SearchResultsPane} 413 * @return {!WebInspector.SearchResultsPane}
414 */ 414 */
415 createSearchResultsPane: function(searchConfig) { } 415 createSearchResultsPane: function(searchConfig) { }
416 } 416 }
417
418
419 /**
420 * @constructor
421 * @implements {WebInspector.Revealer}
422 */
423 WebInspector.AdvancedSearchView.SearchResultsRevealer = function()
424 {
425 }
426
427 WebInspector.AdvancedSearchView.SearchResultsRevealer.prototype = {
428 /**
429 * @override
430 * @param {!Object} results
431 * @return {!Promise}
432 */
433 reveal: function(results)
434 {
435 if (!(results instanceof WebInspector.SearchResultsCollection))
436 return Promise.reject(new Error("Internal error: not a search result s collection"));
437
438 //TODO: Stop accessing private members
439 var searchResultsPanel = WebInspector.AdvancedSearchView._instance;
440 if (!searchResultsPanel) {
441 searchResultsPanel = new WebInspector.AdvancedSearchView();
442 }
443
444 searchResultsPanel._nothingFound();
445 searchResultsPanel._searchConfig = new WebInspector.SearchConfig(results .highlightText(), true, false); //TODO: HACK - really should be able to highligh t arbitrary spans
446 searchResultsPanel._searchResultsPane = searchResultsPanel._searchScope. createSearchResultsPane(searchResultsPanel._searchConfig);
447 searchResultsPanel._resetResults();
448 searchResultsPanel._searchResultsElement.appendChild(searchResultsPanel. _searchResultsPane.element);
449
450
451 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins tance());
452 WebInspector.inspectorView.showViewInDrawer("sources.search");
453
454 results.results().map(function(sourceResult) { //map to file search resu lt
455 var code = WebInspector.networkMapping.uiSourceCodeForURLForAnyTarge t(sourceResult.source) || WebInspector.workspace.uiSourceCodeForFilePath(sourceR esult.source);
456 if (!code) {
457 return;
458 }
459 return new WebInspector.FileBasedSearchResult(
460 code,
461 sourceResult.map(function(item){
462 return new WebInspector.ContentProvider.SearchMatch(item.lin e(), item.lineContent());
463 })
464 );
465 }).forEach(function(searchResult) {
466 if (!searchResult) return;
467 searchResultsPanel._addSearchResult(searchResult);
468 searchResultsPanel._searchResultsPane.addSearchResult(searchResult);
469 });
470
471 return Promise.resolve();
472 }
473 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/source_frame/module.json ('k') | Source/devtools/front_end/sources/JavaScriptCompiler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698