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

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: 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 4d47b81667d87da645834484e703b5f32641bde6..e105f6097894c65e990e9df257be1dda782520d0 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)));
@@ -1605,6 +1611,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) {
+ return;
+ }
+
+ bool retrain = false;
+ args->GetBoolean(0, &retrain);
+
+ if (retrain) {
+ DCHECK(profile->GetPrefs()->GetBoolean(
rpetterson 2014/09/11 20:14:17 I would do all these DCHECKs in the similar if sta
kcarattini 2014/09/12 01:02:08 Done.
+ prefs::kHotwordAlwaysOnSearchEnabled));
+ DCHECK(profile->GetPrefs()->GetBoolean(
+ prefs::kHotwordAudioLoggingEnabled));
+ } else {
+ DCHECK(!profile->GetPrefs()->GetBoolean(
+ prefs::kHotwordAlwaysOnSearchEnabled));
+ }
+
+ if (retrain) {
rpetterson 2014/09/11 20:14:17 Would the following be clearer? LaunchMode launch
kcarattini 2014/09/12 01:02:08 Done.
+ hotword_service->LaunchHotwordAudioVerificationApp(
+ HotwordService::SPEECH_TRAINING);
+ } else if (profile->GetPrefs()->GetBoolean(
+ prefs::kHotwordAudioLoggingEnabled)) {
+ // TODO(kcarattini): Make sure the Chrome Audio Logging pref is synced
+ // to the account-level Audio History setting from footprints.
+ hotword_service->LaunchHotwordAudioVerificationApp(
+ HotwordService::HOTWORD_ONLY);
+ } else {
+ hotword_service->LaunchHotwordAudioVerificationApp(
+ HotwordService::HOTWORD_AND_AUDIO_HISTORY);
+ }
+}
+
void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup(
const base::ListValue* args) {
EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup();

Powered by Google App Engine
This is Rietveld 408576698