| 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 e9c2a506db15c089ce73fac5ff2b413ec42bd218..ba85a0c13689753b373cd546ce3949455ba51cfe 100644
|
| --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| @@ -16,6 +16,8 @@
|
| #include "chrome/browser/feedback/feedback_util.h"
|
| #include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/browser/search/hotword_service.h"
|
| +#include "chrome/browser/search/hotword_service_factory.h"
|
| #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
|
| #include "chrome/browser/ui/app_list/app_list_service.h"
|
| #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
|
| @@ -143,6 +145,24 @@ AppListViewDelegate::~AppListViewDelegate() {
|
| search_controller_.reset();
|
| }
|
|
|
| +void AppListViewDelegate::OnHotwordStateChanged(bool enabled) {
|
| + if (enabled) {
|
| + if (speech_ui_->state() == app_list::SPEECH_RECOGNITION_READY) {
|
| + OnSpeechRecognitionStateChanged(
|
| + app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING);
|
| + }
|
| + } else {
|
| + if (speech_ui_->state() == app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING)
|
| + OnSpeechRecognitionStateChanged(app_list::SPEECH_RECOGNITION_READY);
|
| + }
|
| +}
|
| +
|
| +void AppListViewDelegate::OnHotwordRecognized() {
|
| + DCHECK_EQ(app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING,
|
| + speech_ui_->state());
|
| + ToggleSpeechRecognition();
|
| +}
|
| +
|
| void AppListViewDelegate::SigninManagerCreated(SigninManagerBase* manager) {
|
| scoped_observer_.Add(manager);
|
| }
|
| @@ -290,8 +310,15 @@ void AppListViewDelegate::AutoLaunchCanceled() {
|
| void AppListViewDelegate::ViewInitialized() {
|
| app_list::StartPageService* service =
|
| app_list::StartPageService::Get(profile_);
|
| - if (service)
|
| + if (service) {
|
| service->AppListShown();
|
| + if (service->HotwordEnabled()) {
|
| + HotwordService* hotword_service =
|
| + HotwordServiceFactory::GetForProfile(profile_);
|
| + if (hotword_service)
|
| + hotword_service->RequestHotwordSession(this);
|
| + }
|
| + }
|
| }
|
|
|
| void AppListViewDelegate::Dismiss() {
|
| @@ -303,8 +330,15 @@ void AppListViewDelegate::ViewClosing() {
|
|
|
| app_list::StartPageService* service =
|
| app_list::StartPageService::Get(profile_);
|
| - if (service)
|
| + if (service) {
|
| service->AppListHidden();
|
| + if (service->HotwordEnabled()) {
|
| + HotwordService* hotword_service =
|
| + HotwordServiceFactory::GetForProfile(profile_);
|
| + if (hotword_service)
|
| + hotword_service->StopHotwordSession(this);
|
| + }
|
| + }
|
| }
|
|
|
| gfx::ImageSkia AppListViewDelegate::GetWindowIcon() {
|
|
|