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

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: Rebase. 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..3615a6e85f82c10c9f1231c4372bc48696758c1d 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".
+ // Transitioning into the "hotword recognizing" state is handled by the
+ // hotword extension.
+ if (HotwordService::IsExperimentalHotwordingEnabled())
+ state_ = app_list::SPEECH_RECOGNITION_READY;
+
if (app_list::switches::IsExperimentalAppListEnabled())
LoadContents();
}
@@ -121,9 +128,13 @@ void StartPageService::AppListShown() {
if (!contents_) {
LoadContents();
} else {
+ // If experimental hotwording is enabled, don't enable hotwording in the
+ // start page, since the hotword extension is taking care of this.
+ bool hotword_enabled = HotwordEnabled() &&
+ !HotwordService::IsExperimentalHotwordingEnabled();
contents_->GetWebUI()->CallJavascriptFunction(
"appList.startPage.onAppListShown",
- base::FundamentalValue(HotwordEnabled()));
+ base::FundamentalValue(hotword_enabled));
}
}
@@ -141,6 +152,10 @@ void StartPageService::ToggleSpeechRecognition() {
}
bool StartPageService::HotwordEnabled() {
+ if (HotwordService::IsExperimentalHotwordingEnabled()) {
+ return HotwordServiceFactory::IsServiceAvailable(profile_) &&
+ profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled);
+ }
#if defined(OS_CHROMEOS)
return HotwordServiceFactory::IsServiceAvailable(profile_) &&
profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled);
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.cc ('k') | chrome/browser/ui/webui/app_list/start_page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698