Chromium Code Reviews| 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( |