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.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
6 | 6 |
7 import android.util.Pair; | 7 import android.util.Pair; |
8 | 8 |
9 import org.chromium.base.metrics.RecordHistogram; | 9 import org.chromium.base.metrics.RecordHistogram; |
10 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState; | 10 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 } | 699 } |
700 | 700 |
701 // Also record a summary histogram with counts for each possibility. | 701 // Also record a summary histogram with counts for each possibility. |
702 int code = !wasPrefetch ? NOT_PREFETCHED | 702 int code = !wasPrefetch ? NOT_PREFETCHED |
703 : (durationMs == 0 ? PREFETCHED_FULLY_LOADED : PREFETCHED_PARIAL
LY_LOADED); | 703 : (durationMs == 0 ? PREFETCHED_FULLY_LOADED : PREFETCHED_PARIAL
LY_LOADED); |
704 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefet
chSummary", | 704 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefet
chSummary", |
705 code, PREFETCH_BOUNDARY); | 705 code, PREFETCH_BOUNDARY); |
706 } | 706 } |
707 | 707 |
708 /** | 708 /** |
| 709 * Logs the duration from starting a search until the Search Term is resolve
d. |
| 710 * @param durationMs The duration to record. |
| 711 */ |
| 712 public static void logSearchTermResolutionDuration(long durationMs) { |
| 713 RecordHistogram.recordMediumTimesHistogram( |
| 714 "Search.ContextualSearchResolutionDuration", durationMs, TimeUni
t.MILLISECONDS); |
| 715 } |
| 716 |
| 717 /** |
| 718 * Logs the duration from starting a prefetched search until the panel navig
ates to the results |
| 719 * and they start becoming viewable. Should be called only for searches that
are prefetched. |
| 720 * @param durationMs The duration to record. |
| 721 * @param didResolve Whether a Search Term resolution was required as part o
f the loading. |
| 722 */ |
| 723 public static void logPrefetchedSearchNavigatedDuration(long durationMs, boo
lean didResolve) { |
| 724 String histogramName = didResolve ? "Search.ContextualSearchResolvedSear
chDuration" |
| 725 : "Search.ContextualSearchLiteralSearc
hDuration"; |
| 726 RecordHistogram.recordMediumTimesHistogram( |
| 727 histogramName, durationMs, TimeUnit.MILLISECONDS); |
| 728 } |
| 729 |
| 730 /** |
709 * Logs whether the promo was seen. | 731 * Logs whether the promo was seen. |
710 * Logs multiple histograms, with and without the original triggering gestur
e. | 732 * Logs multiple histograms, with and without the original triggering gestur
e. |
711 * @param wasPanelSeen Whether the panel was seen. | 733 * @param wasPanelSeen Whether the panel was seen. |
712 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. | 734 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. |
713 */ | 735 */ |
714 public static void logPromoSeen(boolean wasPanelSeen, boolean wasTap) { | 736 public static void logPromoSeen(boolean wasPanelSeen, boolean wasTap) { |
715 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstR
unPanelSeen", | 737 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstR
unPanelSeen", |
716 wasPanelSeen ? RESULTS_SEEN : RESULTS_NOT_SEEN, RESULTS_SEEN_BOU
NDARY); | 738 wasPanelSeen ? RESULTS_SEEN : RESULTS_NOT_SEEN, RESULTS_SEEN_BOU
NDARY); |
717 logHistogramByGesture(wasPanelSeen, wasTap, "Search.ContextualSearchProm
oSeenByGesture"); | 739 logHistogramByGesture(wasPanelSeen, wasTap, "Search.ContextualSearchProm
oSeenByGesture"); |
718 } | 740 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. | 967 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. |
946 * @param histogramName The full name of the histogram to log to. | 968 * @param histogramName The full name of the histogram to log to. |
947 */ | 969 */ |
948 private static void logHistogramByGesture(boolean wasPanelSeen, boolean wasT
ap, | 970 private static void logHistogramByGesture(boolean wasPanelSeen, boolean wasT
ap, |
949 String histogramName) { | 971 String histogramName) { |
950 RecordHistogram.recordEnumeratedHistogram(histogramName, | 972 RecordHistogram.recordEnumeratedHistogram(histogramName, |
951 getPanelSeenByGestureStateCode(wasPanelSeen, wasTap), | 973 getPanelSeenByGestureStateCode(wasPanelSeen, wasTap), |
952 RESULTS_BY_GESTURE_BOUNDARY); | 974 RESULTS_BY_GESTURE_BOUNDARY); |
953 } | 975 } |
954 } | 976 } |
OLD | NEW |