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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "chrome/browser/profiles/profile_keyed_service.h" | 15 #include "chrome/browser/profiles/profile_keyed_service.h" |
16 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 16 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
17 #include "content/public/browser/speech_recognition_preferences.h" | 17 #include "content/public/browser/speech_recognition_preferences.h" |
18 | 18 |
19 class PrefRegistrySyncable; | |
20 class PrefService; | 19 class PrefService; |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class ListValue; | 22 class ListValue; |
24 } | 23 } |
25 | 24 |
26 // Utility class that handles persistent storage of speech recognition | 25 // Utility class that handles persistent storage of speech recognition |
27 // preferences. Instances of this class must be obtained exclusively through the | 26 // preferences. Instances of this class must be obtained exclusively through the |
28 // method ChromeSpeechRecognitionPreferences::GetForProfile(...), so that | 27 // method ChromeSpeechRecognitionPreferences::GetForProfile(...), so that |
29 // preferences are handled within the Profile (if not NULL). The internal | 28 // preferences are handled within the Profile (if not NULL). The internal |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 63 |
65 private: | 64 private: |
66 friend struct DefaultSingletonTraits<Factory>; | 65 friend struct DefaultSingletonTraits<Factory>; |
67 | 66 |
68 Factory(); | 67 Factory(); |
69 virtual ~Factory(); | 68 virtual ~Factory(); |
70 | 69 |
71 // ProfileKeyedServiceFactory methods: | 70 // ProfileKeyedServiceFactory methods: |
72 virtual ProfileKeyedService* BuildServiceInstanceFor( | 71 virtual ProfileKeyedService* BuildServiceInstanceFor( |
73 content::BrowserContext* profile) const OVERRIDE; | 72 content::BrowserContext* profile) const OVERRIDE; |
74 virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE; | 73 virtual void RegisterUserPrefs( |
| 74 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; |
75 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 75 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
76 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; | 76 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(Factory); | 78 DISALLOW_COPY_AND_ASSIGN(Factory); |
79 }; | 79 }; |
80 | 80 |
81 // This wrapper handles the binding between ChromeSpeechRecognitionPreferences | 81 // This wrapper handles the binding between ChromeSpeechRecognitionPreferences |
82 // instances (which can have a longer lifetime, since they are refcounted) and | 82 // instances (which can have a longer lifetime, since they are refcounted) and |
83 // ProfileKeyedService (which lifetime depends on the Profile service). Upon | 83 // ProfileKeyedService (which lifetime depends on the Profile service). Upon |
84 // profile shutdown, the ChromeSpeechRecognitionPreferences instance is | 84 // profile shutdown, the ChromeSpeechRecognitionPreferences instance is |
(...skipping 28 matching lines...) Expand all Loading... |
113 scoped_ptr<base::ListValue> notifications_shown_; | 113 scoped_ptr<base::ListValue> notifications_shown_; |
114 | 114 |
115 // Lock used to ensure exclusive access to preference variables that are | 115 // Lock used to ensure exclusive access to preference variables that are |
116 // accessed by both threads (note: mutable is required to keep getters const). | 116 // accessed by both threads (note: mutable is required to keep getters const). |
117 mutable base::Lock preferences_lock_; | 117 mutable base::Lock preferences_lock_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionPreferences); | 119 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionPreferences); |
120 }; | 120 }; |
121 | 121 |
122 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ | 122 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_ |
OLD | NEW |