| 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/ui/browser_navigator.h" | 14 #include "chrome/browser/ui/browser_navigator.h" |
| 15 #include "chrome/browser/ui/search/search_tab_helper.h" | 15 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 16 #include "components/autocomplete/autocomplete_match.h" | 16 #include "components/omnibox/autocomplete_match.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Returns true if the underlying page supports Instant search. | 20 // Returns true if the underlying page supports Instant search. |
| 21 bool PageSupportsInstantSearch(content::WebContents* contents) { | 21 bool PageSupportsInstantSearch(content::WebContents* contents) { |
| 22 // Search results page supports Instant search. | 22 // Search results page supports Instant search. |
| 23 return SearchTabHelper::FromWebContents(contents)->IsSearchResultsPage(); | 23 return SearchTabHelper::FromWebContents(contents)->IsSearchResultsPage(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return (prerender_handle_ && prerender_handle_->contents()) ? | 151 return (prerender_handle_ && prerender_handle_->contents()) ? |
| 152 prerender_handle_->contents()->prerender_contents() : NULL; | 152 prerender_handle_->contents()->prerender_contents() : NULL; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool InstantSearchPrerenderer::QueryMatchesPrefetch( | 155 bool InstantSearchPrerenderer::QueryMatchesPrefetch( |
| 156 const base::string16& query) const { | 156 const base::string16& query) const { |
| 157 if (chrome::ShouldReuseInstantSearchBasePage()) | 157 if (chrome::ShouldReuseInstantSearchBasePage()) |
| 158 return true; | 158 return true; |
| 159 return last_instant_suggestion_.text == query; | 159 return last_instant_suggestion_.text == query; |
| 160 } | 160 } |
| OLD | NEW |