OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_SEARCH_SEARCH_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_SEARCH_H_ |
6 #define CHROME_BROWSER_SEARCH_SEARCH_H_ | 6 #define CHROME_BROWSER_SEARCH_SEARCH_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Returns true if |contents| is rendered inside the Instant process for | 82 // Returns true if |contents| is rendered inside the Instant process for |
83 // |profile|. | 83 // |profile|. |
84 bool IsRenderedInInstantProcess(const content::WebContents* contents, | 84 bool IsRenderedInInstantProcess(const content::WebContents* contents, |
85 Profile* profile); | 85 Profile* profile); |
86 | 86 |
87 // Returns true if the Instant |url| should use process per site. | 87 // Returns true if the Instant |url| should use process per site. |
88 bool ShouldUseProcessPerSiteForInstantURL(const GURL& url, Profile* profile); | 88 bool ShouldUseProcessPerSiteForInstantURL(const GURL& url, Profile* profile); |
89 | 89 |
90 // Returns true if |url| corresponds to a New Tab page (it can be either an | 90 // Returns true if |url| corresponds to a New Tab page (it can be either an |
91 // Instant Extended NTP or a non-extended NTP). | 91 // Instant Extended NTP or a non-extended NTP). A page that matches the search |
| 92 // or Instant URL of the default search provider but does not have any search |
| 93 // terms is considered an Instant NTP. |
| 94 // TODO(treib): This is confusingly named, as it includes URLs that are related |
| 95 // to an NTP, but aren't an NTP themselves (such as the Instant URL, e.g. |
| 96 // https://www.google.com/webhp?espv=2). |
92 bool IsNTPURL(const GURL& url, Profile* profile); | 97 bool IsNTPURL(const GURL& url, Profile* profile); |
93 | 98 |
94 // Returns true if the visible entry of |contents| is a New Tab Page rendered | 99 // Returns true if the visible entry of |contents| is a New Tab Page rendered |
95 // by Instant. A page that matches the search or Instant URL of the default | 100 // by Instant. |
96 // search provider but does not have any search terms is considered an Instant | |
97 // New Tab Page. | |
98 bool IsInstantNTP(const content::WebContents* contents); | 101 bool IsInstantNTP(const content::WebContents* contents); |
99 | 102 |
100 // Same as IsInstantNTP but uses |nav_entry| to determine the URL for the page | 103 // Same as IsInstantNTP but uses |nav_entry| to determine the URL for the page |
101 // instead of using the visible entry. | 104 // instead of using the visible entry. |
102 bool NavEntryIsInstantNTP(const content::WebContents* contents, | 105 bool NavEntryIsInstantNTP(const content::WebContents* contents, |
103 const content::NavigationEntry* nav_entry); | 106 const content::NavigationEntry* nav_entry); |
104 | 107 |
| 108 // Returns true if |url| corresponds to a New Tab page that would get rendered |
| 109 // by Instant. |
| 110 bool IsInstantNTPURL(const GURL& url, Profile* profile); |
| 111 |
105 // Returns the Instant URL of the default search engine. Returns an empty GURL | 112 // Returns the Instant URL of the default search engine. Returns an empty GURL |
106 // if the engine doesn't have an Instant URL, or if it shouldn't be used (say | 113 // if the engine doesn't have an Instant URL, or if it shouldn't be used (say |
107 // because it doesn't satisfy the requirements for extended mode or if Instant | 114 // because it doesn't satisfy the requirements for extended mode or if Instant |
108 // is disabled through preferences). Callers must check that the returned URL is | 115 // is disabled through preferences). Callers must check that the returned URL is |
109 // valid before using it. |force_instant_results| forces a search page to update | 116 // valid before using it. |force_instant_results| forces a search page to update |
110 // results incrementally even if that is otherwise disabled by google.com | 117 // results incrementally even if that is otherwise disabled by google.com |
111 // preferences. | 118 // preferences. |
112 // NOTE: This method expands the default search engine's instant_url template, | 119 // NOTE: This method expands the default search engine's instant_url template, |
113 // so it shouldn't be called from SearchTermsData or other such code that would | 120 // so it shouldn't be called from SearchTermsData or other such code that would |
114 // lead to an infinite recursion. | 121 // lead to an infinite recursion. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 194 |
188 // Returns true if 'use_search_path_for_instant' flag is set to true in field | 195 // Returns true if 'use_search_path_for_instant' flag is set to true in field |
189 // trials to use an '/search' path in an alternate Instant search base page URL | 196 // trials to use an '/search' path in an alternate Instant search base page URL |
190 // for prefetching search results. This allows experimentation of Instant | 197 // for prefetching search results. This allows experimentation of Instant |
191 // search. | 198 // search. |
192 bool ShouldUseSearchPathForInstant(); | 199 bool ShouldUseSearchPathForInstant(); |
193 | 200 |
194 } // namespace search | 201 } // namespace search |
195 | 202 |
196 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 203 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
OLD | NEW |