| 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/search/instant_search_prerenderer.h" | 5 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/prerender/prerender_handle.h" | 7 #include "chrome/browser/prerender/prerender_handle.h" |
| 8 #include "chrome/browser/prerender/prerender_manager.h" | 8 #include "chrome/browser/prerender/prerender_manager.h" |
| 9 #include "chrome/browser/prerender/prerender_manager_factory.h" | 9 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/search/instant_service.h" | 11 #include "chrome/browser/search/instant_service.h" |
| 12 #include "chrome/browser/search/instant_service_factory.h" | 12 #include "chrome/browser/search/instant_service_factory.h" |
| 13 #include "chrome/browser/search/search.h" | 13 #include "chrome/browser/search/search.h" |
| 14 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 15 #include "chrome/browser/ui/browser_navigator.h" | 15 #include "chrome/browser/ui/browser_navigator_params.h" |
| 16 #include "chrome/browser/ui/search/search_tab_helper.h" | 16 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 17 #include "components/omnibox/browser/autocomplete_match.h" | 17 #include "components/omnibox/browser/autocomplete_match.h" |
| 18 #include "components/search/search.h" | 18 #include "components/search/search.h" |
| 19 #include "components/search_engines/template_url_service.h" | 19 #include "components/search_engines/template_url_service.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Returns true if the underlying page supports Instant search. | 23 // Returns true if the underlying page supports Instant search. |
| 24 bool PageSupportsInstantSearch(content::WebContents* contents) { | 24 bool PageSupportsInstantSearch(content::WebContents* contents) { |
| 25 // Search results page supports Instant search. | 25 // Search results page supports Instant search. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return (prerender_handle_ && prerender_handle_->contents()) ? | 189 return (prerender_handle_ && prerender_handle_->contents()) ? |
| 190 prerender_handle_->contents()->prerender_contents() : NULL; | 190 prerender_handle_->contents()->prerender_contents() : NULL; |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool InstantSearchPrerenderer::QueryMatchesPrefetch( | 193 bool InstantSearchPrerenderer::QueryMatchesPrefetch( |
| 194 const base::string16& query) const { | 194 const base::string16& query) const { |
| 195 if (search::ShouldReuseInstantSearchBasePage()) | 195 if (search::ShouldReuseInstantSearchBasePage()) |
| 196 return true; | 196 return true; |
| 197 return last_instant_suggestion_.text == query; | 197 return last_instant_suggestion_.text == query; |
| 198 } | 198 } |
| OLD | NEW |