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

Unified Diff: chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.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: Rebase on master 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/omnibox/omnibox_current_page_delegate_impl.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc b/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc
index 345a9e89428b3192d5a971c7dc900de93aa1ff02..9754f8d5e47e98bc1890da77b69ac3ec3d924294 100644
--- a/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc
+++ b/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc
@@ -91,10 +91,25 @@ void OmniboxCurrentPageDelegateImpl::OnInputStateChanged() {
void OmniboxCurrentPageDelegateImpl::OnFocusChanged(
OmniboxFocusState state,
OmniboxFocusChangeReason reason) {
- if (!controller_->GetWebContents())
+ content::WebContents* web_contents = controller_->GetWebContents();
+ if (!web_contents)
return;
- SearchTabHelper::FromWebContents(
- controller_->GetWebContents())->OmniboxFocusChanged(state, reason);
+
+ SearchTabHelper* tab_helper = SearchTabHelper::FromWebContents(web_contents);
+ tab_helper->OmniboxFocusChanged(state, reason);
+
+ if (chrome::ShouldPrerenderInstantUrlOnOmniboxFocus() &&
+ state == OMNIBOX_FOCUS_VISIBLE) {
+ gfx::Rect container_bounds = web_contents->GetContainerBounds();
+ InstantSearchPrerenderer* prerenderer =
+ InstantSearchPrerenderer::GetForProfile(profile_);
+ if (prerenderer && !tab_helper->IsSearchResultsPage()) {
+ prerenderer->Init(
+ web_contents->GetController().GetSessionStorageNamespaceMap(),
+ container_bounds.size());
+ return;
Jered 2014/06/16 22:43:13 Omit this statement since it will happen anyway.
sidharthms 2014/06/17 03:58:46 Done.
+ }
+ }
}
void OmniboxCurrentPageDelegateImpl::DoPrerender(
« 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