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); |