[Spellcheck] Add Windows telemetry on missing language packs
Adds two telemetry points in preparation for the Windows OS spellchecker
integration:
- Missing language packs: Counts how many spellcheck locales are
currently enabled by the user but are not supported by the Windows
OS spellchecker because the user didn't install a language pack for
them. This will help us determine the importance of adding logic to
fallback to the current spellchecker when we transition to the new
one.
- Languages unsupported by Hunspell: Counts how many languages are
currently added to Chrome by the user but are not eligible for
spellchecking because we have no Hunspell dictionaries for them.
This will help us determine the current gap in our spellcheck
support and measure the impact the OS spellchecker integration
would have.
Explanation of the changes:
- spellcheck_service.cc is the entry point for initializing the
spellchecker in the browser process. Added telemetry for the above
metrics to the initialization. Also added them to the pref change
handlers when the languages and spellcheck languages change.
- spellcheck_platform.h is the interface to the native spellchecker of
the different platforms. Verifying language packs support must be
done through system APIs via the Windows native spellchecker
object, so added a Windows-only declaration there.
- spellcheck_platform_win.cc is the Windows implementation of the
spellcheck_platform interface. It also contains the wrapper class
for the native spellchecker object. Added the new telemetry
function there, which simply forwards the call to the native
spellchecker object.
- WindowsSpellChecker is the wrapper class for the native spellchecker.
All Windows API calls must be done on the background thread. Added
a WindowsSpellChecker method that checks per-language availability
on the background thread and records the result via the spellcheck
telemetry helper object.
Bug: 463364
Change-Id: Ic8730b3e6b97898ea795fdba253f71b1b5f8ca81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1706574
Reviewed-by: Lei Zhang <[email protected]>
Reviewed-by: Robert Kaplow <[email protected]>
Reviewed-by: Cait Phillips <[email protected]>
Commit-Queue: Guillaume Jenkins <[email protected]>
Cr-Commit-Position: refs/heads/master@{#679550}
diff --git a/components/spellcheck/browser/spellcheck_host_metrics.h b/components/spellcheck/browser/spellcheck_host_metrics.h
index 08e1e401..af29294 100644
--- a/components/spellcheck/browser/spellcheck_host_metrics.h
+++ b/components/spellcheck/browser/spellcheck_host_metrics.h
@@ -14,6 +14,7 @@
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "build/build_config.h"
// A helper object for recording spell-check related histograms.
// This class encapsulates histogram names and metrics API.
@@ -61,6 +62,16 @@
// Records if spelling service is enabled or disabled.
void RecordSpellingServiceStats(bool enabled);
+#if defined(OS_WIN)
+ // Records how many user spellcheck languages are currently not supported by
+ // the Windows OS spellchecker due to missing language packs.
+ void RecordMissingLanguagePacksCount(int count);
+
+ // Records how many user languages are not supported by Hunspell for
+ // spellchecking.
+ void RecordHunspellUnsupportedLanguageCount(int count);
+#endif // defined(OS_WIN)
+
private:
friend class SpellcheckHostMetricsTest;
void OnHistogramTimerExpired();