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

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: Omnibox check added 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b033c81ccc726747511988b58d8e0443e80a6f8c 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)
+ return;
kmadhusu 2014/06/19 20:44:54 style nit: Add a new line after this.
sidharthms 2014/06/19 20:57:16 Done.
+ if (state == OMNIBOX_FOCUS_NONE) {
+ prerenderer->Cancel();
+ return;
+ }
kmadhusu 2014/06/19 20:44:55 style nit: Add a new line after this.
sidharthms 2014/06/19 20:57:16 Done.
+ if (!IsSearchResultsPage())
kmadhusu 2014/06/19 20:44:54 style nit: Add curly braces here.
sidharthms 2014/06/19 20:57:16 Done.
+ prerenderer->Init(
+ web_contents_->GetController().GetSessionStorageNamespaceMap(),
+ web_contents_->GetContainerBounds().size());
+ }
}
void SearchTabHelper::NavigationEntryUpdated() {
@@ -214,6 +230,18 @@ void SearchTabHelper::Submit(const base::string16& text) {
void SearchTabHelper::OnTabActivated() {
ipc_router_.OnTabActivated();
+
+ OmniboxView* omnibox_view = GetOmniboxView();
+ if (chrome::ShouldPrerenderInstantUrlOnOmniboxFocus() && omnibox_view &&
+ omnibox_view->model()->has_focus()) {
+ InstantSearchPrerenderer* prerenderer =
+ InstantSearchPrerenderer::GetForProfile(profile());
+ if (prerenderer && !IsSearchResultsPage()) {
+ prerenderer->Init(
+ web_contents_->GetController().GetSessionStorageNamespaceMap(),
+ web_contents_->GetContainerBounds().size());
+ }
+ }
}
void SearchTabHelper::OnTabDeactivated() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698