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

Side by Side Diff: components/translate/core/browser/translate_manager.cc

Issue 2938133003: Split translate_event.proto AUTOMATICALLY_TRANSLATED. (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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/translate/core/browser/translate_manager.h" 5 #include "components/translate/core/browser/translate_manager.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // feature; the user will get an infobar, so they can control whether the 260 // feature; the user will get an infobar, so they can control whether the
261 // page's text is sent to the translate server. 261 // page's text is sent to the translate server.
262 if (!translate_driver_->IsIncognito()) { 262 if (!translate_driver_->IsIncognito()) {
263 std::string auto_target_lang = 263 std::string auto_target_lang =
264 GetAutoTargetLanguage(language_code, translate_prefs.get()); 264 GetAutoTargetLanguage(language_code, translate_prefs.get());
265 if (!auto_target_lang.empty()) { 265 if (!auto_target_lang.empty()) {
266 TranslateBrowserMetrics::ReportInitiationStatus( 266 TranslateBrowserMetrics::ReportInitiationStatus(
267 TranslateBrowserMetrics::INITIATION_STATUS_AUTO_BY_CONFIG); 267 TranslateBrowserMetrics::INITIATION_STATUS_AUTO_BY_CONFIG);
268 translate_event_->set_modified_target_language(auto_target_lang); 268 translate_event_->set_modified_target_language(auto_target_lang);
269 RecordTranslateEvent( 269 RecordTranslateEvent(
270 metrics::TranslateEventProto::AUTOMATICALLY_TRANSLATED); 270 metrics::TranslateEventProto::AUTO_TRANSLATION_BY_PREF);
271 TranslatePage(language_code, auto_target_lang, false); 271 TranslatePage(language_code, auto_target_lang, false);
272 return; 272 return;
273 } 273 }
274 } 274 }
275 275
276 std::string auto_translate_to = language_state_.AutoTranslateTo(); 276 std::string auto_translate_to = language_state_.AutoTranslateTo();
277 if (!auto_translate_to.empty()) { 277 if (!auto_translate_to.empty()) {
278 // This page was navigated through a click from a translated page. 278 // This page was navigated through a click from a translated page.
279 TranslateBrowserMetrics::ReportInitiationStatus( 279 TranslateBrowserMetrics::ReportInitiationStatus(
280 TranslateBrowserMetrics::INITIATION_STATUS_AUTO_BY_LINK); 280 TranslateBrowserMetrics::INITIATION_STATUS_AUTO_BY_LINK);
281 translate_event_->set_modified_target_language(auto_translate_to); 281 translate_event_->set_modified_target_language(auto_translate_to);
282 RecordTranslateEvent( 282 RecordTranslateEvent(
283 metrics::TranslateEventProto::AUTOMATICALLY_TRANSLATED); 283 metrics::TranslateEventProto::AUTO_TRANSLATION_BY_LINK);
284 TranslatePage(language_code, auto_translate_to, false); 284 TranslatePage(language_code, auto_translate_to, false);
285 return; 285 return;
286 } 286 }
287 287
288 if (LanguageInULP(language_code)) { 288 if (LanguageInULP(language_code)) {
289 TranslateBrowserMetrics::ReportInitiationStatus( 289 TranslateBrowserMetrics::ReportInitiationStatus(
290 TranslateBrowserMetrics::INITIATION_STATUS_LANGUAGE_IN_ULP); 290 TranslateBrowserMetrics::INITIATION_STATUS_LANGUAGE_IN_ULP);
291 RecordTranslateEvent(metrics::TranslateEventProto::LANGUAGE_IN_ULP); 291 RecordTranslateEvent(metrics::TranslateEventProto::LANGUAGE_IN_ULP);
292 return; 292 return;
293 } 293 }
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 source_language) && 605 source_language) &&
606 !ShouldOverrideDecision( 606 !ShouldOverrideDecision(
607 metrics::TranslateEventProto::LANGUAGE_DISABLED_BY_AUTO_BLACKLIST)) { 607 metrics::TranslateEventProto::LANGUAGE_DISABLED_BY_AUTO_BLACKLIST)) {
608 return true; 608 return true;
609 } 609 }
610 610
611 return false; 611 return false;
612 } 612 }
613 613
614 } // namespace translate 614 } // namespace translate
OLDNEW
« no previous file with comments | « components/sync/protocol/user_event_specifics.proto ('k') | components/translate/core/common/translation_logging_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698