| 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..3fc779bd6ef562d5fab118ed56ed5ac38648d313 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"
|
| @@ -171,6 +172,22 @@ void SearchTabHelper::OmniboxFocusChanged(OmniboxFocusState state,
|
| // a spurious oninputend when the user accepts a match in the omnibox.
|
| if (web_contents_->GetController().GetPendingEntry() == NULL) {
|
| ipc_router_.SetInputInProgress(IsInputInProgress());
|
| +
|
| + InstantSearchPrerenderer* prerenderer =
|
| + InstantSearchPrerenderer::GetForProfile(profile());
|
| + if (!prerenderer || !chrome::ShouldPrerenderInstantUrlOnOmniboxFocus())
|
| + return;
|
| +
|
| + if (state == OMNIBOX_FOCUS_NONE) {
|
| + prerenderer->Cancel();
|
| + return;
|
| + }
|
| +
|
| + if (!IsSearchResultsPage()) {
|
| + prerenderer->Init(
|
| + web_contents_->GetController().GetSessionStorageNamespaceMap(),
|
| + web_contents_->GetContainerBounds().size());
|
| + }
|
| }
|
| }
|
|
|
| @@ -214,6 +231,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() {
|
|
|