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

Unified Diff: components/translate/core/common/translation_logging_helper.cc

Issue 2938813003: [Sync] Nest UserEvent message classes within UserEventSpecifics. (Closed)
Patch Set: Rebase Created 3 years, 6 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: components/translate/core/common/translation_logging_helper.cc
diff --git a/components/translate/core/common/translation_logging_helper.cc b/components/translate/core/common/translation_logging_helper.cc
index f0d4c1c749dc26771bfe3e05b8b4f010c361e330..d75f6948d646b7eef84d4ac53a9d32382780b74f 100644
--- a/components/translate/core/common/translation_logging_helper.cc
+++ b/components/translate/core/common/translation_logging_helper.cc
@@ -9,6 +9,8 @@
#include "components/metrics/proto/translate_event.pb.h"
#include "components/sync/protocol/user_event_specifics.pb.h"
+using Translation = sync_pb::UserEventSpecifics::Translation;
+
namespace translate {
namespace {
using metrics::TranslateEventProto;
@@ -27,7 +29,7 @@ bool ConstructTranslateEvent(const int64_t navigation_id,
translation->set_to_language_code(translate_event.target_language());
switch (translate_event.event_type()) {
case TranslateEventProto::UNKNOWN:
- translation->set_interaction(sync_pb::Translation::UNKNOWN);
+ translation->set_interaction(Translation::UNKNOWN);
break;
case TranslateEventProto::USER_ACCEPT:
if (translate_event.has_modified_source_language() ||
@@ -43,30 +45,28 @@ bool ConstructTranslateEvent(const int64_t navigation_id,
translation->set_to_language_code(
translate_event.modified_target_language());
}
- translation->set_interaction(sync_pb::Translation::MANUAL);
+ translation->set_interaction(Translation::MANUAL);
} else {
- translation->set_interaction(sync_pb::Translation::ACCEPT);
+ translation->set_interaction(Translation::ACCEPT);
}
break;
case TranslateEventProto::USER_DECLINE:
- translation->set_interaction(sync_pb::Translation::DECLINE);
+ translation->set_interaction(Translation::DECLINE);
break;
case TranslateEventProto::USER_IGNORE:
- translation->set_interaction(sync_pb::Translation::IGNORED);
+ translation->set_interaction(Translation::IGNORED);
break;
case TranslateEventProto::USER_DISMISS:
- translation->set_interaction(sync_pb::Translation::DISMISSED);
+ translation->set_interaction(Translation::DISMISSED);
break;
case TranslateEventProto::USER_REVERT:
- translation->set_interaction(sync_pb::Translation::TRANSLATION_REVERTED);
+ translation->set_interaction(Translation::TRANSLATION_REVERTED);
break;
case TranslateEventProto::AUTO_TRANSLATION_BY_PREF:
- translation->set_interaction(
- sync_pb::Translation::AUTO_TRANSLATION_BY_PREF);
+ translation->set_interaction(Translation::AUTO_TRANSLATION_BY_PREF);
break;
case TranslateEventProto::AUTO_TRANSLATION_BY_LINK:
- translation->set_interaction(
- sync_pb::Translation::AUTO_TRANSLATION_BY_LINK);
+ translation->set_interaction(Translation::AUTO_TRANSLATION_BY_LINK);
break;
default: // We don't care about other events.
return false;

Powered by Google App Engine
This is Rietveld 408576698