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

Unified Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 338633003: Prerender Instant search base url on omnibox focus event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to handle corner case Created 6 years, 6 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: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index b117ad020d24c398cc3042ed0019dc3e3e713317..398613fbf68da53359e90f8f0bd8c3372f5c934b 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
#include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
+#include "chrome/browser/ui/search/instant_search_prerenderer.h"
#include "chrome/browser/ui/search/search_ipc_router_policy_impl.h"
#include "chrome/browser/ui/search/search_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
@@ -172,6 +173,21 @@ void SearchTabHelper::OmniboxFocusChanged(OmniboxFocusState state,
if (web_contents_->GetController().GetPendingEntry() == NULL) {
ipc_router_.SetInputInProgress(IsInputInProgress());
}
+
+ if (chrome::ShouldPrerenderInstantUrlOnOmniboxFocus()) {
+ InstantSearchPrerenderer* prerenderer =
+ InstantSearchPrerenderer::GetForProfile(profile());
+ if (prerenderer) {
+ if (state != OMNIBOX_FOCUS_NONE) {
kmadhusu 2014/06/18 16:23:50 nit: For better readability, can we split this if-
sidharthms 2014/06/19 20:36:52 Done.
+ if (!IsSearchResultsPage())
+ prerenderer->Init(
+ web_contents_->GetController().GetSessionStorageNamespaceMap(),
+ web_contents_->GetContainerBounds().size());
+ } else {
+ prerenderer->Cancel();
+ }
+ }
+ }
}
void SearchTabHelper::NavigationEntryUpdated() {
@@ -214,6 +230,17 @@ void SearchTabHelper::Submit(const base::string16& text) {
void SearchTabHelper::OnTabActivated() {
ipc_router_.OnTabActivated();
+
+ if (chrome::ShouldPrerenderInstantUrlOnOmniboxFocus() &&
+ GetOmniboxView()->model()->has_focus()) {
+ InstantSearchPrerenderer* prerenderer =
+ InstantSearchPrerenderer::GetForProfile(profile());
+ if (prerenderer && !IsSearchResultsPage()) {
+ prerenderer->Init(
+ web_contents_->GetController().GetSessionStorageNamespaceMap(),
+ web_contents_->GetContainerBounds().size());
+ }
+ }
}
void SearchTabHelper::OnTabDeactivated() {

Powered by Google App Engine
This is Rietveld 408576698