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

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

Issue 149753002: Enables the 'hotword not listening' icon in the search box. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix breaks Created 6 years, 11 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 bcb32be0386da6951e645d0ce99b9582e63b4b00..85922b3e2ea2b34012db81f8e7f046a0bbe8f4ad 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -34,6 +34,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/user_metrics.h"
+#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/app_list_view_delegate_observer.h"
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/speech_ui_model.h"
@@ -97,6 +98,16 @@ AppListViewDelegate::AppListViewDelegate(Profile* profile,
app_list::StartPageService::Get(profile_);
if (service)
service->AddObserver(this);
+
+ // Hotword listening is on by default in ChromeOS right now. Here shouldn't
+ // use the current state in the webui because it will be changed to 'hotword
+ // listening' state from 'ready' after the view is initialized.
+ speech_ui_.reset(new app_list::SpeechUIModel(
+#if defined(OS_CHROMEOS)
+ app_list::switches::IsVoiceSearchEnabled() ?
+ app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING :
+#endif
+ app_list::SPEECH_RECOGNITION_OFF));
}
AppListViewDelegate::~AppListViewDelegate() {
@@ -177,7 +188,7 @@ app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() {
}
app_list::SpeechUIModel* AppListViewDelegate::GetSpeechUI() {
- return &speech_ui_;
+ return speech_ui_.get();
}
void AppListViewDelegate::GetShortcutPathForApp(
@@ -310,7 +321,7 @@ void AppListViewDelegate::ShowForProfileByPath(
void AppListViewDelegate::OnSpeechResult(const base::string16& result,
bool is_final) {
- speech_ui_.SetSpeechResult(result, is_final);
+ speech_ui_->SetSpeechResult(result, is_final);
if (is_final) {
auto_launch_timeout_ = base::TimeDelta::FromSeconds(
kAutoLaunchDefaultTimeoutSec);
@@ -319,12 +330,12 @@ void AppListViewDelegate::OnSpeechResult(const base::string16& result,
}
void AppListViewDelegate::OnSpeechSoundLevelChanged(int16 level) {
- speech_ui_.UpdateSoundLevel(level);
+ speech_ui_->UpdateSoundLevel(level);
}
void AppListViewDelegate::OnSpeechRecognitionStateChanged(
app_list::SpeechRecognitionState new_state) {
- speech_ui_.SetSpeechRecognitionState(new_state);
+ speech_ui_->SetSpeechRecognitionState(new_state);
}
void AppListViewDelegate::Observe(
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/browser/ui/app_list/search/search_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698