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

Unified Diff: ui/app_list/search_box_model.cc

Issue 2846733004: Optimization: not sending answer server requests for voice queries. (Closed)
Patch Set: Fixing broken tests. 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
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) {

Powered by Google App Engine
This is Rietveld 408576698