OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/translate/translate_prefs.h" | 5 #include "chrome/browser/translate/translate_prefs.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 | 279 |
280 // static | 280 // static |
281 bool TranslatePrefs::ShouldAutoTranslate(PrefService* user_prefs, | 281 bool TranslatePrefs::ShouldAutoTranslate(PrefService* user_prefs, |
282 const std::string& original_language, std::string* target_language) { | 282 const std::string& original_language, std::string* target_language) { |
283 TranslatePrefs prefs(user_prefs); | 283 TranslatePrefs prefs(user_prefs); |
284 return prefs.IsLanguageWhitelisted(original_language, target_language); | 284 return prefs.IsLanguageWhitelisted(original_language, target_language); |
285 } | 285 } |
286 | 286 |
287 // static | 287 // static |
288 void TranslatePrefs::RegisterUserPrefs( | 288 void TranslatePrefs::RegisterProfilePrefs( |
289 user_prefs::PrefRegistrySyncable* registry) { | 289 user_prefs::PrefRegistrySyncable* registry) { |
290 registry->RegisterListPref(kPrefTranslateLanguageBlacklist, | 290 registry->RegisterListPref(kPrefTranslateLanguageBlacklist, |
291 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 291 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
292 registry->RegisterListPref(kPrefTranslateSiteBlacklist, | 292 registry->RegisterListPref(kPrefTranslateSiteBlacklist, |
293 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 293 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
294 registry->RegisterDictionaryPref( | 294 registry->RegisterDictionaryPref( |
295 kPrefTranslateWhitelists, | 295 kPrefTranslateWhitelists, |
296 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 296 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
297 registry->RegisterDictionaryPref( | 297 registry->RegisterDictionaryPref( |
298 kPrefTranslateDeniedCount, | 298 kPrefTranslateDeniedCount, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 bool TranslatePrefs::IsListEmpty(const char* pref_id) const { | 485 bool TranslatePrefs::IsListEmpty(const char* pref_id) const { |
486 const ListValue* blacklist = prefs_->GetList(pref_id); | 486 const ListValue* blacklist = prefs_->GetList(pref_id); |
487 return (blacklist == NULL || blacklist->empty()); | 487 return (blacklist == NULL || blacklist->empty()); |
488 } | 488 } |
489 | 489 |
490 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { | 490 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { |
491 const DictionaryValue* dict = prefs_->GetDictionary(pref_id); | 491 const DictionaryValue* dict = prefs_->GetDictionary(pref_id); |
492 return (dict == NULL || dict->empty()); | 492 return (dict == NULL || dict->empty()); |
493 } | 493 } |
OLD | NEW |