Chromium Code Reviews| 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..489a64bbcb5f7bf44b2932f5ca331e9e0be963c4 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,17 @@ AppListViewDelegate::AppListViewDelegate(Profile* profile, |
| app_list::StartPageService::Get(profile_); |
| if (service) |
| service->AddObserver(this); |
| + |
| + |
|
xiyuan
2014/01/30 00:27:45
nit: nuke one empty line
Jun Mukai
2014/01/30 00:33:24
Done.
|
| + // 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 : |
|
xiyuan
2014/01/30 00:27:45
nit: 2 more space indent here and the value on lin
Jun Mukai
2014/01/30 00:33:24
Done.
|
| +#endif |
| + app_list::SPEECH_RECOGNITION_OFF)); |
| } |
| AppListViewDelegate::~AppListViewDelegate() { |
| @@ -177,7 +189,7 @@ app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { |
| } |
| app_list::SpeechUIModel* AppListViewDelegate::GetSpeechUI() { |
| - return &speech_ui_; |
| + return speech_ui_.get(); |
| } |
| void AppListViewDelegate::GetShortcutPathForApp( |
| @@ -310,7 +322,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 +331,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( |