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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 this._searchToolbarElement = this.contentElement.createChild("div", "search-
toolbar-summary"); | 51 this._searchToolbarElement = this.contentElement.createChild("div", "search-
toolbar-summary"); |
52 this._searchMessageElement = this._searchToolbarElement.createChild("div", "
search-message"); | 52 this._searchMessageElement = this._searchToolbarElement.createChild("div", "
search-message"); |
53 this._searchProgressPlaceholderElement = this._searchToolbarElement.createCh
ild("div", "flex-centered"); | 53 this._searchProgressPlaceholderElement = this._searchToolbarElement.createCh
ild("div", "flex-centered"); |
54 this._searchResultsMessageElement = this._searchToolbarElement.createChild("
div", "search-message"); | 54 this._searchResultsMessageElement = this._searchToolbarElement.createChild("
div", "search-message"); |
55 | 55 |
56 this._advancedSearchConfig = WebInspector.settings.createLocalSetting("advan
cedSearchConfig", new WebInspector.SearchConfig("", true, false).toPlainObject()
); | 56 this._advancedSearchConfig = WebInspector.settings.createLocalSetting("advan
cedSearchConfig", new WebInspector.SearchConfig("", true, false).toPlainObject()
); |
57 this._load(); | 57 this._load(); |
58 /** @type {!WebInspector.SearchScope} */ | 58 /** @type {!WebInspector.SearchScope} */ |
59 this._searchScope = new WebInspector.SourcesSearchScope(); | 59 this._searchScope = new WebInspector.SourcesSearchScope(); |
60 } | 60 }; |
61 | 61 |
62 WebInspector.AdvancedSearchView.prototype = { | 62 WebInspector.AdvancedSearchView.prototype = { |
63 /** | 63 /** |
64 * @return {!WebInspector.SearchConfig} | 64 * @return {!WebInspector.SearchConfig} |
65 */ | 65 */ |
66 _buildSearchConfig: function() | 66 _buildSearchConfig: function() |
67 { | 67 { |
68 return new WebInspector.SearchConfig(this._search.value, this._ignoreCas
eCheckbox.checked, this._regexCheckbox.checked); | 68 return new WebInspector.SearchConfig(this._search.value, this._ignoreCas
eCheckbox.checked, this._regexCheckbox.checked); |
69 }, | 69 }, |
70 | 70 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 { | 335 { |
336 var searchConfig = this._buildSearchConfig(); | 336 var searchConfig = this._buildSearchConfig(); |
337 if (!searchConfig.query() || !searchConfig.query().length) | 337 if (!searchConfig.query() || !searchConfig.query().length) |
338 return; | 338 return; |
339 | 339 |
340 this._save(); | 340 this._save(); |
341 this._startSearch(searchConfig); | 341 this._startSearch(searchConfig); |
342 }, | 342 }, |
343 | 343 |
344 __proto__: WebInspector.VBox.prototype | 344 __proto__: WebInspector.VBox.prototype |
345 } | 345 }; |
346 | 346 |
347 /** | 347 /** |
348 * @param {string} query | 348 * @param {string} query |
349 * @param {string=} filePath | 349 * @param {string=} filePath |
350 */ | 350 */ |
351 WebInspector.AdvancedSearchView.openSearch = function(query, filePath) | 351 WebInspector.AdvancedSearchView.openSearch = function(query, filePath) |
352 { | 352 { |
353 WebInspector.viewManager.showView("sources.search"); | 353 WebInspector.viewManager.showView("sources.search"); |
354 var searchView = /** @type {!WebInspector.AdvancedSearchView} */ (self.runti
me.sharedInstance(WebInspector.AdvancedSearchView)); | 354 var searchView = /** @type {!WebInspector.AdvancedSearchView} */ (self.runti
me.sharedInstance(WebInspector.AdvancedSearchView)); |
355 var fileMask = filePath ? " file:" + filePath : ""; | 355 var fileMask = filePath ? " file:" + filePath : ""; |
356 searchView._toggle(query + fileMask); | 356 searchView._toggle(query + fileMask); |
357 } | 357 }; |
358 | 358 |
359 /** | 359 /** |
360 * @constructor | 360 * @constructor |
361 * @param {!WebInspector.ProjectSearchConfig} searchConfig | 361 * @param {!WebInspector.ProjectSearchConfig} searchConfig |
362 */ | 362 */ |
363 WebInspector.SearchResultsPane = function(searchConfig) | 363 WebInspector.SearchResultsPane = function(searchConfig) |
364 { | 364 { |
365 this._searchConfig = searchConfig; | 365 this._searchConfig = searchConfig; |
366 this.element = createElement("div"); | 366 this.element = createElement("div"); |
367 } | 367 }; |
368 | 368 |
369 WebInspector.SearchResultsPane.prototype = { | 369 WebInspector.SearchResultsPane.prototype = { |
370 /** | 370 /** |
371 * @return {!WebInspector.ProjectSearchConfig} | 371 * @return {!WebInspector.ProjectSearchConfig} |
372 */ | 372 */ |
373 get searchConfig() | 373 get searchConfig() |
374 { | 374 { |
375 return this._searchConfig; | 375 return this._searchConfig; |
376 }, | 376 }, |
377 | 377 |
378 /** | 378 /** |
379 * @param {!WebInspector.FileBasedSearchResult} searchResult | 379 * @param {!WebInspector.FileBasedSearchResult} searchResult |
380 */ | 380 */ |
381 addSearchResult: function(searchResult) { } | 381 addSearchResult: function(searchResult) { } |
382 } | 382 }; |
383 | 383 |
384 /** | 384 /** |
385 * @constructor | 385 * @constructor |
386 * @implements {WebInspector.ActionDelegate} | 386 * @implements {WebInspector.ActionDelegate} |
387 */ | 387 */ |
388 WebInspector.AdvancedSearchView.ActionDelegate = function() | 388 WebInspector.AdvancedSearchView.ActionDelegate = function() |
389 { | 389 { |
390 } | 390 }; |
391 | 391 |
392 WebInspector.AdvancedSearchView.ActionDelegate.prototype = { | 392 WebInspector.AdvancedSearchView.ActionDelegate.prototype = { |
393 /** | 393 /** |
394 * @override | 394 * @override |
395 * @param {!WebInspector.Context} context | 395 * @param {!WebInspector.Context} context |
396 * @param {string} actionId | 396 * @param {string} actionId |
397 * @return {boolean} | 397 * @return {boolean} |
398 */ | 398 */ |
399 handleAction: function(context, actionId) | 399 handleAction: function(context, actionId) |
400 { | 400 { |
401 this._showSearch(); | 401 this._showSearch(); |
402 return true; | 402 return true; |
403 }, | 403 }, |
404 | 404 |
405 _showSearch: function() | 405 _showSearch: function() |
406 { | 406 { |
407 var selection = WebInspector.inspectorView.element.getDeepSelection(); | 407 var selection = WebInspector.inspectorView.element.getDeepSelection(); |
408 var queryCandidate = ""; | 408 var queryCandidate = ""; |
409 if (selection.rangeCount) | 409 if (selection.rangeCount) |
410 queryCandidate = selection.toString().replace(/\r?\n.*/, ""); | 410 queryCandidate = selection.toString().replace(/\r?\n.*/, ""); |
411 WebInspector.AdvancedSearchView.openSearch(queryCandidate); | 411 WebInspector.AdvancedSearchView.openSearch(queryCandidate); |
412 }, | 412 }, |
413 } | 413 }; |
414 | 414 |
415 /** | 415 /** |
416 * @constructor | 416 * @constructor |
417 * @param {!WebInspector.UISourceCode} uiSourceCode | 417 * @param {!WebInspector.UISourceCode} uiSourceCode |
418 * @param {!Array.<!Object>} searchMatches | 418 * @param {!Array.<!Object>} searchMatches |
419 */ | 419 */ |
420 WebInspector.FileBasedSearchResult = function(uiSourceCode, searchMatches) { | 420 WebInspector.FileBasedSearchResult = function(uiSourceCode, searchMatches) { |
421 this.uiSourceCode = uiSourceCode; | 421 this.uiSourceCode = uiSourceCode; |
422 this.searchMatches = searchMatches; | 422 this.searchMatches = searchMatches; |
423 } | 423 }; |
424 | 424 |
425 /** | 425 /** |
426 * @interface | 426 * @interface |
427 */ | 427 */ |
428 WebInspector.SearchScope = function() | 428 WebInspector.SearchScope = function() |
429 { | 429 { |
430 } | 430 }; |
431 | 431 |
432 WebInspector.SearchScope.prototype = { | 432 WebInspector.SearchScope.prototype = { |
433 /** | 433 /** |
434 * @param {!WebInspector.SearchConfig} searchConfig | 434 * @param {!WebInspector.SearchConfig} searchConfig |
435 * @param {!WebInspector.Progress} progress | 435 * @param {!WebInspector.Progress} progress |
436 * @param {function(!WebInspector.FileBasedSearchResult)} searchResultCallba
ck | 436 * @param {function(!WebInspector.FileBasedSearchResult)} searchResultCallba
ck |
437 * @param {function(boolean)} searchFinishedCallback | 437 * @param {function(boolean)} searchFinishedCallback |
438 */ | 438 */ |
439 performSearch: function(searchConfig, progress, searchResultCallback, search
FinishedCallback) { }, | 439 performSearch: function(searchConfig, progress, searchResultCallback, search
FinishedCallback) { }, |
440 | 440 |
441 /** | 441 /** |
442 * @param {!WebInspector.Progress} progress | 442 * @param {!WebInspector.Progress} progress |
443 */ | 443 */ |
444 performIndexing: function(progress) { }, | 444 performIndexing: function(progress) { }, |
445 | 445 |
446 stopSearch: function() { }, | 446 stopSearch: function() { }, |
447 | 447 |
448 /** | 448 /** |
449 * @param {!WebInspector.ProjectSearchConfig} searchConfig | 449 * @param {!WebInspector.ProjectSearchConfig} searchConfig |
450 * @return {!WebInspector.SearchResultsPane} | 450 * @return {!WebInspector.SearchResultsPane} |
451 */ | 451 */ |
452 createSearchResultsPane: function(searchConfig) { } | 452 createSearchResultsPane: function(searchConfig) { } |
453 } | 453 }; |
OLD | NEW |