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/speech/chrome_speech_input_preferences.h" | 5 #include "chrome/browser/speech/chrome_speech_input_preferences.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
11 | 11 |
12 ChromeSpeechInputPreferences::ChromeSpeechInputPreferences( | 12 ChromeSpeechInputPreferences::ChromeSpeechInputPreferences( |
13 PrefService* pref_service) | 13 PrefService* pref_service) |
14 : censor_results_( | 14 : filter_profanities_( |
15 pref_service->GetBoolean(prefs::kSpeechInputCensorResults)) { | 15 pref_service->GetBoolean(prefs::kSpeechInputFilterProfanities)) { |
16 } | 16 } |
17 | 17 |
18 ChromeSpeechInputPreferences::~ChromeSpeechInputPreferences() { | 18 ChromeSpeechInputPreferences::~ChromeSpeechInputPreferences() { |
19 } | 19 } |
20 | 20 |
21 bool ChromeSpeechInputPreferences::censor_results() const { | 21 bool ChromeSpeechInputPreferences::filter_profanities() const { |
22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
23 return censor_results_; | 23 return filter_profanities_; |
24 } | 24 } |
25 | 25 |
26 void ChromeSpeechInputPreferences::set_censor_results(bool censor_results) { | 26 void ChromeSpeechInputPreferences::set_filter_profanities( |
| 27 bool filter_profanities) { |
27 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 28 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
28 BrowserThread::PostTask( | 29 BrowserThread::PostTask( |
29 BrowserThread::IO, FROM_HERE, | 30 BrowserThread::IO, FROM_HERE, |
30 base::Bind(&ChromeSpeechInputPreferences::set_censor_results, | 31 base::Bind(&ChromeSpeechInputPreferences::set_filter_profanities, |
31 this, censor_results)); | 32 this, filter_profanities)); |
32 return; | 33 return; |
33 } | 34 } |
34 censor_results_ = censor_results; | 35 filter_profanities_ = filter_profanities; |
35 } | 36 } |
OLD | NEW |