Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6189)

Unified Diff: chrome/browser/translate/translate_browser_metrics.cc

Issue 131203002: Move LanguageUsageMetrics and TranslateBrowserMetrics to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/translate_browser_metrics.cc
diff --git a/chrome/browser/translate/translate_browser_metrics.cc b/chrome/browser/translate/translate_browser_metrics.cc
deleted file mode 100644
index a6605bd4e47e100ce44d853d58d84d6f1747e49d..0000000000000000000000000000000000000000
--- a/chrome/browser/translate/translate_browser_metrics.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/translate/translate_browser_metrics.h"
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/metrics/histogram.h"
-#include "base/metrics/sparse_histogram.h"
-#include "chrome/browser/language_usage_metrics.h"
-
-namespace {
-
-// Constant string values to indicate UMA names. All entries should have
-// a corresponding index in MetricsNameIndex and an entry in |kMetricsEntries|.
-const char kTranslateInitiationStatus[] =
- "Translate.InitiationStatus.v2";
-const char kTranslateReportLanguageDetectionError[] =
- "Translate.ReportLanguageDetectionError";
-const char kTranslateLocalesOnDisabledByPrefs[] =
- "Translate.LocalesOnDisabledByPrefs";
-const char kTranslateUndisplayableLanguage[] =
- "Translate.UndisplayableLanguage";
-const char kTranslateUnsupportedLanguageAtInitiation[] =
- "Translate.UnsupportedLanguageAtInitiation";
-
-struct MetricsEntry {
- TranslateBrowserMetrics::MetricsNameIndex index;
- const char* const name;
-};
-
-// This entry table should be updated when new UMA items are added.
-const MetricsEntry kMetricsEntries[] = {
- { TranslateBrowserMetrics::UMA_INITIATION_STATUS,
- kTranslateInitiationStatus },
- { TranslateBrowserMetrics::UMA_LANGUAGE_DETECTION_ERROR,
- kTranslateReportLanguageDetectionError },
- { TranslateBrowserMetrics::UMA_LOCALES_ON_DISABLED_BY_PREFS,
- kTranslateLocalesOnDisabledByPrefs },
- { TranslateBrowserMetrics::UMA_UNDISPLAYABLE_LANGUAGE,
- kTranslateUndisplayableLanguage },
- { TranslateBrowserMetrics::UMA_UNSUPPORTED_LANGUAGE_AT_INITIATION,
- kTranslateUnsupportedLanguageAtInitiation },
-};
-
-COMPILE_ASSERT(arraysize(kMetricsEntries) == TranslateBrowserMetrics::UMA_MAX,
- arraysize_of_kMetricsEntries_should_be_UMA_MAX);
-
-} // namespace
-
-namespace TranslateBrowserMetrics {
-
-void ReportInitiationStatus(InitiationStatusType type) {
- UMA_HISTOGRAM_ENUMERATION(kTranslateInitiationStatus,
- type,
- INITIATION_STATUS_MAX);
-}
-
-void ReportLanguageDetectionError() {
- UMA_HISTOGRAM_BOOLEAN(kTranslateReportLanguageDetectionError, true);
-}
-
-void ReportLocalesOnDisabledByPrefs(const std::string& locale) {
- UMA_HISTOGRAM_SPARSE_SLOWLY(kTranslateLocalesOnDisabledByPrefs,
- LanguageUsageMetrics::ToLanguageCode(locale));
-}
-
-void ReportUndisplayableLanguage(const std::string& language) {
- int language_code = LanguageUsageMetrics::ToLanguageCode(language);
- UMA_HISTOGRAM_SPARSE_SLOWLY(kTranslateUndisplayableLanguage,
- language_code);
-}
-
-void ReportUnsupportedLanguageAtInitiation(const std::string& language) {
- int language_code = LanguageUsageMetrics::ToLanguageCode(language);
- UMA_HISTOGRAM_SPARSE_SLOWLY(kTranslateUnsupportedLanguageAtInitiation,
- language_code);
-}
-
-const char* GetMetricsName(MetricsNameIndex index) {
- for (size_t i = 0; i < arraysize(kMetricsEntries); ++i) {
- if (kMetricsEntries[i].index == index)
- return kMetricsEntries[i].name;
- }
- NOTREACHED();
- return NULL;
-}
-
-} // namespace TranslateBrowserMetrics
« no previous file with comments | « chrome/browser/translate/translate_browser_metrics.h ('k') | chrome/browser/translate/translate_browser_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698