Chromium Code Reviews| Index: ui/app_list/search_box_model.cc |
| diff --git a/ui/app_list/search_box_model.cc b/ui/app_list/search_box_model.cc |
| index a0c210eb4977aef4d8c42a03023130286cf01cae..b3ca22a8bf9ed5eeb6674ff8deb05b035752d5a0 100644 |
| --- a/ui/app_list/search_box_model.cc |
| +++ b/ui/app_list/search_box_model.cc |
| @@ -27,8 +27,7 @@ SearchBoxModel::SpeechButtonProperty::SpeechButtonProperty( |
| SearchBoxModel::SpeechButtonProperty::~SpeechButtonProperty() { |
| } |
| -SearchBoxModel::SearchBoxModel() { |
| -} |
| +SearchBoxModel::SearchBoxModel() : is_voice_query_(false) {} |
|
xiyuan
2017/05/01 21:16:31
nit: prefer to put intializer in header
vadimt
2017/05/10 22:55:49
Done; keep forgetting!
|
| SearchBoxModel::~SearchBoxModel() { |
| } |
| @@ -67,8 +66,8 @@ void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { |
| observer.SelectionModelChanged(); |
| } |
| -void SearchBoxModel::SetText(const base::string16& text) { |
| - if (text_ == text) |
| +void SearchBoxModel::Update(const base::string16& text, bool is_voice_query) { |
| + if (text_ == text && is_voice_query_ == is_voice_query) |
| return; |
| // Log that a new search has been commenced whenever the text box text |
| @@ -77,8 +76,9 @@ void SearchBoxModel::SetText(const base::string16& text) { |
| UMA_HISTOGRAM_ENUMERATION("Apps.AppListSearchCommenced", 1, 2); |
| } |
| text_ = text; |
| + is_voice_query_ = is_voice_query; |
| for (auto& observer : observers_) |
| - observer.TextChanged(); |
| + observer.Update(); |
| } |
| void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { |