| Index: ui/app_list/views/search_box_view.cc
|
| diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
|
| index f7a84f43654ac7b1b77e928148883a0f7efee783..aee2c2f0edd9f5a732f50e65b66fdb3efe32f8cb 100644
|
| --- a/ui/app_list/views/search_box_view.cc
|
| +++ b/ui/app_list/views/search_box_view.cc
|
| @@ -10,6 +10,7 @@
|
| #include "ui/app_list/app_list_model.h"
|
| #include "ui/app_list/app_list_view_delegate.h"
|
| #include "ui/app_list/search_box_model.h"
|
| +#include "ui/app_list/speech_ui_model.h"
|
| #include "ui/app_list/views/app_list_menu_views.h"
|
| #include "ui/app_list/views/contents_view.h"
|
| #include "ui/app_list/views/search_box_view_delegate.h"
|
| @@ -70,10 +71,12 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
|
| search_box_->set_controller(this);
|
| AddChildView(search_box_);
|
|
|
| + view_delegate_->GetSpeechUI()->AddObserver(this);
|
| ModelChanged();
|
| }
|
|
|
| SearchBoxView::~SearchBoxView() {
|
| + view_delegate_->GetSpeechUI()->RemoveObserver(this);
|
| model_->search_box()->RemoveObserver(this);
|
| }
|
|
|
| @@ -210,16 +213,24 @@ void SearchBoxView::IconChanged() {
|
| }
|
|
|
| void SearchBoxView::SpeechRecognitionButtonPropChanged() {
|
| - const SearchBoxModel::ButtonProperty* speech_button_prop =
|
| + const SearchBoxModel::SpeechButtonProperty* speech_button_prop =
|
| model_->search_box()->speech_button();
|
| if (speech_button_prop) {
|
| if (!speech_button_) {
|
| speech_button_ = new views::ImageButton(this);
|
| AddChildView(speech_button_);
|
| }
|
| - speech_button_->SetImage(views::Button::STATE_NORMAL,
|
| - &speech_button_prop->icon);
|
| - speech_button_->SetTooltipText(speech_button_prop->tooltip);
|
| +
|
| + if (view_delegate_->GetSpeechUI()->state() ==
|
| + SPEECH_RECOGNITION_HOTWORD_LISTENING) {
|
| + speech_button_->SetImage(
|
| + views::Button::STATE_NORMAL, &speech_button_prop->on_icon);
|
| + speech_button_->SetTooltipText(speech_button_prop->on_tooltip);
|
| + } else {
|
| + speech_button_->SetImage(
|
| + views::Button::STATE_NORMAL, &speech_button_prop->off_icon);
|
| + speech_button_->SetTooltipText(speech_button_prop->off_tooltip);
|
| + }
|
| } else {
|
| if (speech_button_) {
|
| // Deleting a view will detach it from its parent.
|
| @@ -242,4 +253,10 @@ void SearchBoxView::TextChanged() {
|
| NotifyQueryChanged();
|
| }
|
|
|
| +void SearchBoxView::OnSpeechRecognitionStateChanged(
|
| + SpeechRecognitionState new_state) {
|
| + SpeechRecognitionButtonPropChanged();
|
| + SchedulePaint();
|
| +}
|
| +
|
| } // namespace app_list
|
|
|