Commit 375260f7 authored by Anthony Vallee-Dubois's avatar Anthony Vallee-Dubois Committed by Commit Bot

Remove iOS Translate Event Logging in Sync

The feature is disabled by default, no config currently applies, and it
was decided to stop collecting these events. This removes the iOS
portion of the code because it allows removing a translate -> sync
dependency that was preventing another change from landing.

Bug: 896719,911781
Change-Id: I54c40dc1154bb6619d876dbd3fc86e3d22078e99
Reviewed-on: https://chromium-review.googlesource.com/c/1361927Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614385}
parent c8e84919
......@@ -38,7 +38,6 @@ source_set("translate") {
"//components/metrics",
"//components/prefs",
"//components/strings",
"//components/sync",
"//components/translate/core/browser",
"//components/translate/core/common",
"//components/translate/ios/browser",
......@@ -49,7 +48,6 @@ source_set("translate") {
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/infobars",
"//ios/chrome/browser/language",
"//ios/chrome/browser/sync",
"//ios/chrome/browser/ui/infobars:infobars_ui",
"//ios/chrome/browser/ui/util",
"//ios/web",
......
......@@ -13,9 +13,6 @@
#include "components/infobars/core/infobar.h"
#include "components/language/core/browser/language_model_manager.h"
#include "components/prefs/pref_service.h"
#include "components/sync/driver/sync_driver_switches.h"
#include "components/sync/protocol/user_event_specifics.pb.h"
#include "components/sync/user_events/user_event_service.h"
#include "components/translate/core/browser/page_translated_details.h"
#include "components/translate/core/browser/translate_accept_languages.h"
#include "components/translate/core/browser/translate_infobar_delegate.h"
......@@ -31,7 +28,6 @@
#include "ios/chrome/browser/infobars/infobar_manager_impl.h"
#include "ios/chrome/browser/language/language_model_manager_factory.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/sync/ios_user_event_service_factory.h"
#import "ios/chrome/browser/translate/after_translate_infobar_controller.h"
#import "ios/chrome/browser/translate/before_translate_infobar_controller.h"
#import "ios/chrome/browser/translate/never_translate_infobar_controller.h"
......@@ -135,31 +131,7 @@ std::unique_ptr<infobars::InfoBar> ChromeIOSTranslateClient::CreateInfoBar(
}
void ChromeIOSTranslateClient::RecordTranslateEvent(
const metrics::TranslateEventProto& translate_event) {
if (!base::FeatureList::IsEnabled(switches::kSyncUserTranslationEvents))
return;
syncer::UserEventService* const user_event_service =
IOSUserEventServiceFactory::GetForBrowserState(
ios::ChromeBrowserState::FromBrowserState(
web_state_->GetBrowserState()));
const auto* const item =
web_state_->GetNavigationManager()->GetLastCommittedItem();
// If entry is null, we don't record the page.
// The navigation entry can be null in situations like download or initial
// blank page.
if (item == nullptr)
return;
auto specifics = std::make_unique<sync_pb::UserEventSpecifics>();
// We only log the event we care about.
const bool needs_logging = translate::ConstructTranslateEvent(
item->GetTimestamp().ToInternalValue(), translate_event, specifics.get());
if (needs_logging) {
user_event_service->RecordUserEvent(std::move(specifics));
}
}
const metrics::TranslateEventProto& translate_event) {}
bool ChromeIOSTranslateClient::ShowTranslateUI(
translate::TranslateStep step,
......@@ -213,27 +185,7 @@ int ChromeIOSTranslateClient::GetInfobarIconID() const {
}
void ChromeIOSTranslateClient::RecordLanguageDetectionEvent(
const translate::LanguageDetectionDetails& details) const {
if (!base::FeatureList::IsEnabled(switches::kSyncUserLanguageDetectionEvents))
return;
syncer::UserEventService* const user_event_service =
IOSUserEventServiceFactory::GetForBrowserState(
ios::ChromeBrowserState::FromBrowserState(
web_state_->GetBrowserState()));
const auto* const item =
web_state_->GetNavigationManager()->GetLastCommittedItem();
// If entry is null, we don't record the page.
// The navigation entry can be null in situations like download or initial
// blank page.
if (item != nullptr &&
TranslateServiceIOS::IsTranslatableURL(item->GetVirtualURL())) {
user_event_service->RecordUserEvent(
translate::ConstructLanguageDetectionEvent(
item->GetTimestamp().ToInternalValue(), details));
}
}
const translate::LanguageDetectionDetails& details) const {}
bool ChromeIOSTranslateClient::IsTranslatableURL(const GURL& url) {
return TranslateServiceIOS::IsTranslatableURL(url);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment