spellcheck_renderer_metrics.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_RENDERER_METRICS_H_
  5. #define COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_RENDERER_METRICS_H_
  6. #include "base/time/time.h"
  7. #include "build/build_config.h"
  8. #include "components/spellcheck/spellcheck_buildflags.h"
  9. // A namespace for recording spell-check related histograms.
  10. // This namespace encapsulates histogram names and metrics API for the renderer
  11. // side of the spell checker.
  12. namespace spellcheck_renderer_metrics {
  13. // The length of text checked via async checking.
  14. void RecordAsyncCheckedTextLength(int length);
  15. // The length of text checked by spellCheck. No replacement suggestions were
  16. // requested.
  17. void RecordCheckedTextLengthNoSuggestions(int length);
  18. // The length of text checked by spellCheck. Replacement suggestions were
  19. // requested.
  20. void RecordCheckedTextLengthWithSuggestions(int length);
  21. #if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER)
  22. // Records the duration of gathering spelling suggestions. This variation is for
  23. // when spell check is performed only by Hunspell.
  24. void RecordHunspellSuggestionDuration(base::TimeDelta duration);
  25. // Records the duration of gathering spelling suggestions. This variation is for
  26. // when spell check is performed by both Hunspell and the OS spell checker.
  27. void RecordHybridSuggestionDuration(base::TimeDelta duration);
  28. // Records the total time it took to complete an end-to-end spell check.
  29. // If at least one locale was checked by Hunspell, |used_hunspell| should be set
  30. // to |true|. If at least one locale was checked by the Windows native spell
  31. // checker, |used_native| should be set to |true|.
  32. void RecordSpellcheckDuration(base::TimeDelta duration,
  33. bool used_hunspell,
  34. bool used_native);
  35. #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER)
  36. } // namespace spellcheck_renderer_metrics
  37. #endif // COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_RENDERER_METRICS_H_