| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/mock_translate_ranker.h" | 5 #include "components/translate/core/browser/mock_translate_ranker.h" |
| 6 | 6 |
| 7 #include "components/metrics/proto/translate_event.pb.h" | 7 #include "components/metrics/proto/translate_event.pb.h" |
| 8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
| 9 | 9 |
| 10 namespace translate { | 10 namespace translate { |
| 11 namespace testing { | 11 namespace testing { |
| 12 | 12 |
| 13 MockTranslateRanker::MockTranslateRanker() {} | 13 MockTranslateRanker::MockTranslateRanker() {} |
| 14 | 14 |
| 15 MockTranslateRanker::~MockTranslateRanker() {} | 15 MockTranslateRanker::~MockTranslateRanker() {} |
| 16 | 16 |
| 17 uint32_t MockTranslateRanker::GetModelVersion() const { | 17 uint32_t MockTranslateRanker::GetModelVersion() const { |
| 18 return model_version_; | 18 return model_version_; |
| 19 } | 19 } |
| 20 | 20 |
| 21 bool MockTranslateRanker::ShouldOfferTranslation( | 21 bool MockTranslateRanker::ShouldOfferTranslation( |
| 22 const TranslatePrefs& /* translate_prefs */, | |
| 23 const std::string& /* src_lang */, | |
| 24 const std::string& /* dst_lang */, | |
| 25 metrics::TranslateEventProto* /*translate_event */) { | 22 metrics::TranslateEventProto* /*translate_event */) { |
| 26 return should_offer_translation_; | 23 return should_offer_translation_; |
| 27 } | 24 } |
| 28 | 25 |
| 29 void MockTranslateRanker::FlushTranslateEvents( | 26 void MockTranslateRanker::FlushTranslateEvents( |
| 30 std::vector<metrics::TranslateEventProto>* events) { | 27 std::vector<metrics::TranslateEventProto>* events) { |
| 31 events->swap(event_cache_); | 28 events->swap(event_cache_); |
| 32 event_cache_.clear(); | 29 event_cache_.clear(); |
| 33 } | 30 } |
| 34 | 31 |
| 35 } // namespace testing | 32 } // namespace testing |
| 36 } // namespace translate | 33 } // namespace translate |
| OLD | NEW |