| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/speech/chrome_speech_recognition_preferences.h" | 5 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 : ProfileKeyedServiceFactory( | 53 : ProfileKeyedServiceFactory( |
| 54 "ChromeSpeechRecognitionPreferences", | 54 "ChromeSpeechRecognitionPreferences", |
| 55 ProfileDependencyManager::GetInstance()) { | 55 ProfileDependencyManager::GetInstance()) { |
| 56 } | 56 } |
| 57 | 57 |
| 58 ChromeSpeechRecognitionPreferences::Factory::~Factory() { | 58 ChromeSpeechRecognitionPreferences::Factory::~Factory() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 ProfileKeyedService* | 61 ProfileKeyedService* |
| 62 ChromeSpeechRecognitionPreferences::Factory::BuildServiceInstanceFor( | 62 ChromeSpeechRecognitionPreferences::Factory::BuildServiceInstanceFor( |
| 63 Profile* profile) const { | 63 content::BrowserContext* profile) const { |
| 64 DCHECK(profile); | 64 DCHECK(profile); |
| 65 return new ChromeSpeechRecognitionPreferences::Service(profile); | 65 return new ChromeSpeechRecognitionPreferences::Service( |
| 66 static_cast<Profile*>(profile)); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void ChromeSpeechRecognitionPreferences::Factory::RegisterUserPrefs( | 69 void ChromeSpeechRecognitionPreferences::Factory::RegisterUserPrefs( |
| 69 PrefRegistrySyncable* prefs) { | 70 PrefRegistrySyncable* prefs) { |
| 70 prefs->RegisterBooleanPref( | 71 prefs->RegisterBooleanPref( |
| 71 prefs::kSpeechRecognitionFilterProfanities, | 72 prefs::kSpeechRecognitionFilterProfanities, |
| 72 kDefaultFilterProfanities, | 73 kDefaultFilterProfanities, |
| 73 PrefRegistrySyncable::UNSYNCABLE_PREF); | 74 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 74 | 75 |
| 75 prefs->RegisterListPref( | 76 prefs->RegisterListPref( |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 prefs::kSpeechRecognitionFilterProfanities); | 215 prefs::kSpeechRecognitionFilterProfanities); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void ChromeSpeechRecognitionPreferences::ReloadNotificationsShown() { | 218 void ChromeSpeechRecognitionPreferences::ReloadNotificationsShown() { |
| 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 219 base::AutoLock write_lock(preferences_lock_); | 220 base::AutoLock write_lock(preferences_lock_); |
| 220 const base::ListValue* pref_list = profile_->GetPrefs()->GetList( | 221 const base::ListValue* pref_list = profile_->GetPrefs()->GetList( |
| 221 prefs::kSpeechRecognitionTrayNotificationShownContexts); | 222 prefs::kSpeechRecognitionTrayNotificationShownContexts); |
| 222 notifications_shown_.reset(pref_list->DeepCopy()); | 223 notifications_shown_.reset(pref_list->DeepCopy()); |
| 223 } | 224 } |
| OLD | NEW |