chromium/components/spellcheck/browser/spellcheck_host_metrics.cc

// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/spellcheck/browser/spellcheck_host_metrics.h"

#include <stdint.h>

#include "base/containers/span.h"
#include "base/hash/md5.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "build/build_config.h"

SpellCheckHostMetrics::SpellCheckHostMetrics()
    :{}

SpellCheckHostMetrics::~SpellCheckHostMetrics() {}

void SpellCheckHostMetrics::RecordEnabledStats(bool enabled) {}

void SpellCheckHostMetrics::RecordCheckedWordStats(const std::u16string& word,
                                                   bool misspell) {}

void SpellCheckHostMetrics::OnHistogramTimerExpired() {}

void SpellCheckHostMetrics::RecordSuggestionStats(int delta) {}

void SpellCheckHostMetrics::RecordReplacedWordStats(int delta) {}

void SpellCheckHostMetrics::RecordWordCounts() {}

void SpellCheckHostMetrics::RecordSpellingServiceStats(bool enabled) {}

#if BUILDFLAG(IS_WIN)
// static
void SpellCheckHostMetrics::RecordAcceptLanguageStats(
    const LocalesSupportInfo& locales_info) {
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.ChromeLocalesSupport2.Both",
      base::saturated_cast<int>(
          locales_info.locales_supported_by_hunspell_and_native),
      20);
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.ChromeLocalesSupport2.HunspellOnly",
      base::saturated_cast<int>(
          locales_info.locales_supported_by_hunspell_only),
      20);
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.ChromeLocalesSupport2.NativeOnly",
      base::saturated_cast<int>(locales_info.locales_supported_by_native_only),
      20);
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.ChromeLocalesSupport2.NoSupport",
      base::saturated_cast<int>(locales_info.unsupported_locales), 20);
}

// static
void SpellCheckHostMetrics::RecordSpellcheckLanguageStats(
    const LocalesSupportInfo& locales_info) {
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.SpellcheckLocalesSupport2.Both",
      base::saturated_cast<int>(
          locales_info.locales_supported_by_hunspell_and_native),
      20);
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.SpellcheckLocalesSupport2.HunspellOnly",
      base::saturated_cast<int>(
          locales_info.locales_supported_by_hunspell_only),
      20);
  base::UmaHistogramExactLinear(
      "Spellcheck.Windows.SpellcheckLocalesSupport2.NativeOnly",
      base::saturated_cast<int>(locales_info.locales_supported_by_native_only),
      20);
}
#endif  // BUILDFLAG(IS_WIN)