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

Unified Diff: ui/app_list/search_box_model.cc

Issue 2846733004: Optimization: not sending answer server requests for voice queries. (Closed)
Patch Set: Last nits Created 3 years, 8 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
« no previous file with comments | « ui/app_list/search_box_model.h ('k') | ui/app_list/search_box_model_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..877d677d0c57f65ead162751f7dc1125d5eec613 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() {}
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) {
« no previous file with comments | « ui/app_list/search_box_model.h ('k') | ui/app_list/search_box_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698