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

Unified Diff: chrome/browser/translate/chrome_translate_client.cc

Issue 2941953002: Add switches for language detection and translation logging. (Closed)
Patch Set: updates 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
« no previous file with comments | « no previous file | chrome/browser/translate/chrome_translate_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/chrome_translate_client.cc
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc
index ad257ad88d653889fe57ce825df115e77ac88649..87b1151b14c82c7d30483a7f9f319e758d6dd47a 100644
--- a/chrome/browser/translate/chrome_translate_client.cc
+++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <vector>
+#include "base/feature_list.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/string_split.h"
@@ -31,6 +32,7 @@
#include "chrome/grit/theme_resources.h"
#include "components/metrics/proto/translate_event.pb.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/language_model.h"
@@ -52,6 +54,7 @@
#include "url/gurl.h"
namespace {
+using base::FeatureList;
using metrics::TranslateEventProto;
TranslateEventProto::EventType BubbleResultToTranslateEvent(
@@ -78,6 +81,8 @@ TranslateEventProto::EventType BubbleResultToTranslateEvent(
void LogLanguageDetectionEvent(
const content::WebContents* const web_contents,
const translate::LanguageDetectionDetails& details) {
+ if (!FeatureList::IsEnabled(switches::kSyncUserLanguageDetectionEvents))
+ return;
auto* const profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
@@ -103,6 +108,8 @@ void LogLanguageDetectionEvent(
void LogTranslateEvent(const content::WebContents* const web_contents,
const metrics::TranslateEventProto& translate_event) {
+ if (!FeatureList::IsEnabled(switches::kSyncUserTranslationEvents))
+ return;
DCHECK(web_contents);
auto* const profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
« no previous file with comments | « no previous file | chrome/browser/translate/chrome_translate_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698