OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_match.h" | 8 #include "chrome/browser/autocomplete/autocomplete_match.h" |
9 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 9 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
10 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 10 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)-> | 114 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)-> |
115 StartPrerendering( | 115 StartPrerendering( |
116 match.destination_url, | 116 match.destination_url, |
117 web_contents->GetController().GetSessionStorageNamespaceMap(), | 117 web_contents->GetController().GetSessionStorageNamespaceMap(), |
118 container_bounds.size()); | 118 container_bounds.size()); |
119 } | 119 } |
120 | 120 |
121 void OmniboxCurrentPageDelegateImpl::SetSuggestionToPrefetch( | 121 void OmniboxCurrentPageDelegateImpl::SetSuggestionToPrefetch( |
122 const InstantSuggestion& suggestion) { | 122 const InstantSuggestion& suggestion) { |
| 123 DCHECK(chrome::IsInstantExtendedAPIEnabled()); |
123 content::WebContents* web_contents = controller_->GetWebContents(); | 124 content::WebContents* web_contents = controller_->GetWebContents(); |
124 if (web_contents && | 125 if (web_contents && |
125 SearchTabHelper::FromWebContents(web_contents)->IsSearchResultsPage()) { | 126 SearchTabHelper::FromWebContents(web_contents)->IsSearchResultsPage()) { |
126 if (chrome::ShouldPrefetchSearchResultsOnSRP() || | 127 if (chrome::ShouldPrefetchSearchResultsOnSRP()) { |
127 chrome::ShouldPrefetchSearchResults()) { | |
128 SearchTabHelper::FromWebContents(web_contents)-> | 128 SearchTabHelper::FromWebContents(web_contents)-> |
129 SetSuggestionToPrefetch(suggestion); | 129 SetSuggestionToPrefetch(suggestion); |
130 } | 130 } |
131 } else if (chrome::ShouldPrefetchSearchResults()) { | 131 } else { |
132 InstantSearchPrerenderer* prerenderer = | 132 InstantSearchPrerenderer* prerenderer = |
133 InstantSearchPrerenderer::GetForProfile(profile_); | 133 InstantSearchPrerenderer::GetForProfile(profile_); |
134 if (prerenderer) | 134 if (prerenderer) |
135 prerenderer->Prerender(suggestion); | 135 prerenderer->Prerender(suggestion); |
136 } | 136 } |
137 } | 137 } |
OLD | NEW |