| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/translate/core/browser/translate_prefs.h" | 5 #include "components/translate/core/browser/translate_prefs.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 kPrefTranslateWhitelists, | 382 kPrefTranslateWhitelists, |
| 383 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 383 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 384 registry->RegisterDictionaryPref( | 384 registry->RegisterDictionaryPref( |
| 385 kPrefTranslateDeniedCount, | 385 kPrefTranslateDeniedCount, |
| 386 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 386 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 387 registry->RegisterDictionaryPref( | 387 registry->RegisterDictionaryPref( |
| 388 kPrefTranslateAcceptedCount, | 388 kPrefTranslateAcceptedCount, |
| 389 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 389 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 390 registry->RegisterListPref(kPrefTranslateBlockedLanguages, | 390 registry->RegisterListPref(kPrefTranslateBlockedLanguages, |
| 391 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 391 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 392 registry->RegisterDictionaryPref( | 392 registry->RegisterDictionaryPref(kPrefTranslateLastDeniedTimeForLanguage); |
| 393 kPrefTranslateLastDeniedTimeForLanguage, | |
| 394 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 395 registry->RegisterDictionaryPref( | 393 registry->RegisterDictionaryPref( |
| 396 kPrefTranslateTooOftenDeniedForLanguage, | 394 kPrefTranslateTooOftenDeniedForLanguage, |
| 397 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 395 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 398 } | 396 } |
| 399 | 397 |
| 400 // static | 398 // static |
| 401 void TranslatePrefs::MigrateUserPrefs(PrefService* user_prefs, | 399 void TranslatePrefs::MigrateUserPrefs(PrefService* user_prefs, |
| 402 const char* accept_languages_pref) { | 400 const char* accept_languages_pref) { |
| 403 // Old format of kPrefTranslateWhitelists | 401 // Old format of kPrefTranslateWhitelists |
| 404 // - original language -> list of target langs to auto-translate | 402 // - original language -> list of target langs to auto-translate |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 const base::ListValue* blacklist = prefs_->GetList(pref_id); | 574 const base::ListValue* blacklist = prefs_->GetList(pref_id); |
| 577 return (blacklist == NULL || blacklist->empty()); | 575 return (blacklist == NULL || blacklist->empty()); |
| 578 } | 576 } |
| 579 | 577 |
| 580 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { | 578 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { |
| 581 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); | 579 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); |
| 582 return (dict == NULL || dict->empty()); | 580 return (dict == NULL || dict->empty()); |
| 583 } | 581 } |
| 584 | 582 |
| 585 } // namespace translate | 583 } // namespace translate |
| OLD | NEW |