| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 | 12 |
| 13 class PrefService; |
| 14 |
| 15 namespace base { |
| 13 class DictionaryValue; | 16 class DictionaryValue; |
| 14 class ListValue; | 17 class ListValue; |
| 15 class PrefService; | 18 } |
| 16 | 19 |
| 17 class TranslatePrefs { | 20 class TranslatePrefs { |
| 18 public: | 21 public: |
| 19 static const char kPrefTranslateLanguageBlacklist[]; | 22 static const char kPrefTranslateLanguageBlacklist[]; |
| 20 static const char kPrefTranslateSiteBlacklist[]; | 23 static const char kPrefTranslateSiteBlacklist[]; |
| 21 static const char kPrefTranslateWhitelists[]; | 24 static const char kPrefTranslateWhitelists[]; |
| 22 static const char kPrefTranslateDeniedCount[]; | 25 static const char kPrefTranslateDeniedCount[]; |
| 23 static const char kPrefTranslateAcceptedCount[]; | 26 static const char kPrefTranslateAcceptedCount[]; |
| 24 | 27 |
| 25 explicit TranslatePrefs(PrefService* user_prefs); | 28 explicit TranslatePrefs(PrefService* user_prefs); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const std::string& original_language, const GURL& url); | 60 const std::string& original_language, const GURL& url); |
| 58 static bool ShouldAutoTranslate(PrefService* user_prefs, | 61 static bool ShouldAutoTranslate(PrefService* user_prefs, |
| 59 const std::string& original_language, std::string* target_language); | 62 const std::string& original_language, std::string* target_language); |
| 60 static void RegisterUserPrefs(PrefService* user_prefs); | 63 static void RegisterUserPrefs(PrefService* user_prefs); |
| 61 | 64 |
| 62 private: | 65 private: |
| 63 static void MigrateTranslateWhitelists(PrefService* user_prefs); | 66 static void MigrateTranslateWhitelists(PrefService* user_prefs); |
| 64 bool IsValueBlacklisted(const char* pref_id, const std::string& value); | 67 bool IsValueBlacklisted(const char* pref_id, const std::string& value); |
| 65 void BlacklistValue(const char* pref_id, const std::string& value); | 68 void BlacklistValue(const char* pref_id, const std::string& value); |
| 66 void RemoveValueFromBlacklist(const char* pref_id, const std::string& value); | 69 void RemoveValueFromBlacklist(const char* pref_id, const std::string& value); |
| 67 bool IsValueInList(const ListValue* list, const std::string& value); | 70 bool IsValueInList(const base::ListValue* list, const std::string& value); |
| 68 bool IsLanguageWhitelisted(const std::string& original_language, | 71 bool IsLanguageWhitelisted(const std::string& original_language, |
| 69 std::string* target_language); | 72 std::string* target_language); |
| 70 | 73 |
| 71 // Retrieves the dictionary mapping the number of times translation has been | 74 // Retrieves the dictionary mapping the number of times translation has been |
| 72 // denied for a language, creating it if necessary. | 75 // denied for a language, creating it if necessary. |
| 73 DictionaryValue* GetTranslationDeniedCountDictionary(); | 76 base::DictionaryValue* GetTranslationDeniedCountDictionary(); |
| 74 | 77 |
| 75 // Retrieves the dictionary mapping the number of times translation has been | 78 // Retrieves the dictionary mapping the number of times translation has been |
| 76 // accepted for a language, creating it if necessary. | 79 // accepted for a language, creating it if necessary. |
| 77 DictionaryValue* GetTranslationAcceptedCountDictionary(); | 80 base::DictionaryValue* GetTranslationAcceptedCountDictionary(); |
| 78 | 81 |
| 79 PrefService* prefs_; // Weak. | 82 PrefService* prefs_; // Weak. |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 85 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
| OLD | NEW |