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() { |