OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SEARCH_HOTWORD_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
11 | 11 |
12 class HotwordService; | 12 class HotwordService; |
13 class Profile; | 13 class Profile; |
14 | 14 |
15 // Singleton that owns all HotwordServices and associates them with Profiles. | 15 // Singleton that owns all HotwordServices and associates them with Profiles. |
16 class HotwordServiceFactory : public MediaCaptureDevicesDispatcher::Observer, | 16 class HotwordServiceFactory : public MediaCaptureDevicesDispatcher::Observer, |
17 public BrowserContextKeyedServiceFactory { | 17 public BrowserContextKeyedServiceFactory { |
18 public: | 18 public: |
19 // Returns the HotwordService for |context|. | 19 // Returns the HotwordService for |context|. |
20 static HotwordService* GetForProfile(content::BrowserContext* context); | 20 static HotwordService* GetForProfile(content::BrowserContext* context); |
21 | 21 |
22 static HotwordServiceFactory* GetInstance(); | 22 static HotwordServiceFactory* GetInstance(); |
23 | 23 |
24 // Returns true if the hotwording service is available for |context|. | 24 // Returns true if the hotwording service is available for |context|. |
25 static bool IsServiceAvailable(content::BrowserContext* context); | 25 static bool IsServiceAvailable(content::BrowserContext* context); |
26 | 26 |
27 // Returns true if hotwording is allowed for |context|. | 27 // Returns true if hotwording is allowed for |context|. |
28 static bool IsHotwordAllowed(content::BrowserContext* context); | 28 static bool IsHotwordAllowed(content::BrowserContext* context); |
29 | 29 |
30 // Returns whether specialized hotword hardware exists. | 30 // Returns whether always-on hotwording is available. |
31 static bool IsHotwordHardwareAvailable(); | 31 static bool IsAlwaysOnAvailable(); |
32 | 32 |
33 // Returns the current error message for the service for |context|. | 33 // Returns the current error message for the service for |context|. |
34 // A value of 0 indicates no error. | 34 // A value of 0 indicates no error. |
35 static int GetCurrentError(content::BrowserContext* context); | 35 static int GetCurrentError(content::BrowserContext* context); |
36 | 36 |
37 // Returns the current known state of the microphone. Since this state | 37 // Returns the current known state of the microphone. Since this state |
38 // is browser (not profile) specific, it resides in the factory. | 38 // is browser (not profile) specific, it resides in the factory. |
39 static bool IsMicrophoneAvailable(); | 39 static bool IsMicrophoneAvailable(); |
40 | 40 |
41 // Returns whether the state of the audio devices has been updated. | 41 // Returns whether the state of the audio devices has been updated. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // included in the error checking. Audio checking is not done immediately | 79 // included in the error checking. Audio checking is not done immediately |
80 // upon start up because of the negative impact on performance. | 80 // upon start up because of the negative impact on performance. |
81 bool audio_device_state_updated_; | 81 bool audio_device_state_updated_; |
82 | 82 |
83 bool audio_device_state_updated() { return audio_device_state_updated_; } | 83 bool audio_device_state_updated() { return audio_device_state_updated_; } |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory); | 85 DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory); |
86 }; | 86 }; |
87 | 87 |
88 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ | 88 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ |
OLD | NEW |