diff options
-rw-r--r-- | chrome/browser/resources/options/search_page.js | 18 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 11 |
2 files changed, 27 insertions, 2 deletions
diff --git a/chrome/browser/resources/options/search_page.js b/chrome/browser/resources/options/search_page.js index 8a45a08..ef9b5d2 100644 --- a/chrome/browser/resources/options/search_page.js +++ b/chrome/browser/resources/options/search_page.js @@ -147,6 +147,13 @@ cr.define('options', function() { __proto__: Page.prototype, /** + * Wait a bit to see if the user is still entering search text. + * @type {object} + * @private + */ + delayedSearchMetric_: undefined, + + /** * Only send the time of first search once. * @type {boolean} * @private @@ -388,10 +395,17 @@ cr.define('options', function() { $('searchPageNoMatches').hidden = foundMatches; // Create search balloons for sub-page results. - var length = bubbleControls.length; - for (var i = 0; i < length; i++) + var matchCount = bubbleControls.length; + for (var i = 0; i < matchCount; i++) this.createSearchBubble_(bubbleControls[i], text); + // If the search doesn't change for a couple seconds, send some metrics. + clearTimeout(this.delayedSearchMetric_); + this.delayedSearchMetric_ = setTimeout(function() { + chrome.metricsPrivate.recordSmallCount( + 'Settings.SearchMatchCount', matchCount); + }, 2000); + // Cleanup the recursion-prevention variable. this.insideSetSearchText_ = false; }, diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 4dd48d5..8b3c69c 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -44397,6 +44397,17 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </summary> </histogram> +<histogram name="Settings.SearchMatchCount"> + <owner>dschuyler@chromium.org</owner> + <summary> + The number of search hits within the chrome://settings page. This is + especially important when the count is zero (i.e. we returned no hits for a + given search in settings). A search is considered complete via timeout + since there is no concrete way to define the end of a search (the search is + incremental). + </summary> +</histogram> + <histogram name="Settings.ShowHomeButton" enum="BooleanEnabled"> <owner>mpearson@chromium.org</owner> <summary> |