| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_IMPL_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_IMPL_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_IMPL_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace translate { | 29 namespace translate { |
| 30 | 30 |
| 31 class TranslatePrefs; | 31 class TranslatePrefs; |
| 32 | 32 |
| 33 // Features used to enable ranker query, enforcement and logging. Note that | 33 // Features used to enable ranker query, enforcement and logging. Note that |
| 34 // enabling enforcement implies (forces) enabling queries. | 34 // enabling enforcement implies (forces) enabling queries. |
| 35 extern const base::Feature kTranslateRankerQuery; | 35 extern const base::Feature kTranslateRankerQuery; |
| 36 extern const base::Feature kTranslateRankerEnforcement; | 36 extern const base::Feature kTranslateRankerEnforcement; |
| 37 extern const base::Feature kTranslateRankerLogging; | 37 extern const base::Feature kTranslateRankerLogging; |
| 38 extern const base::Feature kTranslateRankerDecisionOverride; |
| 38 | 39 |
| 39 struct TranslateRankerFeatures { | 40 struct TranslateRankerFeatures { |
| 40 TranslateRankerFeatures(); | 41 TranslateRankerFeatures(); |
| 41 | 42 |
| 42 TranslateRankerFeatures(int accepted, | 43 TranslateRankerFeatures(int accepted, |
| 43 int denied, | 44 int denied, |
| 44 int ignored, | 45 int ignored, |
| 45 const std::string& src, | 46 const std::string& src, |
| 46 const std::string& dst, | 47 const std::string& dst, |
| 47 const std::string& cntry, | 48 const std::string& cntry, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 static base::FilePath GetModelPath(const base::FilePath& data_dir); | 85 static base::FilePath GetModelPath(const base::FilePath& data_dir); |
| 85 | 86 |
| 86 // Get the URL from which the download the translate ranker model, by default | 87 // Get the URL from which the download the translate ranker model, by default |
| 87 // from Finch. | 88 // from Finch. |
| 88 static GURL GetModelURL(); | 89 static GURL GetModelURL(); |
| 89 | 90 |
| 90 // TranslateRanker... | 91 // TranslateRanker... |
| 91 bool IsLoggingEnabled() override; | 92 bool IsLoggingEnabled() override; |
| 92 bool IsQueryEnabled() override; | 93 bool IsQueryEnabled() override; |
| 93 bool IsEnforcementEnabled() override; | 94 bool IsEnforcementEnabled() override; |
| 95 bool IsDecisionOverrideEnabled() override; |
| 94 int GetModelVersion() const override; | 96 int GetModelVersion() const override; |
| 95 bool ShouldOfferTranslation(const TranslatePrefs& translate_prefs, | 97 bool ShouldOfferTranslation(const TranslatePrefs& translate_prefs, |
| 96 const std::string& src_lang, | 98 const std::string& src_lang, |
| 97 const std::string& dst_lang) override; | 99 const std::string& dst_lang) override; |
| 98 void AddTranslateEvent( | 100 void AddTranslateEvent( |
| 99 const metrics::TranslateEventProto& translate_event) override; | 101 const metrics::TranslateEventProto& translate_event) override; |
| 100 void FlushTranslateEvents( | 102 void FlushTranslateEvents( |
| 101 std::vector<metrics::TranslateEventProto>* events) override; | 103 std::vector<metrics::TranslateEventProto>* events) override; |
| 102 | 104 |
| 103 void OnModelAvailable( | 105 void OnModelAvailable( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 123 | 125 |
| 124 DISALLOW_COPY_AND_ASSIGN(TranslateRankerImpl); | 126 DISALLOW_COPY_AND_ASSIGN(TranslateRankerImpl); |
| 125 }; | 127 }; |
| 126 | 128 |
| 127 } // namespace translate | 129 } // namespace translate |
| 128 | 130 |
| 129 std::ostream& operator<<(std::ostream& stream, | 131 std::ostream& operator<<(std::ostream& stream, |
| 130 const translate::TranslateRankerFeatures& features); | 132 const translate::TranslateRankerFeatures& features); |
| 131 | 133 |
| 132 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_IMPL_H_ | 134 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_IMPL_H_ |
| OLD | NEW |