| 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_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class TranslateRanker { | 37 class TranslateRanker { |
| 38 public: | 38 public: |
| 39 ~TranslateRanker(); | 39 ~TranslateRanker(); |
| 40 | 40 |
| 41 // Returns true if query or enforcement is enabled. | 41 // Returns true if query or enforcement is enabled. |
| 42 static bool IsEnabled(); | 42 static bool IsEnabled(); |
| 43 | 43 |
| 44 // Returns true if translate events logging is enabled. | 44 // Returns true if translate events logging is enabled. |
| 45 static bool IsLoggingEnabled(); | 45 static bool IsLoggingEnabled(); |
| 46 | 46 |
| 47 // Returns true if querying is enabled. |
| 48 static bool IsQueryEnabled(); |
| 49 |
| 50 // Returns true if enforcement is enabled. |
| 51 static bool IsEnforcementEnabled(); |
| 52 |
| 47 // Returns the singleton TranslateRanker instance. | 53 // Returns the singleton TranslateRanker instance. |
| 48 static TranslateRanker* GetInstance(); | 54 static TranslateRanker* GetInstance(); |
| 49 | 55 |
| 50 // For testing only. Returns a TranslateRanker instance preloaded with a | 56 // For testing only. Returns a TranslateRanker instance preloaded with a |
| 51 // TranslateRankerModel as defined by |model_data|. | 57 // TranslateRankerModel as defined by |model_data|. |
| 52 static std::unique_ptr<TranslateRanker> CreateForTesting( | 58 static std::unique_ptr<TranslateRanker> CreateForTesting( |
| 53 const std::string& model_data); | 59 const std::string& model_data); |
| 54 | 60 |
| 55 // Initiates downloading of the assist model data. This is a NOP if the model | 61 // Initiates downloading of the assist model data. This is a NOP if the model |
| 56 // data has already been downloaded. | 62 // data has already been downloaded. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 FRIEND_TEST_ALL_PREFIXES(TranslateRankerTest, CalculateScore); | 120 FRIEND_TEST_ALL_PREFIXES(TranslateRankerTest, CalculateScore); |
| 115 | 121 |
| 116 friend struct base::DefaultSingletonTraits<TranslateRanker>; | 122 friend struct base::DefaultSingletonTraits<TranslateRanker>; |
| 117 | 123 |
| 118 DISALLOW_COPY_AND_ASSIGN(TranslateRanker); | 124 DISALLOW_COPY_AND_ASSIGN(TranslateRanker); |
| 119 }; | 125 }; |
| 120 | 126 |
| 121 } // namespace translate | 127 } // namespace translate |
| 122 | 128 |
| 123 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ | 129 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ |
| OLD | NEW |