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

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

Issue 2629173002: Add a country field to TranslateEventProto. (Closed)
Patch Set: Log country in translate_events. Created 3 years, 11 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
« no previous file with comments | « components/metrics/proto/translate_event.proto ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 void TranslateManager::SetIgnoreMissingKeyForTesting(bool ignore) { 576 void TranslateManager::SetIgnoreMissingKeyForTesting(bool ignore) {
577 ignore_missing_key_for_testing_ = ignore; 577 ignore_missing_key_for_testing_ = ignore;
578 } 578 }
579 579
580 void TranslateManager::InitTranslateEvent(const std::string& src_lang, 580 void TranslateManager::InitTranslateEvent(const std::string& src_lang,
581 const std::string& dst_lang, 581 const std::string& dst_lang,
582 const TranslatePrefs& prefs) { 582 const TranslatePrefs& prefs) {
583 translate_event_->Clear(); 583 translate_event_->Clear();
584 translate_event_->set_source_language(src_lang); 584 translate_event_->set_source_language(src_lang);
585 translate_event_->set_target_language(dst_lang); 585 translate_event_->set_target_language(dst_lang);
586 translate_event_->set_country(prefs.GetCountry());
586 translate_event_->set_accept_count( 587 translate_event_->set_accept_count(
587 prefs.GetTranslationAcceptedCount(src_lang)); 588 prefs.GetTranslationAcceptedCount(src_lang));
588 translate_event_->set_decline_count( 589 translate_event_->set_decline_count(
589 prefs.GetTranslationDeniedCount(src_lang)); 590 prefs.GetTranslationDeniedCount(src_lang));
590 translate_event_->set_ignore_count( 591 translate_event_->set_ignore_count(
591 prefs.GetTranslationIgnoredCount(src_lang)); 592 prefs.GetTranslationIgnoredCount(src_lang));
592 translate_event_->set_ranker_response( 593 translate_event_->set_ranker_response(
593 metrics::TranslateEventProto::NOT_QUERIED); 594 metrics::TranslateEventProto::NOT_QUERIED);
594 translate_event_->set_event_type(metrics::TranslateEventProto::UNKNOWN); 595 translate_event_->set_event_type(metrics::TranslateEventProto::UNKNOWN);
595 // TODO(rogerm): Populate the language list. 596 // TODO(rogerm): Populate the language list.
596 } 597 }
597 598
598 void TranslateManager::RecordTranslateEvent(int event_type) { 599 void TranslateManager::RecordTranslateEvent(int event_type) {
599 DCHECK(metrics::TranslateEventProto::EventType_IsValid(event_type)); 600 DCHECK(metrics::TranslateEventProto::EventType_IsValid(event_type));
600 translate_event_->set_event_type( 601 translate_event_->set_event_type(
601 static_cast<metrics::TranslateEventProto::EventType>(event_type)); 602 static_cast<metrics::TranslateEventProto::EventType>(event_type));
602 translate_event_->set_event_timestamp_sec( 603 translate_event_->set_event_timestamp_sec(
603 (base::TimeTicks::Now() - base::TimeTicks()).InSeconds()); 604 (base::TimeTicks::Now() - base::TimeTicks()).InSeconds());
604 TranslateRanker::GetInstance()->RecordTranslateEvent(*translate_event_); 605 TranslateRanker::GetInstance()->RecordTranslateEvent(*translate_event_);
605 } 606 }
606 607
607 } // namespace translate 608 } // namespace translate
OLDNEW
« no previous file with comments | « components/metrics/proto/translate_event.proto ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698