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

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

Issue 14622003: components: Move PrefRegistrySyncable into user_prefs namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 7 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 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 PrefRegistrySyncable;
13 class PrefService; 12 class PrefService;
14 13
15 namespace base { 14 namespace base {
16 class DictionaryValue; 15 class DictionaryValue;
17 class ListValue; 16 class ListValue;
18 } 17 }
19 18
19 namespace user_prefs {
20 class PrefRegistrySyncable;
21 }
22
20 class TranslatePrefs { 23 class TranslatePrefs {
21 public: 24 public:
22 static const char kPrefTranslateLanguageBlacklist[]; 25 static const char kPrefTranslateLanguageBlacklist[];
23 static const char kPrefTranslateSiteBlacklist[]; 26 static const char kPrefTranslateSiteBlacklist[];
24 static const char kPrefTranslateWhitelists[]; 27 static const char kPrefTranslateWhitelists[];
25 static const char kPrefTranslateDeniedCount[]; 28 static const char kPrefTranslateDeniedCount[];
26 static const char kPrefTranslateAcceptedCount[]; 29 static const char kPrefTranslateAcceptedCount[];
27 30
28 explicit TranslatePrefs(PrefService* user_prefs); 31 explicit TranslatePrefs(PrefService* user_prefs);
29 32
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // translation for a specific language. (So we can present a UI to white-list 67 // translation for a specific language. (So we can present a UI to white-list
65 // that language if the user keeps accepting translations). 68 // that language if the user keeps accepting translations).
66 int GetTranslationAcceptedCount(const std::string& language); 69 int GetTranslationAcceptedCount(const std::string& language);
67 void IncrementTranslationAcceptedCount(const std::string& language); 70 void IncrementTranslationAcceptedCount(const std::string& language);
68 void ResetTranslationAcceptedCount(const std::string& language); 71 void ResetTranslationAcceptedCount(const std::string& language);
69 72
70 static bool CanTranslate(PrefService* user_prefs, 73 static bool CanTranslate(PrefService* user_prefs,
71 const std::string& original_language, const GURL& url); 74 const std::string& original_language, const GURL& url);
72 static bool ShouldAutoTranslate(PrefService* user_prefs, 75 static bool ShouldAutoTranslate(PrefService* user_prefs,
73 const std::string& original_language, std::string* target_language); 76 const std::string& original_language, std::string* target_language);
74 static void RegisterUserPrefs(PrefRegistrySyncable* registry); 77 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
75 static void MigrateUserPrefs(PrefService* user_prefs); 78 static void MigrateUserPrefs(PrefService* user_prefs);
76 79
77 private: 80 private:
78 bool IsValueBlacklisted(const char* pref_id, const std::string& value) const; 81 bool IsValueBlacklisted(const char* pref_id, const std::string& value) const;
79 void BlacklistValue(const char* pref_id, const std::string& value); 82 void BlacklistValue(const char* pref_id, const std::string& value);
80 void RemoveValueFromBlacklist(const char* pref_id, const std::string& value); 83 void RemoveValueFromBlacklist(const char* pref_id, const std::string& value);
81 bool IsValueInList( 84 bool IsValueInList(
82 const base::ListValue* list, const std::string& value) const; 85 const base::ListValue* list, const std::string& value) const;
83 bool IsLanguageWhitelisted(const std::string& original_language, 86 bool IsLanguageWhitelisted(const std::string& original_language,
84 std::string* target_language) const; 87 std::string* target_language) const;
85 bool IsListEmpty(const char* pref_id) const; 88 bool IsListEmpty(const char* pref_id) const;
86 bool IsDictionaryEmpty(const char* pref_id) const; 89 bool IsDictionaryEmpty(const char* pref_id) const;
87 90
88 // Retrieves the dictionary mapping the number of times translation has been 91 // Retrieves the dictionary mapping the number of times translation has been
89 // denied for a language, creating it if necessary. 92 // denied for a language, creating it if necessary.
90 base::DictionaryValue* GetTranslationDeniedCountDictionary(); 93 base::DictionaryValue* GetTranslationDeniedCountDictionary();
91 94
92 // Retrieves the dictionary mapping the number of times translation has been 95 // Retrieves the dictionary mapping the number of times translation has been
93 // accepted for a language, creating it if necessary. 96 // accepted for a language, creating it if necessary.
94 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; 97 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const;
95 98
96 PrefService* prefs_; // Weak. 99 PrefService* prefs_; // Weak.
97 }; 100 };
98 101
99 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ 102 #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