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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_BROWSER_METRICS_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_BROWSER_METRICS_H_
12 namespace TranslateBrowserMetrics
{
14 // An indexing type to query each UMA entry name via GetMetricsName() function.
15 // Note: |kMetricsEntries| should be updated when a new entry is added here.
16 enum MetricsNameIndex
{
17 UMA_INITIATION_STATUS
,
18 UMA_LANGUAGE_DETECTION_ERROR
,
19 UMA_LOCALES_ON_DISABLED_BY_PREFS
,
20 UMA_UNDISPLAYABLE_LANGUAGE
,
21 UMA_UNSUPPORTED_LANGUAGE_AT_INITIATION
,
25 // When Chrome Translate is ready to translate a page, one of following reason
26 // decide the next browser action.
27 // Note: Don't insert any item. It will change reporting UMA value, and break
28 // the UMA dashboard page. Insteads, append it at the end of enum as suggested
30 enum InitiationStatusType
{
31 INITIATION_STATUS_DISABLED_BY_PREFS
,
32 INITIATION_STATUS_DISABLED_BY_SWITCH
,
33 INITIATION_STATUS_DISABLED_BY_CONFIG
,
34 INITIATION_STATUS_LANGUAGE_IS_NOT_SUPPORTED
,
35 INITIATION_STATUS_URL_IS_NOT_SUPPORTED
,
36 INITIATION_STATUS_SIMILAR_LANGUAGES
,
37 INITIATION_STATUS_ACCEPT_LANGUAGES
,
38 INITIATION_STATUS_AUTO_BY_CONFIG
,
39 INITIATION_STATUS_AUTO_BY_LINK
,
40 INITIATION_STATUS_SHOW_INFOBAR
,
41 INITIATION_STATUS_MIME_TYPE_IS_NOT_SUPPORTED
,
42 INITIATION_STATUS_DISABLED_BY_KEY
,
43 // Insert new items here.
44 INITIATION_STATUS_MAX
,
47 // Called when Chrome Translate is initiated to report a reason of the next
49 void ReportInitiationStatus(InitiationStatusType type
);
51 // Called when Chrome opens the URL so that the user sends an error feedback.
52 void ReportLanguageDetectionError();
54 void ReportLocalesOnDisabledByPrefs(const std::string
& locale
);
56 // Called when Chrome Translate server sends the language list which includes
57 // a undisplayable language in the user's locale.
58 void ReportUndisplayableLanguage(const std::string
& language
);
60 void ReportUnsupportedLanguageAtInitiation(const std::string
& language
);
62 // Provides UMA entry names for unit tests.
63 const char* GetMetricsName(MetricsNameIndex index
);
65 } // namespace TranslateBrowserMetrics
67 } // namespace translate
69 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_BROWSER_METRICS_H_