Chromium Code Reviews| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 // Sets the pref value of the previous language. | 130 // Sets the pref value of the previous language. |
| 131 void SetPreviousLanguagePref(); | 131 void SetPreviousLanguagePref(); |
| 132 | 132 |
| 133 // Returns the current error message id. A value of 0 indicates | 133 // Returns the current error message id. A value of 0 indicates |
| 134 // no error. | 134 // no error. |
| 135 int error_message() { return error_message_; } | 135 int error_message() { return error_message_; } |
| 136 | 136 |
| 137 // These methods are for launching, and getting and setting the launch mode of | 137 // These methods are for launching, and getting and setting the launch mode of |
| 138 // the Hotword Audio Verification App. | 138 // the Hotword Audio Verification App. |
| 139 // | 139 // |
| 140 // TODO(kcarattini): Remove this when | 140 // OptIntoHotwording first determines if the app needs to be launched, and if |
| 141 // https://code.google.com/p/chromium/issues/detail?id=165573 is fixed, | 141 // so, launches the app (if Audio History is on and a speaker model exists, |
| 142 // at which time we can simply launch the app in the given mode instead of | 142 // then we don't need to launch the app). |
| 143 // having to check for it here. | 143 // |
| 144 // LaunchHotwordAudioVerificationApp launches the app without the above | |
| 145 // check in the specified |launch_mode|. | |
| 144 enum LaunchMode { | 146 enum LaunchMode { |
| 145 HOTWORD_ONLY, | 147 HOTWORD_ONLY, |
| 146 HOTWORD_AND_AUDIO_HISTORY, | 148 HOTWORD_AND_AUDIO_HISTORY, |
| 147 RETRAIN | 149 RETRAIN |
| 148 }; | 150 }; |
| 151 void OptIntoHotwording(const LaunchMode& launch_mode); | |
|
Anand Mistry (off Chromium)
2015/03/23 03:12:24
Why is LaunchMode passed as a reference when it's
James Hawkins
2015/03/23 14:53:40
It's safe in that we don't make the assumption tha
Anand Mistry (off Chromium)
2015/03/23 23:31:51
C++ defines the underlying type of an enum to be i
| |
| 149 void LaunchHotwordAudioVerificationApp(const LaunchMode& launch_mode); | 152 void LaunchHotwordAudioVerificationApp(const LaunchMode& launch_mode); |
| 150 virtual LaunchMode GetHotwordAudioVerificationLaunchMode(); | 153 virtual LaunchMode GetHotwordAudioVerificationLaunchMode(); |
| 151 | 154 |
| 155 // Called when the SpeakerModelExists request is complete. Either | |
| 156 // sets the always-on hotword pref to true, or launches the Hotword | |
| 157 // Audio Verification App, depending on the value of |exists|. | |
| 158 void SpeakerModelExistsComplete(bool exists); | |
| 159 | |
| 152 // These methods control the speaker training communication between | 160 // These methods control the speaker training communication between |
| 153 // the Hotword Audio Verification App and the Hotword Extension that | 161 // the Hotword Audio Verification App and the Hotword Extension that |
| 154 // contains the NaCl module. | 162 // contains the NaCl module. |
| 155 void StartTraining(); | 163 void StartTraining(); |
| 156 void FinalizeSpeakerModel(); | 164 void FinalizeSpeakerModel(); |
| 157 void StopTraining(); | 165 void StopTraining(); |
| 158 void NotifyHotwordTriggered(); | 166 void NotifyHotwordTriggered(); |
| 159 | 167 |
| 160 // Returns true if speaker training is currently in progress. | 168 // Returns true if speaker training is currently in progress. |
| 161 bool IsTraining(); | 169 bool IsTraining(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 228 |
| 221 // The WeakPtrFactory should be the last member, so the weak pointer | 229 // The WeakPtrFactory should be the last member, so the weak pointer |
| 222 // gets invalidated before the destructors for other members run, | 230 // gets invalidated before the destructors for other members run, |
| 223 // to avoid callbacks into a half-destroyed object. | 231 // to avoid callbacks into a half-destroyed object. |
| 224 base::WeakPtrFactory<HotwordService> weak_factory_; | 232 base::WeakPtrFactory<HotwordService> weak_factory_; |
| 225 | 233 |
| 226 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 234 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
| 227 }; | 235 }; |
| 228 | 236 |
| 229 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 237 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
| OLD | NEW |