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