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_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } // namespace extensions | 25 } // namespace extensions |
26 | 26 |
27 namespace hotword_internal { | 27 namespace hotword_internal { |
28 // Constants for the hotword field trial. | 28 // Constants for the hotword field trial. |
29 extern const char kHotwordFieldTrialName[]; | 29 extern const char kHotwordFieldTrialName[]; |
30 extern const char kHotwordFieldTrialDisabledGroupName[]; | 30 extern const char kHotwordFieldTrialDisabledGroupName[]; |
31 } // namespace hotword_internal | 31 } // namespace hotword_internal |
32 | 32 |
33 // Provides an interface for the Hotword component that does voice triggered | 33 // Provides an interface for the Hotword component that does voice triggered |
34 // search. | 34 // search. |
35 class HotwordService : public content::NotificationObserver, | 35 class HotwordService : public extensions::ExtensionRegistryObserver, |
36 public extensions::ExtensionRegistryObserver, | |
37 public KeyedService { | 36 public KeyedService { |
38 public: | 37 public: |
39 // Returns true if the hotword supports the current system language. | 38 // Returns true if the hotword supports the current system language. |
40 static bool DoesHotwordSupportLanguage(Profile* profile); | 39 static bool DoesHotwordSupportLanguage(Profile* profile); |
41 | 40 |
42 // Returns true if the "enable-experimental-hotwording" flag is set. | 41 // Returns true if the "enable-experimental-hotwording" flag is set. |
43 static bool IsExperimentalHotwordingEnabled(); | 42 static bool IsExperimentalHotwordingEnabled(); |
44 | 43 |
45 explicit HotwordService(Profile* profile); | 44 explicit HotwordService(Profile* profile); |
46 ~HotwordService() override; | 45 ~HotwordService() override; |
47 | 46 |
48 // Overridden from content::NotificationObserver: | |
49 void Observe(int type, | |
50 const content::NotificationSource& source, | |
51 const content::NotificationDetails& details) override; | |
52 | |
53 // Overridden from ExtensionRegisterObserver: | 47 // Overridden from ExtensionRegisterObserver: |
54 void OnExtensionInstalled(content::BrowserContext* browser_context, | 48 void OnExtensionInstalled(content::BrowserContext* browser_context, |
55 const extensions::Extension* extension, | 49 const extensions::Extension* extension, |
56 bool is_update) override; | 50 bool is_update) override; |
57 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 51 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
58 const extensions::Extension* extension, | 52 const extensions::Extension* extension, |
59 extensions::UninstallReason reason) override; | 53 extensions::UninstallReason reason) override; |
60 | 54 |
61 // Checks for whether all the necessary files have downloaded to allow for | 55 // Checks for whether all the necessary files have downloaded to allow for |
62 // using the extension. | 56 // using the extension. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 140 |
147 base::WeakPtrFactory<HotwordService> weak_factory_; | 141 base::WeakPtrFactory<HotwordService> weak_factory_; |
148 | 142 |
149 // Stores the launch mode for the Hotword Audio Verification App. | 143 // Stores the launch mode for the Hotword Audio Verification App. |
150 LaunchMode hotword_audio_verification_launch_mode_; | 144 LaunchMode hotword_audio_verification_launch_mode_; |
151 | 145 |
152 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 146 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
153 }; | 147 }; |
154 | 148 |
155 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 149 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
OLD | NEW |