OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |