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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 false, | 53 false, |
54 callback) {} | 54 callback) {} |
55 void Shutdown(); | 55 void Shutdown(); |
56 protected: | 56 protected: |
57 ~HotwordWebstoreInstaller() override {} | 57 ~HotwordWebstoreInstaller() override {} |
58 }; | 58 }; |
59 | 59 |
60 // Returns true if the hotword supports the current system language. | 60 // Returns true if the hotword supports the current system language. |
61 static bool DoesHotwordSupportLanguage(Profile* profile); | 61 static bool DoesHotwordSupportLanguage(Profile* profile); |
62 | 62 |
63 // Always returns true. | |
64 // TODO(amistry): Remove this. | |
65 static bool IsExperimentalHotwordingEnabled(); | |
66 | |
67 explicit HotwordService(Profile* profile); | 63 explicit HotwordService(Profile* profile); |
68 ~HotwordService() override; | 64 ~HotwordService() override; |
69 | 65 |
70 // Overridden from ExtensionRegisterObserver: | 66 // Overridden from ExtensionRegisterObserver: |
71 void OnExtensionInstalled(content::BrowserContext* browser_context, | 67 void OnExtensionInstalled(content::BrowserContext* browser_context, |
72 const extensions::Extension* extension, | 68 const extensions::Extension* extension, |
73 bool is_update) override; | 69 bool is_update) override; |
74 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 70 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
75 const extensions::Extension* extension, | 71 const extensions::Extension* extension, |
76 extensions::UninstallReason reason) override; | 72 extensions::UninstallReason reason) override; |
(...skipping 12 matching lines...) Expand all Loading... |
89 // Checks if the user has opted into audio logging. Returns true if the user | 85 // Checks if the user has opted into audio logging. Returns true if the user |
90 // is opted in, false otherwise.. | 86 // is opted in, false otherwise.. |
91 bool IsOptedIntoAudioLogging(); | 87 bool IsOptedIntoAudioLogging(); |
92 | 88 |
93 // Returns whether always-on hotwording is enabled. | 89 // Returns whether always-on hotwording is enabled. |
94 bool IsAlwaysOnEnabled(); | 90 bool IsAlwaysOnEnabled(); |
95 | 91 |
96 // Returns whether google.com/NTP/launcher hotwording is enabled. | 92 // Returns whether google.com/NTP/launcher hotwording is enabled. |
97 bool IsSometimesOnEnabled(); | 93 bool IsSometimesOnEnabled(); |
98 | 94 |
99 // Control the state of the hotword extension. | |
100 void EnableHotwordExtension(ExtensionService* extension_service); | |
101 void DisableHotwordExtension(ExtensionService* extension_service); | |
102 | |
103 // Handles enabling/disabling the hotword extension when the user | |
104 // turns it off via the settings menu. | |
105 void OnHotwordSearchEnabledChanged(const std::string& pref_name); | |
106 | |
107 // Handles enabling/disabling the hotword notification when the user | 95 // Handles enabling/disabling the hotword notification when the user |
108 // changes the always on search settings. | 96 // changes the always on search settings. |
109 void OnHotwordAlwaysOnSearchEnabledChanged(const std::string& pref_name); | 97 void OnHotwordAlwaysOnSearchEnabledChanged(const std::string& pref_name); |
110 | 98 |
111 // Called to handle the hotword session from |client|. | 99 // Called to handle the hotword session from |client|. |
112 void RequestHotwordSession(HotwordClient* client); | 100 void RequestHotwordSession(HotwordClient* client); |
113 void StopHotwordSession(HotwordClient* client); | 101 void StopHotwordSession(HotwordClient* client); |
114 HotwordClient* client() { return client_; } | 102 HotwordClient* client() { return client_; } |
115 | 103 |
116 // Checks if the current version of the hotword extension should be | 104 // Checks if the current version of the hotword extension should be |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 208 |
221 // The WeakPtrFactory should be the last member, so the weak pointer | 209 // The WeakPtrFactory should be the last member, so the weak pointer |
222 // gets invalidated before the destructors for other members run, | 210 // gets invalidated before the destructors for other members run, |
223 // to avoid callbacks into a half-destroyed object. | 211 // to avoid callbacks into a half-destroyed object. |
224 base::WeakPtrFactory<HotwordService> weak_factory_; | 212 base::WeakPtrFactory<HotwordService> weak_factory_; |
225 | 213 |
226 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 214 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
227 }; | 215 }; |
228 | 216 |
229 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 217 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
OLD | NEW |