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

Side by Side Diff: chrome/browser/translate/translate_prefs.h

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 9
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 11
12 class PrefService; 12 class PrefService;
13 class PrefServiceSyncable;
13 14
14 namespace base { 15 namespace base {
15 class DictionaryValue; 16 class DictionaryValue;
16 class ListValue; 17 class ListValue;
17 } 18 }
18 19
19 class TranslatePrefs { 20 class TranslatePrefs {
20 public: 21 public:
21 static const char kPrefTranslateLanguageBlacklist[]; 22 static const char kPrefTranslateLanguageBlacklist[];
22 static const char kPrefTranslateSiteBlacklist[]; 23 static const char kPrefTranslateSiteBlacklist[];
(...skipping 29 matching lines...) Expand all
52 // translation for a specific language. (So we can present a UI to white-list 53 // translation for a specific language. (So we can present a UI to white-list
53 // that langueg if the user keeps accepting translations). 54 // that langueg if the user keeps accepting translations).
54 int GetTranslationAcceptedCount(const std::string& language); 55 int GetTranslationAcceptedCount(const std::string& language);
55 void IncrementTranslationAcceptedCount(const std::string& language); 56 void IncrementTranslationAcceptedCount(const std::string& language);
56 void ResetTranslationAcceptedCount(const std::string& language); 57 void ResetTranslationAcceptedCount(const std::string& language);
57 58
58 static bool CanTranslate(PrefService* user_prefs, 59 static bool CanTranslate(PrefService* user_prefs,
59 const std::string& original_language, const GURL& url); 60 const std::string& original_language, const GURL& url);
60 static bool ShouldAutoTranslate(PrefService* user_prefs, 61 static bool ShouldAutoTranslate(PrefService* user_prefs,
61 const std::string& original_language, std::string* target_language); 62 const std::string& original_language, std::string* target_language);
62 static void RegisterUserPrefs(PrefService* user_prefs); 63 static void RegisterUserPrefs(PrefServiceSyncable* user_prefs);
63 64
64 private: 65 private:
65 static void MigrateTranslateWhitelists(PrefService* user_prefs); 66 static void MigrateTranslateWhitelists(PrefService* user_prefs);
66 bool IsValueBlacklisted(const char* pref_id, const std::string& value); 67 bool IsValueBlacklisted(const char* pref_id, const std::string& value);
67 void BlacklistValue(const char* pref_id, const std::string& value); 68 void BlacklistValue(const char* pref_id, const std::string& value);
68 void RemoveValueFromBlacklist(const char* pref_id, const std::string& value); 69 void RemoveValueFromBlacklist(const char* pref_id, const std::string& value);
69 bool IsValueInList(const base::ListValue* list, const std::string& value); 70 bool IsValueInList(const base::ListValue* list, const std::string& value);
70 bool IsLanguageWhitelisted(const std::string& original_language, 71 bool IsLanguageWhitelisted(const std::string& original_language,
71 std::string* target_language); 72 std::string* target_language);
72 73
73 // Retrieves the dictionary mapping the number of times translation has been 74 // Retrieves the dictionary mapping the number of times translation has been
74 // denied for a language, creating it if necessary. 75 // denied for a language, creating it if necessary.
75 base::DictionaryValue* GetTranslationDeniedCountDictionary(); 76 base::DictionaryValue* GetTranslationDeniedCountDictionary();
76 77
77 // Retrieves the dictionary mapping the number of times translation has been 78 // Retrieves the dictionary mapping the number of times translation has been
78 // accepted for a language, creating it if necessary. 79 // accepted for a language, creating it if necessary.
79 base::DictionaryValue* GetTranslationAcceptedCountDictionary(); 80 base::DictionaryValue* GetTranslationAcceptedCountDictionary();
80 81
81 PrefService* prefs_; // Weak. 82 PrefService* prefs_; // Weak.
82 }; 83 };
83 84
84 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ 85 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service_factory.cc ('k') | chrome/browser/translate/translate_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698