OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_TRANSLATE_CORE_COMMON_TRANSLATE_METRICS_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_COMMON_TRANSLATE_METRICS_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_COMMON_TRANSLATE_METRICS_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_COMMON_TRANSLATE_METRICS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 | 11 |
12 namespace translate { | 12 namespace translate { |
13 | 13 |
14 // An indexing type to query each UMA entry name via GetMetricsName() function. | 14 // Internals exposed for testing purposes. Should not be relied on by client |
15 // Note: |kMetricsEntries| should be updated when a new entry is added here. | 15 // code. |
16 enum MetricsNameIndex { | 16 namespace metrics_internal { |
droger
2017/04/19 08:26:49
Optional: I think the namespace is not even needed
martis
2017/04/20 02:57:29
I'm not aware of namespaces increasing the size of
| |
17 UMA_LANGUAGE_DETECTION, | 17 |
18 UMA_CONTENT_LANGUAGE, | 18 // Constant string values to indicate UMA names. |
19 UMA_HTML_LANG, | 19 extern const char* kRenderer4LanguageDetection; |
droger
2017/04/19 08:26:49
extern const char kRenderer4LanguageDetection[]
is
martis
2017/04/20 02:57:29
As far as I know, that syntax can only be used whe
droger
2017/04/20 07:30:30
No.
Please do like I said in my first comment. Yo
| |
20 UMA_LANGUAGE_VERIFICATION, | 20 extern const char* kTranslateContentLanguage; |
21 UMA_TIME_TO_BE_READY, | 21 extern const char* kTranslateHtmlLang; |
22 UMA_TIME_TO_LOAD, | 22 extern const char* kTranslateLanguageVerification; |
23 UMA_TIME_TO_TRANSLATE, | 23 extern const char* kTranslateTimeToBeReady; |
24 UMA_USER_ACTION_DURATION, | 24 extern const char* kTranslateTimeToLoad; |
25 UMA_PAGE_SCHEME, | 25 extern const char* kTranslateTimeToTranslate; |
26 UMA_SIMILAR_LANGUAGE_MATCH, | 26 extern const char* kTranslateUserActionDuration; |
27 UMA_LANGUAGE_DETECTION_CONFLICT, | 27 extern const char* kTranslatePageScheme; |
28 UMA_MAX, | 28 extern const char* kTranslateSimilarLanguageMatch; |
29 }; | 29 extern const char* kTranslateLanguageDetectionConflict; |
30 | |
31 } // namespace metrics_internal | |
30 | 32 |
31 // A page may provide a Content-Language HTTP header or a META tag. | 33 // A page may provide a Content-Language HTTP header or a META tag. |
32 // TranslateHelper checks if a server provides a valid Content-Language. | 34 // TranslateHelper checks if a server provides a valid Content-Language. |
33 enum LanguageCheckType { | 35 enum LanguageCheckType { |
34 LANGUAGE_NOT_PROVIDED, | 36 LANGUAGE_NOT_PROVIDED, |
35 LANGUAGE_VALID, | 37 LANGUAGE_VALID, |
36 LANGUAGE_INVALID, | 38 LANGUAGE_INVALID, |
37 LANGUAGE_MAX, | 39 LANGUAGE_MAX, |
38 }; | 40 }; |
39 | 41 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 | 97 |
96 // Called when CLD agreed on a language which is different, but in the similar | 98 // Called when CLD agreed on a language which is different, but in the similar |
97 // language list. | 99 // language list. |
98 void ReportSimilarLanguageMatch(bool match); | 100 void ReportSimilarLanguageMatch(bool match); |
99 | 101 |
100 // Called when page language is "en*" and doesn't match the CLD language; i.e | 102 // Called when page language is "en*" and doesn't match the CLD language; i.e |
101 // when we suspect that the page language is incorrect. | 103 // when we suspect that the page language is incorrect. |
102 void ReportLanguageDetectionConflict(const std::string& page_lang, | 104 void ReportLanguageDetectionConflict(const std::string& page_lang, |
103 const std::string& cld_lang); | 105 const std::string& cld_lang); |
104 | 106 |
105 // Gets UMA name for an entry specified by |index|. | |
106 const char* GetMetricsName(MetricsNameIndex index); | |
107 | |
108 } // namespace translate | 107 } // namespace translate |
109 | 108 |
110 #endif // COMPONENTS_TRANSLATE_CORE_COMMON_TRANSLATE_METRICS_H_ | 109 #endif // COMPONENTS_TRANSLATE_CORE_COMMON_TRANSLATE_METRICS_H_ |
OLD | NEW |