Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: chrome/browser/speech/chrome_speech_recognition_preferences.cc

Issue 10407120: Moving tray icon and notification balloon for background speech recognition sessions to ChromeSpeec… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed win issued ("interface" member clashes with a VS macro name, sigh) Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 filter_profanities); 153 filter_profanities);
154 } 154 }
155 } 155 }
156 156
157 void ChromeSpeechRecognitionPreferences::ToggleFilterProfanities() { 157 void ChromeSpeechRecognitionPreferences::ToggleFilterProfanities() {
158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
159 SetFilterProfanities(!FilterProfanities()); 159 SetFilterProfanities(!FilterProfanities());
160 } 160 }
161 161
162 bool ChromeSpeechRecognitionPreferences::ShouldShowSecurityNotification( 162 bool ChromeSpeechRecognitionPreferences::ShouldShowSecurityNotification(
163 const string16& context_name) const { 163 const std::string& context_name) const {
164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
165 DCHECK(notifications_shown_.get()); 165 DCHECK(notifications_shown_.get());
166 scoped_ptr<base::StringValue> match_name( 166 scoped_ptr<base::StringValue> match_name(
167 base::Value::CreateStringValue(context_name)); 167 base::Value::CreateStringValue(context_name));
168 return notifications_shown_->Find(*match_name) == notifications_shown_->end(); 168 return notifications_shown_->Find(*match_name) == notifications_shown_->end();
169 } 169 }
170 170
171 void ChromeSpeechRecognitionPreferences::SetHasShownSecurityNotification( 171 void ChromeSpeechRecognitionPreferences::SetHasShownSecurityNotification(
172 const string16& context_name) { 172 const std::string& context_name) {
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
174 DCHECK(notifications_shown_.get()); 174 DCHECK(notifications_shown_.get());
175 notifications_shown_->AppendIfNotPresent( 175 notifications_shown_->AppendIfNotPresent(
176 base::Value::CreateStringValue(context_name)); 176 base::Value::CreateStringValue(context_name));
177 if (profile_) { 177 if (profile_) {
178 profile_->GetPrefs()->Set( 178 profile_->GetPrefs()->Set(
179 prefs::kSpeechRecognitionTrayNotificationShownContexts, 179 prefs::kSpeechRecognitionTrayNotificationShownContexts,
180 *notifications_shown_); 180 *notifications_shown_);
181 } 181 }
182 } 182 }
183 183
184 void ChromeSpeechRecognitionPreferences::ReloadPreference( 184 void ChromeSpeechRecognitionPreferences::ReloadPreference(
185 const std::string& key) { 185 const std::string& key) {
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
187 DCHECK(profile_); 187 DCHECK(profile_);
188 base::AutoLock write_lock(preferences_lock_); 188 base::AutoLock write_lock(preferences_lock_);
189 PrefService* pref_service = profile_->GetPrefs(); 189 PrefService* pref_service = profile_->GetPrefs();
190 if (key == prefs::kSpeechRecognitionFilterProfanities) { 190 if (key == prefs::kSpeechRecognitionFilterProfanities) {
191 filter_profanities_ = 191 filter_profanities_ =
192 pref_service->GetBoolean(prefs::kSpeechRecognitionFilterProfanities); 192 pref_service->GetBoolean(prefs::kSpeechRecognitionFilterProfanities);
193 } else if (key == prefs::kSpeechRecognitionTrayNotificationShownContexts) { 193 } else if (key == prefs::kSpeechRecognitionTrayNotificationShownContexts) {
194 const base::ListValue* pref_list = profile_->GetPrefs()->GetList( 194 const base::ListValue* pref_list = profile_->GetPrefs()->GetList(
195 prefs::kSpeechRecognitionTrayNotificationShownContexts); 195 prefs::kSpeechRecognitionTrayNotificationShownContexts);
196 DCHECK(pref_list); 196 DCHECK(pref_list);
197 notifications_shown_.reset(pref_list->DeepCopy()); 197 notifications_shown_.reset(pref_list->DeepCopy());
198 } 198 }
199 } 199 }
OLDNEW
« no previous file with comments | « chrome/browser/speech/chrome_speech_recognition_preferences.h ('k') | chrome/browser/speech/speech_input_extension_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698