Index: chrome/browser/ui/webui/options/browser_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc |
index 330dd20e211805e13677b85f86d296e93fc11e5d..b82b327e4ec94bba55ee0affd345dd0ca7900e72 100644 |
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc |
@@ -746,6 +746,12 @@ void BrowserOptionsHandler::RegisterMessages() { |
base::Unretained(this))); |
web_ui()->RegisterMessageCallback( |
+ "launchHotwordAudioVerificationApp", |
+ base::Bind( |
+ &BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp, |
+ base::Unretained(this))); |
+ |
+ web_ui()->RegisterMessageCallback( |
"launchEasyUnlockSetup", |
base::Bind(&BrowserOptionsHandler::HandleLaunchEasyUnlockSetup, |
base::Unretained(this))); |
@@ -1623,6 +1629,43 @@ void BrowserOptionsHandler::HandleRequestHotwordAvailable( |
} |
} |
+void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp( |
+ const base::ListValue* args) { |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ HotwordService* hotword_service = |
+ HotwordServiceFactory::GetForProfile(profile); |
+ if (!hotword_service) { |
Dan Beam
2014/09/23 05:53:39
when will we hit this case?
kcarattini
2014/09/23 06:46:16
I think the hotword service should exist for all p
rpetterson
2014/09/23 19:02:21
No, not for incognito (and currently guest). Bette
|
+ return; |
+ } |
Dan Beam
2014/09/23 05:53:39
nit: no curlies
kcarattini
2014/09/23 06:46:16
Done.
|
+ |
+ bool retrain = false; |
+ args->GetBoolean(0, &retrain); |
Dan Beam
2014/09/23 05:53:39
unless this is optional,
bool success = args->G
kcarattini
2014/09/23 06:46:16
Done.
|
+ HotwordService::LaunchMode launch_mode = |
+ HotwordService::HOTWORD_AND_AUDIO_HISTORY; |
+ |
+ if (retrain) { |
+ DCHECK(profile->GetPrefs()->GetBoolean( |
+ prefs::kHotwordAlwaysOnSearchEnabled)); |
+ DCHECK(profile->GetPrefs()->GetBoolean( |
+ prefs::kHotwordAudioLoggingEnabled)); |
+ |
+ launch_mode = HotwordService::SPEECH_TRAINING; |
+ } else if (profile->GetPrefs()->GetBoolean( |
+ prefs::kHotwordAudioLoggingEnabled)) { |
+ DCHECK(!profile->GetPrefs()->GetBoolean( |
+ prefs::kHotwordAlwaysOnSearchEnabled)); |
+ |
+ // TODO(kcarattini): Make sure the Chrome Audio Logging pref is synced |
+ // to the account-level Audio History setting from footprints. |
+ launch_mode = HotwordService::HOTWORD_ONLY; |
+ } else { |
+ DCHECK(!profile->GetPrefs()->GetBoolean( |
+ prefs::kHotwordAlwaysOnSearchEnabled)); |
+ } |
+ |
+ hotword_service->LaunchHotwordAudioVerificationApp(launch_mode); |
+} |
+ |
void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( |
const base::ListValue* args) { |
EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); |