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

Unified Diff: chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc

Issue 2878503004: Implement search answer "dark run" mode. (Closed)
Patch Set: Created 3 years, 7 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_features.h » ('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 d02e0868aef4af6813370ed810ac5de6efd95502..e17d6c3a99a26a5704c30b619736843adbcc2ac7 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
@@ -95,6 +95,8 @@ SearchAnswerWebContentsDelegate::SearchAnswerWebContentsDelegate(
web_contents_->SetDelegate(this);
web_view_->set_owned_by_client();
web_view_->SetWebContents(web_contents_.get());
+ if (features::IsAnswerCardDarkRunEnabled())
+ web_view_->SetFocusBehavior(views::View::FocusBehavior::NEVER);
model->AddObserver(this);
}
@@ -153,7 +155,8 @@ void SearchAnswerWebContentsDelegate::Update() {
void SearchAnswerWebContentsDelegate::UpdatePreferredSize(
content::WebContents* web_contents,
const gfx::Size& pref_size) {
- web_view_->SetPreferredSize(pref_size);
+ if (!features::IsAnswerCardDarkRunEnabled())
+ web_view_->SetPreferredSize(pref_size);
if (!answer_loaded_time_.is_null()) {
UMA_HISTOGRAM_TIMES("SearchAnswer.ResizeAfterLoadTime",
base::TimeTicks::Now() - answer_loaded_time_);
@@ -209,12 +212,19 @@ void SearchAnswerWebContentsDelegate::DidFinishNavigation(
return;
}
- const net::HttpResponseHeaders* headers =
- navigation_handle->GetResponseHeaders();
- if (!headers || headers->response_code() != net::HTTP_OK ||
- !headers->HasHeaderValue("has_answer", "true")) {
- RecordRequestResult(SearchAnswerRequestResult::REQUEST_RESULT_NO_ANSWER);
- return;
+ if (!features::IsAnswerCardDarkRunEnabled()) {
+ const net::HttpResponseHeaders* headers =
+ navigation_handle->GetResponseHeaders();
+ if (!headers || headers->response_code() != net::HTTP_OK ||
+ !headers->HasHeaderValue("has_answer", "true")) {
+ RecordRequestResult(SearchAnswerRequestResult::REQUEST_RESULT_NO_ANSWER);
+ return;
+ }
+ } else {
+ // In the dark run mode, every other "server response" contains a card.
+ dark_run_received_answer_ = !dark_run_received_answer_;
+ if (!dark_run_received_answer_)
+ return;
}
received_answer_ = true;
« no previous file with comments | « chrome/browser/ui/app_list/search_answer_web_contents_delegate.h ('k') | ui/app_list/app_list_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698