Chromium Code Reviews| Index: components/translate/core/browser/translate_manager.h |
| diff --git a/components/translate/core/browser/translate_manager.h b/components/translate/core/browser/translate_manager.h |
| index 7ba87702ae84dd05797ecc3080dc6f1226fe1771..80105f7518c529435d2f38e881b4a063e9e82220 100644 |
| --- a/components/translate/core/browser/translate_manager.h |
| +++ b/components/translate/core/browser/translate_manager.h |
| @@ -11,6 +11,8 @@ |
| #include <vector> |
| #include "base/callback_list.h" |
| +#include "base/feature_list.h" |
| +#include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| #include "components/translate/core/browser/language_state.h" |
| @@ -21,6 +23,9 @@ class PrefService; |
| namespace translate { |
| +// Feature flag for "Translate Language by ULP" project. |
|
groby-ooo-7-16
2016/08/04 02:33:42
You can probably skip this comment - it says nothi
ftang
2016/08/05 04:45:27
Done.
|
| +extern const base::Feature kTranslateLanguageByULP; |
| + |
| class TranslateClient; |
| class TranslateDriver; |
| class TranslatePrefs; |
| @@ -52,6 +57,7 @@ class TranslateManager { |
| // Returns the language to translate to. The language returned is the |
| // first language found in the following list that is supported by the |
| // translation service: |
| + // High confidence and high probability reading language in ULP |
| // the UI language |
| // the accept-language list |
| // If no language is found then an empty string is returned. |
| @@ -103,11 +109,23 @@ class TranslateManager { |
| static void SetIgnoreMissingKeyForTesting(bool ignore); |
| private: |
| + FRIEND_TEST_ALL_PREFIXES(TranslateManagerTest, TestGetTargetLanguageFromULP); |
| + FRIEND_TEST_ALL_PREFIXES(TranslateManagerTest, TestLanguageInULP); |
| + |
| // Sends a translation request to the TranslateDriver. |
| void DoTranslatePage(const std::string& translate_script, |
| const std::string& source_lang, |
| const std::string& target_lang); |
| + // Returns the language to translate to by looking at ULP. Return empty string |
| + // If it cannot conclude from ULP. |
| + static std::string GetTargetLanguageFromULP(const TranslatePrefs* prefs); |
| + |
| + // Return true if the language is in the ULP with high confidence and high |
| + // probability. |
| + bool LanguageInULP(const TranslatePrefs* prefs, |
| + const std::string& language) const; |
| + |
| // Notifies all registered callbacks of translate errors. |
| void NotifyTranslateError(TranslateErrors::Type error_type); |