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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 BrowserContextKeyedService* | 61 BrowserContextKeyedService* |
62 ChromeSpeechRecognitionPreferences::Factory::BuildServiceInstanceFor( | 62 ChromeSpeechRecognitionPreferences::Factory::BuildServiceInstanceFor( |
63 content::BrowserContext* profile) const { | 63 content::BrowserContext* profile) const { |
64 DCHECK(profile); | 64 DCHECK(profile); |
65 return new ChromeSpeechRecognitionPreferences::Service( | 65 return new ChromeSpeechRecognitionPreferences::Service( |
66 static_cast<Profile*>(profile)); | 66 static_cast<Profile*>(profile)); |
67 } | 67 } |
68 | 68 |
69 void ChromeSpeechRecognitionPreferences::Factory::RegisterUserPrefs( | 69 void ChromeSpeechRecognitionPreferences::Factory::RegisterProfilePrefs( |
70 user_prefs::PrefRegistrySyncable* prefs) { | 70 user_prefs::PrefRegistrySyncable* prefs) { |
71 prefs->RegisterBooleanPref( | 71 prefs->RegisterBooleanPref( |
72 prefs::kSpeechRecognitionFilterProfanities, | 72 prefs::kSpeechRecognitionFilterProfanities, |
73 kDefaultFilterProfanities, | 73 kDefaultFilterProfanities, |
74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
75 | 75 |
76 prefs->RegisterListPref( | 76 prefs->RegisterListPref( |
77 prefs::kSpeechRecognitionTrayNotificationShownContexts, | 77 prefs::kSpeechRecognitionTrayNotificationShownContexts, |
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
79 } | 79 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 prefs::kSpeechRecognitionFilterProfanities); | 210 prefs::kSpeechRecognitionFilterProfanities); |
211 } | 211 } |
212 | 212 |
213 void ChromeSpeechRecognitionPreferences::ReloadNotificationsShown() { | 213 void ChromeSpeechRecognitionPreferences::ReloadNotificationsShown() { |
214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
215 base::AutoLock write_lock(preferences_lock_); | 215 base::AutoLock write_lock(preferences_lock_); |
216 const base::ListValue* pref_list = profile_->GetPrefs()->GetList( | 216 const base::ListValue* pref_list = profile_->GetPrefs()->GetList( |
217 prefs::kSpeechRecognitionTrayNotificationShownContexts); | 217 prefs::kSpeechRecognitionTrayNotificationShownContexts); |
218 notifications_shown_.reset(pref_list->DeepCopy()); | 218 notifications_shown_.reset(pref_list->DeepCopy()); |
219 } | 219 } |
OLD | NEW |