Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: components/translate/core/browser/translate_prefs.h

Issue 2200493002: using ulp to improve TranslateManager GetTargetLanguage() and InitiateTranslation() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/translate_prefs.h
diff --git a/components/translate/core/browser/translate_prefs.h b/components/translate/core/browser/translate_prefs.h
index d03e2590061debcd9317873d50af269330d1de37..afcb8df9fbe3576996f5fd0c8cfa5a9da64cdf49 100644
--- a/components/translate/core/browser/translate_prefs.h
+++ b/components/translate/core/browser/translate_prefs.h
@@ -78,6 +78,7 @@ class DenialTimeUpdate {
// It is assumed that |prefs_| is alive while this instance is alive.
class TranslatePrefs {
public:
+ static const char kPrefLanguageProfile[];
static const char kPrefTranslateSiteBlacklist[];
static const char kPrefTranslateWhitelists[];
static const char kPrefTranslateDeniedCount[];
@@ -165,6 +166,27 @@ class TranslatePrefs {
bool ShouldAutoTranslate(const std::string& original_language,
std::string* target_language);
+ // Language and probability pair.
+ typedef std::pair<std::string, double> LanguageProbability;
groby-ooo-7-16 2016/08/02 00:38:21 LanguageAndProbability, please (so it's obvious th
ftang 2016/08/03 02:01:18 Done.
+ typedef std::vector<LanguageProbability> LanguageProbabilityList;
+
+ // Output the User Profile Profile's (ULP) "reading" list into |list| as
+ // order list of <string, double> pair. Return the confidence of the list
+ // or 0.0 if there no ULP "reading" list.
+ virtual double GetReadingFromUserLanguageProfile(
+ LanguageProbabilityList* list) const;
+
+ // Output the User Profile Profile's (ULP) "writing" list into |list| as
+ // order list of <string, double> pair. Return the confidence of the list
+ // or 0.0 if there no ULP "writing" list.
+ virtual double GetWritingFromUserLanguageProfile(
+ LanguageProbabilityList* list) const;
+
+ // Output the order list of Universal Language Settings (ULS) to |list|
groby-ooo-7-16 2016/08/02 00:38:21 What is the order list?
ftang 2016/08/03 02:01:18 function removed.
+ // and return the number of item on the list or 0 if there are no ULS list.
groby-ooo-7-16 2016/08/02 00:38:21 The number of items should be available via |list-
ftang 2016/08/03 02:01:18 function removed.
+ virtual int GetUniversialLanguageSettings(
+ std::vector<std::string>* list) const;
+
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
static void MigrateUserPrefs(PrefService* user_prefs,
const char* accept_languages_pref);
@@ -189,6 +211,9 @@ class TranslatePrefs {
bool IsListEmpty(const char* pref_id) const;
bool IsDictionaryEmpty(const char* pref_id) const;
+ double GetFromUserLanguageProfile(base::StringPiece path,
+ LanguageProbabilityList* list) const;
+
// Path to the preference storing the accept languages.
const std::string accept_languages_pref_;
#if defined(OS_CHROMEOS)

Powered by Google App Engine
This is Rietveld 408576698