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

Unified Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 631913004: Open the launcher when hotword is triggered in always-on mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hotword-google-com-ntp
Patch Set: Created 6 years, 2 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/app_list/app_list_view_delegate.cc
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index c8753f2e22db86b20683bcfc8ee6982fcfdcd210..65d24e5e2c463fac3209f6558cab2a878e0f7e4f 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -465,8 +465,18 @@ void AppListViewDelegate::ViewClosing() {
if (service->HotwordEnabled()) {
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(profile_);
- if (hotword_service)
+ if (hotword_service) {
hotword_service->StopHotwordSession(this);
+
+ // If we're in always-on mode, we always want to re-start hotwording
Matt Giuca 2014/10/09 18:07:11 nit: "restart" does not need a hyphen.
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Done.
+ // after closing the launcher window. Use an empty client so that the
+ // launcher is opened. The previous call to StopHotwordSession is still
Matt Giuca 2014/10/09 18:07:11 I'm a bit unclear on what this comment means. Are
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Yes.
+ // needed to clear the client since you can't have two sessions running.
+ // TODO(amistry): This only works on ChromeOS since Chrome hides the
Matt Giuca 2014/10/09 18:07:11 What happens on non-ChromeOS platforms in this cas
Anand Mistry (off Chromium) 2014/10/13 21:51:59 For now, we're not targeting non-ChromeOS platform
tapted 2014/10/13 22:48:08 sorry - missed this Q. Answer: maybe :). The view
+ // launcher instead of destroying it. Make this work on Chrome.
+ if (hotword_service->IsAlwaysOnEnabled())
+ hotword_service->RequestHotwordSession(NULL);
+ }
}
}
}
@@ -512,6 +522,23 @@ void AppListViewDelegate::ToggleSpeechRecognition() {
app_list::StartPageService::Get(profile_);
if (service)
service->ToggleSpeechRecognition();
+
+ // With the new hotword extension, stop the hotword session. With the launcher
+ // and NTP, this is unnecessary since the hotwording is implicitly stopped.
+ // However, for always on, hotword triggering launches the launcher which
+ // starts a session and hence starts the detector. This results in the
+ // detector running in parallel with the speech recognition. To get around
Matt Giuca 2014/10/09 18:07:11 It's not clear what the difference is between "the
Anand Mistry (off Chromium) 2014/10/13 21:51:59 They're two different things. By "detector", I mea
+ // this, always stop the session when switching to speech recognition. An
+ // alternative is to launch the launcher with a "do not start hotword session"
Matt Giuca 2014/10/09 18:07:11 Don't need to write alternatives in a comment (unl
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Done.
+ // flag, but that seems messy compared to this.
+ if (HotwordService::IsExperimentalHotwordingEnabled() &&
+ service && service->HotwordEnabled()) {
+ HotwordService* hotword_service =
+ HotwordServiceFactory::GetForProfile(profile_);
+ if (hotword_service) {
Matt Giuca 2014/10/09 18:07:11 nit: No curlies.
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Done.
+ hotword_service->StopHotwordSession(this);
+ }
+ }
}
void AppListViewDelegate::ShowForProfileByPath(
@@ -540,10 +567,13 @@ void AppListViewDelegate::OnSpeechRecognitionStateChanged(
app_list::StartPageService* service =
app_list::StartPageService::Get(profile_);
// With the new hotword extension, we need to re-request hotwording after
- // speech recognition has stopped.
+ // speech recognition has stopped. IsAppListVisible() is called because this
Matt Giuca 2014/10/09 18:07:11 Just say "Do not request hotwording after the app
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Done.
+ // notification can happen after the app list is closed. In that case, we
+ // don't want to re-request hotwording.
if (new_state == app_list::SPEECH_RECOGNITION_READY &&
HotwordService::IsExperimentalHotwordingEnabled() &&
- service && service->HotwordEnabled()) {
+ service && service->HotwordEnabled() &&
+ AppListService::Get(chrome::GetActiveDesktop())->IsAppListVisible()) {
tapted 2014/10/09 03:37:00 There is an AppListViewDelegate for each desktop t
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Done.
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(profile_);
if (hotword_service) {

Powered by Google App Engine
This is Rietveld 408576698