Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 void IncrementTranslationDeniedCount(const std::string& language); | 72 void IncrementTranslationDeniedCount(const std::string& language); |
| 73 void ResetTranslationDeniedCount(const std::string& language); | 73 void ResetTranslationDeniedCount(const std::string& language); |
| 74 | 74 |
| 75 // These methods are used to track how many times the user has accepted the | 75 // These methods are used to track how many times the user has accepted the |
| 76 // translation for a specific language. (So we can present a UI to white-list | 76 // translation for a specific language. (So we can present a UI to white-list |
| 77 // that language if the user keeps accepting translations). | 77 // that language if the user keeps accepting translations). |
| 78 int GetTranslationAcceptedCount(const std::string& language); | 78 int GetTranslationAcceptedCount(const std::string& language); |
| 79 void IncrementTranslationAcceptedCount(const std::string& language); | 79 void IncrementTranslationAcceptedCount(const std::string& language); |
| 80 void ResetTranslationAcceptedCount(const std::string& language); | 80 void ResetTranslationAcceptedCount(const std::string& language); |
| 81 | 81 |
| 82 // Returns the language list of chrome://settings/languages. | |
|
Evan Stade
2013/09/12 22:53:41
nit: s/returns/sets/
hajimehoshi
2013/09/13 01:39:19
Done.
| |
| 83 void GetLanguageList(std::vector<std::string>* languages); | |
| 84 | |
| 85 // Updates the language list of chrome://settings/languages. | |
| 86 void UpdateLanguageList(const std::vector<std::string>& languages); | |
| 87 | |
| 82 static bool CanTranslateLanguage( | 88 static bool CanTranslateLanguage( |
| 83 Profile* profile, const std::string& language); | 89 Profile* profile, const std::string& language); |
| 84 static bool ShouldAutoTranslate(PrefService* user_prefs, | 90 static bool ShouldAutoTranslate(PrefService* user_prefs, |
| 85 const std::string& original_language, std::string* target_language); | 91 const std::string& original_language, std::string* target_language); |
| 86 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 92 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 87 static void MigrateUserPrefs(PrefService* user_prefs); | 93 static void MigrateUserPrefs(PrefService* user_prefs); |
| 88 | 94 |
| 89 private: | 95 private: |
| 90 friend class TranslatePrefsTest; | 96 friend class TranslatePrefsTest; |
| 91 FRIEND_TEST_ALL_PREFIXES(TranslatePrefsTest, CreateBlockedLanguages); | 97 FRIEND_TEST_ALL_PREFIXES(TranslatePrefsTest, CreateBlockedLanguages); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 115 // Retrieves the dictionary mapping the number of times translation has been | 121 // Retrieves the dictionary mapping the number of times translation has been |
| 116 // accepted for a language, creating it if necessary. | 122 // accepted for a language, creating it if necessary. |
| 117 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; | 123 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; |
| 118 | 124 |
| 119 PrefService* prefs_; // Weak. | 125 PrefService* prefs_; // Weak. |
| 120 | 126 |
| 121 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); | 127 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 130 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
| OLD | NEW |