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. 4 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_BROWSER_METRICS_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_BROWSER_METRICS_H_ 7 8 #include <string> 9 10 namespace translate { 11 12 namespace TranslateBrowserMetrics { 13 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, 22 UMA_MAX, 23 }; 24 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 29 // below. 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 // Insert new items here. 43 INITIATION_STATUS_MAX, 44 }; 45 46 // Called when Chrome Translate is initiated to report a reason of the next 47 // browser action. 48 void ReportInitiationStatus(InitiationStatusType type); 49 50 // Called when Chrome opens the URL so that the user sends an error feedback. 51 void ReportLanguageDetectionError(); 52 53 void ReportLocalesOnDisabledByPrefs(const std::string& locale); 54 55 // Called when Chrome Translate server sends the language list which includes 56 // a undisplayable language in the user's locale. 57 void ReportUndisplayableLanguage(const std::string& language); 58 59 void ReportUnsupportedLanguageAtInitiation(const std::string& language); 60 61 // Provides UMA entry names for unit tests. 62 const char* GetMetricsName(MetricsNameIndex index); 63 64 } // namespace TranslateBrowserMetrics 65 66 } // namespace translate 67 68 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_BROWSER_METRICS_H_ 69