| 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/prefs/pref_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 virtual bool IsServiceAvailable(); | 52 virtual bool IsServiceAvailable(); |
| 53 | 53 |
| 54 // Determine if hotwording is allowed in this profile based on field trials | 54 // Determine if hotwording is allowed in this profile based on field trials |
| 55 // and language. | 55 // and language. |
| 56 virtual bool IsHotwordAllowed(); | 56 virtual bool IsHotwordAllowed(); |
| 57 | 57 |
| 58 // Checks if the user has opted into audio logging. Returns true if the user | 58 // Checks if the user has opted into audio logging. Returns true if the user |
| 59 // is opted in, false otherwise.. | 59 // is opted in, false otherwise.. |
| 60 bool IsOptedIntoAudioLogging(); | 60 bool IsOptedIntoAudioLogging(); |
| 61 | 61 |
| 62 // Used in the case of an error with the current hotword extension. Tries | |
| 63 // to reload the extension or in the case of failure, tries to re-download it. | |
| 64 // Returns true upon successful attempt at reload or if the extension has | |
| 65 // already loaded successfully by some other means. | |
| 66 virtual bool RetryHotwordExtension(); | |
| 67 | |
| 68 // Control the state of the hotword extension. | 62 // Control the state of the hotword extension. |
| 69 void EnableHotwordExtension(ExtensionService* extension_service); | 63 void EnableHotwordExtension(ExtensionService* extension_service); |
| 70 void DisableHotwordExtension(ExtensionService* extension_service); | 64 void DisableHotwordExtension(ExtensionService* extension_service); |
| 71 | 65 |
| 72 // Handles enabling/disabling the hotword extension when the user | 66 // Handles enabling/disabling the hotword extension when the user |
| 73 // turns it off via the settings menu. | 67 // turns it off via the settings menu. |
| 74 void OnHotwordSearchEnabledChanged(const std::string& pref_name); | 68 void OnHotwordSearchEnabledChanged(const std::string& pref_name); |
| 75 | 69 |
| 76 // Called to handle the hotword session from |client|. | 70 // Called to handle the hotword session from |client|. |
| 77 void RequestHotwordSession(HotwordClient* client); | 71 void RequestHotwordSession(HotwordClient* client); |
| 78 void StopHotwordSession(HotwordClient* client); | 72 void StopHotwordSession(HotwordClient* client); |
| 79 HotwordClient* client() { return client_; } | 73 HotwordClient* client() { return client_; } |
| 80 | 74 |
| 75 // Returns the current error message id. A value of 0 indicates |
| 76 // no error. |
| 77 int error_message() { return error_message_; } |
| 78 |
| 81 private: | 79 private: |
| 82 Profile* profile_; | 80 Profile* profile_; |
| 83 | 81 |
| 84 PrefChangeRegistrar pref_registrar_; | 82 PrefChangeRegistrar pref_registrar_; |
| 85 | 83 |
| 86 content::NotificationRegistrar registrar_; | 84 content::NotificationRegistrar registrar_; |
| 87 | 85 |
| 88 HotwordClient* client_; | 86 HotwordClient* client_; |
| 87 int error_message_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 89 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 92 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
| OLD | NEW |