| OLD | NEW |
| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 605 |
| 606 void TranslateManager::RecordTranslateEvent(int event_type) { | 606 void TranslateManager::RecordTranslateEvent(int event_type) { |
| 607 DCHECK(metrics::TranslateEventProto::EventType_IsValid(event_type)); | 607 DCHECK(metrics::TranslateEventProto::EventType_IsValid(event_type)); |
| 608 translate_event_->set_event_type( | 608 translate_event_->set_event_type( |
| 609 static_cast<metrics::TranslateEventProto::EventType>(event_type)); | 609 static_cast<metrics::TranslateEventProto::EventType>(event_type)); |
| 610 translate_event_->set_event_timestamp_sec( | 610 translate_event_->set_event_timestamp_sec( |
| 611 (base::TimeTicks::Now() - base::TimeTicks()).InSeconds()); | 611 (base::TimeTicks::Now() - base::TimeTicks()).InSeconds()); |
| 612 translate_ranker_->AddTranslateEvent(*translate_event_); | 612 translate_ranker_->AddTranslateEvent(*translate_event_); |
| 613 } | 613 } |
| 614 | 614 |
| 615 bool TranslateManager::ShouldOverrideDecision(int event_type) { |
| 616 DCHECK(metrics::TranslateEventProto::EventType_IsValid(event_type)); |
| 617 if (translate_ranker_->IsDecisionOverrideEnabled()) { |
| 618 translate_event_->add_decision_overrides( |
| 619 static_cast<metrics::TranslateEventProto::EventType>(event_type)); |
| 620 DVLOG(3) << "Overriding decision of type: " << event_type; |
| 621 return true; |
| 622 } else { |
| 623 RecordTranslateEvent(event_type); |
| 624 return false; |
| 625 } |
| 626 } |
| 627 |
| 615 } // namespace translate | 628 } // namespace translate |
| OLD | NEW |