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

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

Issue 267653005: Adds HotwordPrivate API for integrating the hotword feature to AppLauncher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 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 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)
rpetterson 2014/05/05 19:43:36 I'm confused by what the "enabled" parameter is re
Jun Mukai 2014/05/05 20:00:55 good catch. changed to use 'started' everywhere
+ 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() {
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/browser/ui/app_list/start_page_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698