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

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

Issue 471853002: Use the new hotword extension in the launcher when it is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/start_page_service.cc
diff --git a/chrome/browser/ui/app_list/start_page_service.cc b/chrome/browser/ui/app_list/start_page_service.cc
index e57480972d17030b473ff3ffe08f4a287b51b010..f7b3b36dd5a7227bd36d21a888a5c7e950189c72 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/media/media_stream_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search/hotword_service.h"
#include "chrome/browser/search/hotword_service_factory.h"
#include "chrome/browser/ui/app_list/recommended_apps.h"
#include "chrome/browser/ui/app_list/start_page_observer.h"
@@ -103,6 +104,12 @@ StartPageService::StartPageService(Profile* profile)
state_(app_list::SPEECH_RECOGNITION_OFF),
speech_button_toggled_manually_(false),
speech_result_obtained_(false) {
+ // If experimental hotwording is enabled, then we're always "ready".
+ // Trasitioning into the "hotword recognizing" state is handled by the hotword
arv (Not doing code reviews) 2014/08/14 15:48:06 typo
Anand Mistry (off Chromium) 2014/08/15 00:14:51 Done.
+ // extension.
+ if (HotwordService::IsExperimentalHotwordingEnabled())
+ state_ = app_list::SPEECH_RECOGNITION_READY;
+
if (app_list::switches::IsExperimentalAppListEnabled())
LoadContents();
}
@@ -121,9 +128,15 @@ void StartPageService::AppListShown() {
if (!contents_) {
LoadContents();
} else {
+ bool hotwordEnabled = HotwordEnabled();
Jun Mukai 2014/08/14 22:10:08 variable names are in style of hotword_enabled Al
Anand Mistry (off Chromium) 2014/08/15 00:14:51 Done.
+ // If experimental hotwording is enabled, don't enable hotwording in the
+ // start page, since the hotword extension is taking care of this.
+ if (HotwordService::IsExperimentalHotwordingEnabled())
+ hotwordEnabled = false;
Jun Mukai 2014/08/14 22:10:08 You can simply hotword_enabled = HotwordEnabled()
Anand Mistry (off Chromium) 2014/08/15 00:14:51 Done.
+
contents_->GetWebUI()->CallJavascriptFunction(
"appList.startPage.onAppListShown",
- base::FundamentalValue(HotwordEnabled()));
+ base::FundamentalValue(hotwordEnabled));
}
}
@@ -141,6 +154,9 @@ void StartPageService::ToggleSpeechRecognition() {
}
bool StartPageService::HotwordEnabled() {
+ if (HotwordService::IsExperimentalHotwordingEnabled())
arv (Not doing code reviews) 2014/08/14 15:48:06 needs {}
Anand Mistry (off Chromium) 2014/08/15 00:14:51 Done.
+ return HotwordServiceFactory::IsServiceAvailable(profile_) &&
+ profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled);
#if defined(OS_CHROMEOS)
return HotwordServiceFactory::IsServiceAvailable(profile_) &&
profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled);

Powered by Google App Engine
This is Rietveld 408576698