Index: components/translate/common/translate_metrics.cc |
diff --git a/chrome/common/translate/translate_common_metrics.cc b/components/translate/common/translate_metrics.cc |
similarity index 70% |
rename from chrome/common/translate/translate_common_metrics.cc |
rename to components/translate/common/translate_metrics.cc |
index 977bb5ccdccc73457714e1ab0016cb34b0b14535..b09508446456fad735069f74d9548a62b141625e 100644 |
--- a/chrome/common/translate/translate_common_metrics.cc |
+++ b/components/translate/common/translate_metrics.cc |
@@ -2,11 +2,13 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/common/translate/translate_common_metrics.h" |
+#include "components/translate/common/translate_metrics.h" |
#include "base/basictypes.h" |
#include "base/metrics/histogram.h" |
+namespace translate { |
+ |
namespace { |
// Constant string values to indicate UMA names. All entries should have |
@@ -26,63 +28,49 @@ const char kSchemeHttp[] = "http"; |
const char kSchemeHttps[] = "https"; |
struct MetricsEntry { |
- TranslateCommonMetrics::MetricsNameIndex index; |
+ MetricsNameIndex index; |
const char* const name; |
}; |
// This entry table should be updated when new UMA items are added. |
const MetricsEntry kMetricsEntries[] = { |
- { TranslateCommonMetrics::UMA_LANGUAGE_DETECTION, |
- kRenderer4LanguageDetection }, |
- { TranslateCommonMetrics::UMA_CONTENT_LANGUAGE, |
- kTranslateContentLanguage }, |
- { TranslateCommonMetrics::UMA_HTML_LANG, |
- kTranslateHtmlLang }, |
- { TranslateCommonMetrics::UMA_LANGUAGE_VERIFICATION, |
- kTranslateLanguageVerification }, |
- { TranslateCommonMetrics::UMA_TIME_TO_BE_READY, |
- kTranslateTimeToBeReady }, |
- { TranslateCommonMetrics::UMA_TIME_TO_LOAD, |
- kTranslateTimeToLoad }, |
- { TranslateCommonMetrics::UMA_TIME_TO_TRANSLATE, |
- kTranslateTimeToTranslate }, |
- { TranslateCommonMetrics::UMA_USER_ACTION_DURATION, |
- kTranslateUserActionDuration }, |
- { TranslateCommonMetrics::UMA_PAGE_SCHEME, |
- kTranslatePageScheme }, |
- { TranslateCommonMetrics::UMA_SIMILAR_LANGUAGE_MATCH, |
- kTranslateSimilarLanguageMatch }, |
-}; |
- |
-COMPILE_ASSERT(arraysize(kMetricsEntries) == TranslateCommonMetrics::UMA_MAX, |
+ {UMA_LANGUAGE_DETECTION, kRenderer4LanguageDetection}, |
+ {UMA_CONTENT_LANGUAGE, kTranslateContentLanguage}, |
+ {UMA_HTML_LANG, kTranslateHtmlLang}, |
+ {UMA_LANGUAGE_VERIFICATION, kTranslateLanguageVerification}, |
+ {UMA_TIME_TO_BE_READY, kTranslateTimeToBeReady}, |
+ {UMA_TIME_TO_LOAD, kTranslateTimeToLoad}, |
+ {UMA_TIME_TO_TRANSLATE, kTranslateTimeToTranslate}, |
+ {UMA_USER_ACTION_DURATION, kTranslateUserActionDuration}, |
+ {UMA_PAGE_SCHEME, kTranslatePageScheme}, |
+ {UMA_SIMILAR_LANGUAGE_MATCH, kTranslateSimilarLanguageMatch}, }; |
+ |
+COMPILE_ASSERT(arraysize(kMetricsEntries) == UMA_MAX, |
arraysize_of_kMetricsEntries_should_be_UMA_MAX); |
-TranslateCommonMetrics::LanguageCheckType GetLanguageCheckMetric( |
- const std::string& provided_code, |
- const std::string& revised_code) { |
+LanguageCheckType GetLanguageCheckMetric(const std::string& provided_code, |
+ const std::string& revised_code) { |
if (provided_code.empty()) |
- return TranslateCommonMetrics::LANGUAGE_NOT_PROVIDED; |
+ return LANGUAGE_NOT_PROVIDED; |
else if (provided_code == revised_code) |
- return TranslateCommonMetrics::LANGUAGE_VALID; |
- return TranslateCommonMetrics::LANGUAGE_INVALID; |
+ return LANGUAGE_VALID; |
+ return LANGUAGE_INVALID; |
} |
} // namespace |
-namespace TranslateCommonMetrics { |
- |
void ReportContentLanguage(const std::string& provided_code, |
const std::string& revised_code) { |
UMA_HISTOGRAM_ENUMERATION(kTranslateContentLanguage, |
GetLanguageCheckMetric(provided_code, revised_code), |
- TranslateCommonMetrics::LANGUAGE_MAX); |
+ LANGUAGE_MAX); |
} |
void ReportHtmlLang(const std::string& provided_code, |
const std::string& revised_code) { |
UMA_HISTOGRAM_ENUMERATION(kTranslateHtmlLang, |
GetLanguageCheckMetric(provided_code, revised_code), |
- TranslateCommonMetrics::LANGUAGE_MAX); |
+ LANGUAGE_MAX); |
} |
void ReportLanguageVerification(LanguageVerificationType type) { |
@@ -139,4 +127,4 @@ const char* GetMetricsName(MetricsNameIndex index) { |
return NULL; |
} |
-} // namespace TranslateCommonMetrics |
+} // namespace translate |