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

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: Comments addressed 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/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..5f95966053b12f86a8301e1001be806f8867dc1c 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,24 @@ 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());
kmadhusu 2014/06/17 18:29:35 Let's start with a simple approach. - When the om
sidharthms 2014/06/17 21:52:24 Done.
+ }
+ }
}
void OmniboxCurrentPageDelegateImpl::DoPrerender(
« chrome/browser/ui/browser.cc ('K') | « chrome/browser/ui/browser_instant_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698