| 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 // Returns true if hotwording hardware is available. | 63 // Returns true if hotwording hardware is available. |
| 68 static bool IsHotwordHardwareAvailable(); | 64 static bool IsHotwordHardwareAvailable(); |
| 69 | 65 |
| 70 explicit HotwordService(Profile* profile); | 66 explicit HotwordService(Profile* profile); |
| 71 ~HotwordService() override; | 67 ~HotwordService() override; |
| 72 | 68 |
| 73 // Overridden from ExtensionRegisterObserver: | 69 // Overridden from ExtensionRegisterObserver: |
| 74 void OnExtensionInstalled(content::BrowserContext* browser_context, | 70 void OnExtensionInstalled(content::BrowserContext* browser_context, |
| 75 const extensions::Extension* extension, | 71 const extensions::Extension* extension, |
| 76 bool is_update) override; | 72 bool is_update) override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 // Checks if the user has opted into audio logging. Returns true if the user | 88 // Checks if the user has opted into audio logging. Returns true if the user |
| 93 // is opted in, false otherwise.. | 89 // is opted in, false otherwise.. |
| 94 bool IsOptedIntoAudioLogging(); | 90 bool IsOptedIntoAudioLogging(); |
| 95 | 91 |
| 96 // Returns whether always-on hotwording is enabled. | 92 // Returns whether always-on hotwording is enabled. |
| 97 bool IsAlwaysOnEnabled(); | 93 bool IsAlwaysOnEnabled(); |
| 98 | 94 |
| 99 // Returns whether google.com/NTP/launcher hotwording is enabled. | 95 // Returns whether google.com/NTP/launcher hotwording is enabled. |
| 100 bool IsSometimesOnEnabled(); | 96 bool IsSometimesOnEnabled(); |
| 101 | 97 |
| 102 // Control the state of the hotword extension. | |
| 103 void EnableHotwordExtension(ExtensionService* extension_service); | |
| 104 void DisableHotwordExtension(ExtensionService* extension_service); | |
| 105 | |
| 106 // Handles enabling/disabling the hotword extension when the user | |
| 107 // turns it off via the settings menu. | |
| 108 void OnHotwordSearchEnabledChanged(const std::string& pref_name); | |
| 109 | |
| 110 // Handles enabling/disabling the hotword notification when the user | 98 // Handles enabling/disabling the hotword notification when the user |
| 111 // changes the always on search settings. | 99 // changes the always on search settings. |
| 112 void OnHotwordAlwaysOnSearchEnabledChanged(const std::string& pref_name); | 100 void OnHotwordAlwaysOnSearchEnabledChanged(const std::string& pref_name); |
| 113 | 101 |
| 114 // Called to handle the hotword session from |client|. | 102 // Called to handle the hotword session from |client|. |
| 115 void RequestHotwordSession(HotwordClient* client); | 103 void RequestHotwordSession(HotwordClient* client); |
| 116 void StopHotwordSession(HotwordClient* client); | 104 void StopHotwordSession(HotwordClient* client); |
| 117 HotwordClient* client() { return client_; } | 105 HotwordClient* client() { return client_; } |
| 118 | 106 |
| 119 // Checks if the current version of the hotword extension should be | 107 // Checks if the current version of the hotword extension should be |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 219 |
| 232 // The WeakPtrFactory should be the last member, so the weak pointer | 220 // The WeakPtrFactory should be the last member, so the weak pointer |
| 233 // gets invalidated before the destructors for other members run, | 221 // gets invalidated before the destructors for other members run, |
| 234 // to avoid callbacks into a half-destroyed object. | 222 // to avoid callbacks into a half-destroyed object. |
| 235 base::WeakPtrFactory<HotwordService> weak_factory_; | 223 base::WeakPtrFactory<HotwordService> weak_factory_; |
| 236 | 224 |
| 237 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 225 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
| 238 }; | 226 }; |
| 239 | 227 |
| 240 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 228 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
| OLD | NEW |