Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4879)

Unified Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 559303002: Hotword Audio Verification app: control the hotword settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@launch-state
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 3d1048fe79d525b096b0d08b9025d17d06ccfc4f..ee5519ad07b9c94aa138c10fa90100fda283ffc5 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -751,6 +751,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)));
@@ -1640,6 +1646,44 @@ void BrowserOptionsHandler::HandleRequestHotwordAvailable(
}
}
+void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
+ const base::ListValue* args) {
+ Profile* profile = Profile::FromWebUI(web_ui());
+
+ bool retrain = false;
+ bool success = args->GetBoolean(0, &retrain);
+ DCHECK(success);
+ 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));
+ }
+
+ HotwordService* hotword_service =
+ HotwordServiceFactory::GetForProfile(profile);
+ if (!hotword_service)
+ return;
+
+ hotword_service->LaunchHotwordAudioVerificationApp(launch_mode);
+}
+
void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup(
const base::ListValue* args) {
EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup();
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | chrome/common/extensions/api/hotword_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698