| 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 #ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ |
| 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ | 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/string16.h" | |
| 14 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 15 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 16 #include "chrome/browser/prefs/pref_change_registrar.h" | 15 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 17 #include "chrome/browser/profiles/profile_keyed_service.h" | 16 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 18 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 17 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 19 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/speech_recognition_preferences.h" | 19 #include "content/public/browser/speech_recognition_preferences.h" |
| 21 | 20 |
| 22 class PrefService; | 21 class PrefService; |
| 23 | 22 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 const content::NotificationDetails& details) OVERRIDE; | 47 const content::NotificationDetails& details) OVERRIDE; |
| 49 | 48 |
| 50 | 49 |
| 51 // content::SpeechRecognitionPreferences implementation. | 50 // content::SpeechRecognitionPreferences implementation. |
| 52 // Called by both Content (on IO thread) and Chrome (on UI thread). | 51 // Called by both Content (on IO thread) and Chrome (on UI thread). |
| 53 virtual bool FilterProfanities() const OVERRIDE; | 52 virtual bool FilterProfanities() const OVERRIDE; |
| 54 | 53 |
| 55 // Called only by Chrome (on UI thread). | 54 // Called only by Chrome (on UI thread). |
| 56 void SetFilterProfanities(bool filter_profanities); | 55 void SetFilterProfanities(bool filter_profanities); |
| 57 void ToggleFilterProfanities(); | 56 void ToggleFilterProfanities(); |
| 58 bool ShouldShowSecurityNotification(const string16& context_name) const; | 57 bool ShouldShowSecurityNotification(const std::string& context_name) const; |
| 59 void SetHasShownSecurityNotification(const string16& context_name); | 58 void SetHasShownSecurityNotification(const std::string& context_name); |
| 60 | 59 |
| 61 private: | 60 private: |
| 62 // The two classes below are needed to handle storage of speech recognition | 61 // The two classes below are needed to handle storage of speech recognition |
| 63 // preferences in profile preferences, according to the Chromium Profile | 62 // preferences in profile preferences, according to the Chromium Profile |
| 64 // Architecture document entitled "The New Way: ProfileKeyedServiceFactory". | 63 // Architecture document entitled "The New Way: ProfileKeyedServiceFactory". |
| 65 | 64 |
| 66 // Singleton that manages instantiation of ChromeSpeechRecognitionPreferences | 65 // Singleton that manages instantiation of ChromeSpeechRecognitionPreferences |
| 67 // handling its association with Profiles. | 66 // handling its association with Profiles. |
| 68 class Factory : public ProfileKeyedServiceFactory { | 67 class Factory : public ProfileKeyedServiceFactory { |
| 69 public: | 68 public: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 scoped_ptr<base::ListValue> notifications_shown_; | 121 scoped_ptr<base::ListValue> notifications_shown_; |
| 123 | 122 |
| 124 // Lock used to ensure exclusive access to preference variables that are | 123 // Lock used to ensure exclusive access to preference variables that are |
| 125 // accessed by both threads (note: mutable is required to keep getters const). | 124 // accessed by both threads (note: mutable is required to keep getters const). |
| 126 mutable base::Lock preferences_lock_; | 125 mutable base::Lock preferences_lock_; |
| 127 | 126 |
| 128 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionPreferences); | 127 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionPreferences); |
| 129 }; | 128 }; |
| 130 | 129 |
| 131 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ | 130 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ |
| OLD | NEW |