OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; | 5 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 | 10 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 /** | 376 /** |
377 * Called when the SERP finishes loading, this records the duration of loadi
ng the SERP from | 377 * Called when the SERP finishes loading, this records the duration of loadi
ng the SERP from |
378 * the time the panel was opened until the present. | 378 * the time the panel was opened until the present. |
379 * @param wasPrefetch Whether the request was prefetch-enabled. | 379 * @param wasPrefetch Whether the request was prefetch-enabled. |
380 */ | 380 */ |
381 public void onSearchResultsLoaded(boolean wasPrefetch) { | 381 public void onSearchResultsLoaded(boolean wasPrefetch) { |
382 mPanelMetrics.onSearchResultsLoaded(wasPrefetch); | 382 mPanelMetrics.onSearchResultsLoaded(wasPrefetch); |
383 } | 383 } |
384 | 384 |
385 /** | 385 /** |
| 386 * Called after the panel has navigated to prefetched Search Results. |
| 387 * If the user has the panel open then they will see the prefetched result s
tarting to load. |
| 388 * Currently this just logs the time between the start of the search until t
he results start to |
| 389 * render in the Panel. |
| 390 * @param didResolve Whether the search required the Search Term to be resol
ved. |
| 391 */ |
| 392 public void onPanelNavigatedToPrefetchedSearch(boolean didResolve) { |
| 393 mPanelMetrics.onPanelNavigatedToPrefetchedSearch(didResolve); |
| 394 } |
| 395 |
| 396 /** |
386 * Maximizes the Contextual Search Panel, then promotes it to a regular Tab. | 397 * Maximizes the Contextual Search Panel, then promotes it to a regular Tab. |
387 * @param reason The {@code StateChangeReason} behind the maximization and p
romotion to tab. | 398 * @param reason The {@code StateChangeReason} behind the maximization and p
romotion to tab. |
388 */ | 399 */ |
389 public void maximizePanelThenPromoteToTab(StateChangeReason reason) { | 400 public void maximizePanelThenPromoteToTab(StateChangeReason reason) { |
390 mShouldPromoteToTabAfterMaximizing = true; | 401 mShouldPromoteToTabAfterMaximizing = true; |
391 maximizePanel(reason); | 402 maximizePanel(reason); |
392 } | 403 } |
393 | 404 |
394 /** | 405 /** |
395 * Maximizes the Contextual Search Panel, then promotes it to a regular Tab. | 406 * Maximizes the Contextual Search Panel, then promotes it to a regular Tab. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 457 |
447 /** | 458 /** |
448 * Shows the search term in the SearchBar. This should be called when the se
arch term is set | 459 * Shows the search term in the SearchBar. This should be called when the se
arch term is set |
449 * without search term resolution. | 460 * without search term resolution. |
450 * @param searchTerm The string that represents the search term. | 461 * @param searchTerm The string that represents the search term. |
451 */ | 462 */ |
452 public void displaySearchTerm(String searchTerm) { | 463 public void displaySearchTerm(String searchTerm) { |
453 cancelSearchTermResolutionAnimation(); | 464 cancelSearchTermResolutionAnimation(); |
454 getSearchBarControl().setSearchTerm(searchTerm); | 465 getSearchBarControl().setSearchTerm(searchTerm); |
455 resetSearchBarTermOpacity(); | 466 resetSearchBarTermOpacity(); |
| 467 mPanelMetrics.onSearchRequestStarted(); |
456 } | 468 } |
457 | 469 |
458 /** | 470 /** |
459 * Shows the search context in the SearchBar. | 471 * Shows the search context in the SearchBar. |
460 * @param selection The portion of the context that represents the user's se
lection. | 472 * @param selection The portion of the context that represents the user's se
lection. |
461 * @param end The portion of the context from the selection to its end. | 473 * @param end The portion of the context from the selection to its end. |
462 */ | 474 */ |
463 public void displaySearchContext(String selection, String end) { | 475 public void displaySearchContext(String selection, String end) { |
464 cancelSearchTermResolutionAnimation(); | 476 cancelSearchTermResolutionAnimation(); |
465 getSearchBarControl().setSearchContext(selection, end); | 477 getSearchBarControl().setSearchContext(selection, end); |
466 resetSearchBarContextOpacity(); | 478 resetSearchBarContextOpacity(); |
| 479 mPanelMetrics.onSearchRequestStarted(); |
467 } | 480 } |
468 | 481 |
469 /** | 482 /** |
470 * Handles showing the resolved search term in the SearchBar. | 483 * Handles showing the resolved search term in the SearchBar. |
471 * @param searchTerm The string that represents the search term. | 484 * @param searchTerm The string that represents the search term. |
472 */ | 485 */ |
473 public void onSearchTermResolutionResponse(String searchTerm) { | 486 public void onSearchTermResolved(String searchTerm) { |
| 487 mPanelMetrics.onSearchTermResolved(); |
474 getSearchBarControl().setSearchTerm(searchTerm); | 488 getSearchBarControl().setSearchTerm(searchTerm); |
475 animateSearchTermResolution(); | 489 animateSearchTermResolution(); |
476 } | 490 } |
477 | 491 |
478 /** | 492 /** |
479 * Sets that the contextual search involved the promo. | 493 * Sets that the contextual search involved the promo. |
480 */ | 494 */ |
481 public void setDidSearchInvolvePromo() { | 495 public void setDidSearchInvolvePromo() { |
482 mPanelMetrics.setDidSearchInvolvePromo(); | 496 mPanelMetrics.setDidSearchInvolvePromo(); |
483 } | 497 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 748 |
735 /** | 749 /** |
736 * Destroy the current content in the panel. | 750 * Destroy the current content in the panel. |
737 * NOTE(mdjones): This should not be exposed. The only use is in ContextualS
earchManager for a | 751 * NOTE(mdjones): This should not be exposed. The only use is in ContextualS
earchManager for a |
738 * bug related to loading new panel content. | 752 * bug related to loading new panel content. |
739 */ | 753 */ |
740 public void destroyContent() { | 754 public void destroyContent() { |
741 super.destroyOverlayPanelContent(); | 755 super.destroyOverlayPanelContent(); |
742 } | 756 } |
743 } | 757 } |
OLD | NEW |