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 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 // Returns the last prefetched search query. | 75 // Returns the last prefetched search query. |
76 const base::string16& get_last_query() const { | 76 const base::string16& get_last_query() const { |
77 return last_instant_suggestion_.text; | 77 return last_instant_suggestion_.text; |
78 } | 78 } |
79 | 79 |
80 // Returns true when prerendering is allowed for the given |source| and | 80 // Returns true when prerendering is allowed for the given |source| and |
81 // |match|. | 81 // |match|. |
82 bool IsAllowed(const AutocompleteMatch& match, | 82 bool IsAllowed(const AutocompleteMatch& match, |
83 content::WebContents* source) const; | 83 content::WebContents* source) const; |
84 | 84 |
85 // Extracts and returns search terms from |url|. Does not consider | |
86 // IsQueryExtractionEnabled() and Instant support state of the page and does | |
87 // not check for a privileged process. | |
88 base::string16 GetSearchTermsFromURL(const GURL& url) const; | |
Jered
2014/02/07 03:02:26
This code would be more appropriate in search.cc.
kmadhusu
2014/02/11 01:40:02
Done.
| |
89 | |
85 private: | 90 private: |
86 friend class InstantSearchPrerendererTest; | 91 friend class InstantSearchPrerendererTest; |
87 | 92 |
88 content::WebContents* prerender_contents() const; | 93 content::WebContents* prerender_contents() const; |
89 | 94 |
90 // Returns true if the |query| matches the last prefetched search query or if | 95 // Returns true if the |query| matches the last prefetched search query or if |
91 // the 'reuse_instant_search_base_page' flag is enabled in the field trials. | 96 // the 'reuse_instant_search_base_page' flag is enabled in the field trials. |
92 bool QueryMatchesPrefetch(const base::string16& query) const; | 97 bool QueryMatchesPrefetch(const base::string16& query) const; |
93 | 98 |
94 Profile* const profile_; | 99 Profile* const profile_; |
95 | 100 |
96 // Instant search base page URL. | 101 // Instant search base page URL. |
97 const GURL prerender_url_; | 102 const GURL prerender_url_; |
98 | 103 |
99 scoped_ptr<prerender::PrerenderHandle> prerender_handle_; | 104 scoped_ptr<prerender::PrerenderHandle> prerender_handle_; |
100 | 105 |
101 InstantSuggestion last_instant_suggestion_; | 106 InstantSuggestion last_instant_suggestion_; |
102 | 107 |
103 DISALLOW_COPY_AND_ASSIGN(InstantSearchPrerenderer); | 108 DISALLOW_COPY_AND_ASSIGN(InstantSearchPrerenderer); |
104 }; | 109 }; |
105 | 110 |
106 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ | 111 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ |
OLD | NEW |