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

Unified Diff: chrome/browser/ui/app_list/search_answer_web_contents_delegate.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 | « chrome/browser/ui/app_list/search_answer_web_contents_delegate.h ('k') | ui/app_list/app_list_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
diff --git a/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc b/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
index 08af8884a8f4d1fc49703d00bc974ef42845cb1d..f4177fdbb977c37464afe8147dab8fb3f06833df 100644
--- a/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
+++ b/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
@@ -45,9 +45,13 @@ SearchAnswerWebContentsDelegate::SearchAnswerWebContentsDelegate(
web_contents_->SetDelegate(this);
web_view_->set_owned_by_client();
web_view_->SetWebContents(web_contents_.get());
+
+ model->AddObserver(this);
}
-SearchAnswerWebContentsDelegate::~SearchAnswerWebContentsDelegate() {}
+SearchAnswerWebContentsDelegate::~SearchAnswerWebContentsDelegate() {
+ model_->RemoveObserver(this);
+}
views::View* SearchAnswerWebContentsDelegate::web_view() {
return web_view_.get();
@@ -62,6 +66,12 @@ void SearchAnswerWebContentsDelegate::Update() {
model_->SetSearchAnswerAvailable(false);
current_request_url_ = GURL();
+ if (model_->search_box()->is_voice_query()) {
+ // No need to send a server request and show a card because launcher
+ // automatically closes upon voice queries.
+ return;
+ }
+
if (!model_->search_engine_is_google())
return;
@@ -153,4 +163,9 @@ void SearchAnswerWebContentsDelegate::DidStopLoading() {
model_->SetSearchAnswerAvailable(true);
}
+void SearchAnswerWebContentsDelegate::OnSearchEngineIsGoogleChanged(
+ bool is_google) {
+ Update();
+}
+
} // namespace app_list
« no previous file with comments | « chrome/browser/ui/app_list/search_answer_web_contents_delegate.h ('k') | ui/app_list/app_list_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698