Index: chrome/browser/speech/chrome_speech_input_preferences.cc |
diff --git a/chrome/browser/speech/chrome_speech_input_preferences.cc b/chrome/browser/speech/chrome_speech_input_preferences.cc |
index e6a298271e758e10f9cbf75244633245d492d0ef..f007e2a5ad0aac8b3552d19b1be8ebe4df02858a 100644 |
--- a/chrome/browser/speech/chrome_speech_input_preferences.cc |
+++ b/chrome/browser/speech/chrome_speech_input_preferences.cc |
@@ -10,26 +10,36 @@ |
#include "content/browser/browser_thread.h" |
ChromeSpeechInputPreferences::ChromeSpeechInputPreferences( |
- PrefService* pref_service) |
- : censor_results_( |
- pref_service->GetBoolean(prefs::kSpeechInputCensorResults)) { |
+ PrefService* pref_service) { |
+ // Migrate the old profanity filtering key to the new one. |
Satish
2011/10/07 20:09:26
may be simpler to leave the name of the preference
Leandro GraciĆ” Gil
2011/10/07 23:22:09
Agreed. I'll leave a comment to make sure the old
|
+ if (pref_service->HasPrefPath(prefs::kSpeechInputCensorResultsDeprecated)) { |
+ bool filter = pref_service->GetBoolean( |
+ prefs::kSpeechInputCensorResultsDeprecated); |
+ pref_service->ClearPref(prefs::kSpeechInputCensorResultsDeprecated); |
+ pref_service->SetBoolean(prefs::kSpeechInputFilterProfanities, filter); |
+ filter_profanities_ = filter; |
+ } else { |
+ filter_profanities_ = pref_service->GetBoolean( |
+ prefs::kSpeechInputFilterProfanities); |
+ } |
} |
ChromeSpeechInputPreferences::~ChromeSpeechInputPreferences() { |
} |
-bool ChromeSpeechInputPreferences::censor_results() const { |
+bool ChromeSpeechInputPreferences::filter_profanities() const { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- return censor_results_; |
+ return filter_profanities_; |
} |
-void ChromeSpeechInputPreferences::set_censor_results(bool censor_results) { |
+void ChromeSpeechInputPreferences::set_filter_profanities( |
+ bool filter_profanities) { |
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
- base::Bind(&ChromeSpeechInputPreferences::set_censor_results, |
- this, censor_results)); |
+ base::Bind(&ChromeSpeechInputPreferences::set_filter_profanities, |
+ this, filter_profanities)); |
return; |
} |
- censor_results_ = censor_results; |
+ filter_profanities_ = filter_profanities; |
} |