diff --git a/chrome/browser/resources/settings/languages_page/languages_page.js b/chrome/browser/resources/settings/languages_page/languages_page.js index cd073739d666..4c0782d2f485 100644 --- a/chrome/browser/resources/settings/languages_page/languages_page.js +++ b/chrome/browser/resources/settings/languages_page/languages_page.js @@ -14,6 +14,12 @@ cr.exportPath('settings'); */ settings.kMenuCloseDelay = 100; +/** + * Name of the language setting is shown uma histogram. + * @type {string} + */ +const LANGUAGE_SETTING_IS_SHOWN_UMA_NAME = 'Translate.LanguageSettingsIsShown'; + (function() { 'use strict'; @@ -58,6 +64,15 @@ Polymer({ */ detailLanguage_: Object, + /** + * Whether the language settings list is opened. + * @private + */ + languagesOpened_: { + type: Boolean, + observer: 'onLanguagesOpenedChanged_', + }, + /** @private */ showAddLanguagesDialog_: Boolean, @@ -523,6 +538,19 @@ Polymer({ menu.showAt(/** @type {!Element} */ (e.target)); }, + /** + * @param {boolean} newVal The new value of languagesOpened_. + * @param {boolean} oldVal The old value of languagesOpened_. + * @private + */ + onLanguagesOpenedChanged_: function(newVal, oldVal) { + if (!oldVal && newVal) { + chrome.send( + 'metricsHandler:recordBooleanHistogram', + [LANGUAGE_SETTING_IS_SHOWN_UMA_NAME, true]); + } + }, + /** * Closes the shared action menu after a short delay, so when a checkbox is * tapped it can be seen to change state before disappearing. diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index de92a28990a1..6142921444e2 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -84039,6 +84039,18 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. + + renjieliu@chromium.org + + Log everytime the language settings page is shown. This can be either user + visits chrome://settings/languages or user visits the advanced languages + card in chrome://settings. With this stat, we will be able to understand how + well the language model is doing by looking into how the number changes over + time. In additiona to that, we are also interested in how many users ever + visit the languages settings card. + + + yyushkina@chromium.org