| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 virtual bool IsHotwordAllowed(); | 69 virtual bool IsHotwordAllowed(); |
| 70 | 70 |
| 71 // Checks if the user has opted into audio logging. Returns true if the user | 71 // Checks if the user has opted into audio logging. Returns true if the user |
| 72 // is opted in, false otherwise.. | 72 // is opted in, false otherwise.. |
| 73 bool IsOptedIntoAudioLogging(); | 73 bool IsOptedIntoAudioLogging(); |
| 74 | 74 |
| 75 // Control the state of the hotword extension. | 75 // Control the state of the hotword extension. |
| 76 void EnableHotwordExtension(ExtensionService* extension_service); | 76 void EnableHotwordExtension(ExtensionService* extension_service); |
| 77 void DisableHotwordExtension(ExtensionService* extension_service); | 77 void DisableHotwordExtension(ExtensionService* extension_service); |
| 78 | 78 |
| 79 // Handles launching the Hotword Audio Verification extension when the user | |
| 80 // turns it on via the settings menu. | |
| 81 void OnHotwordAlwaysOnSearchEnabledChanged(const std::string& pref_name); | |
| 82 | |
| 83 // Handles enabling/disabling the hotword extension when the user | 79 // Handles enabling/disabling the hotword extension when the user |
| 84 // turns it off via the settings menu. | 80 // turns it off via the settings menu. |
| 85 void OnHotwordSearchEnabledChanged(const std::string& pref_name); | 81 void OnHotwordSearchEnabledChanged(const std::string& pref_name); |
| 86 | 82 |
| 87 // Called to handle the hotword session from |client|. | 83 // Called to handle the hotword session from |client|. |
| 88 void RequestHotwordSession(HotwordClient* client); | 84 void RequestHotwordSession(HotwordClient* client); |
| 89 void StopHotwordSession(HotwordClient* client); | 85 void StopHotwordSession(HotwordClient* client); |
| 90 HotwordClient* client() { return client_; } | 86 HotwordClient* client() { return client_; } |
| 91 | 87 |
| 92 // Checks if the current version of the hotword extension should be | 88 // Checks if the current version of the hotword extension should be |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 // These methods are for launching, and getting and setting the launch mode of | 109 // These methods are for launching, and getting and setting the launch mode of |
| 114 // the Hotword Audio Verification App. | 110 // the Hotword Audio Verification App. |
| 115 // | 111 // |
| 116 // TODO(kcarattini): Remove this when | 112 // TODO(kcarattini): Remove this when |
| 117 // https://code.google.com/p/chromium/issues/detail?id=165573 is fixed, | 113 // https://code.google.com/p/chromium/issues/detail?id=165573 is fixed, |
| 118 // at which time we can simply launch the app in the given mode instead of | 114 // at which time we can simply launch the app in the given mode instead of |
| 119 // having to check for it here. | 115 // having to check for it here. |
| 120 enum LaunchMode { | 116 enum LaunchMode { |
| 121 AUDIO_HISTORY_ONLY, | 117 AUDIO_HISTORY_ONLY, |
| 122 HOTWORD_ONLY, | 118 HOTWORD_ONLY, |
| 123 HOTWORD_AND_AUDIO_HISTORY | 119 HOTWORD_AND_AUDIO_HISTORY, |
| 120 SPEECH_TRAINING |
| 124 }; | 121 }; |
| 125 void LaunchHotwordAudioVerificationApp(const LaunchMode& launch_mode); | 122 void LaunchHotwordAudioVerificationApp(const LaunchMode& launch_mode); |
| 126 virtual LaunchMode GetHotwordAudioVerificationLaunchMode(); | 123 virtual LaunchMode GetHotwordAudioVerificationLaunchMode(); |
| 127 | 124 |
| 128 private: | 125 private: |
| 129 Profile* profile_; | 126 Profile* profile_; |
| 130 | 127 |
| 131 PrefChangeRegistrar pref_registrar_; | 128 PrefChangeRegistrar pref_registrar_; |
| 132 | 129 |
| 133 content::NotificationRegistrar registrar_; | 130 content::NotificationRegistrar registrar_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 145 | 142 |
| 146 base::WeakPtrFactory<HotwordService> weak_factory_; | 143 base::WeakPtrFactory<HotwordService> weak_factory_; |
| 147 | 144 |
| 148 // Stores the launch mode for the Hotword Audio Verification App. | 145 // Stores the launch mode for the Hotword Audio Verification App. |
| 149 LaunchMode hotword_audio_verification_launch_mode_; | 146 LaunchMode hotword_audio_verification_launch_mode_; |
| 150 | 147 |
| 151 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 148 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
| 152 }; | 149 }; |
| 153 | 150 |
| 154 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 151 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
| OLD | NEW |