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 22 matching lines...) Expand all Loading... | |
33 enum CacheableNTPLoad { | 33 enum CacheableNTPLoad { |
34 CACHEABLE_NTP_LOAD_FAILED = 0, | 34 CACHEABLE_NTP_LOAD_FAILED = 0, |
35 CACHEABLE_NTP_LOAD_SUCCEEDED = 1, | 35 CACHEABLE_NTP_LOAD_SUCCEEDED = 1, |
36 CACHEABLE_NTP_LOAD_MAX = 2 | 36 CACHEABLE_NTP_LOAD_MAX = 2 |
37 }; | 37 }; |
38 | 38 |
39 // Returns whether the suggest is enabled for the given |profile|. | 39 // Returns whether the suggest is enabled for the given |profile|. |
40 bool IsSuggestPrefEnabled(Profile* profile); | 40 bool IsSuggestPrefEnabled(Profile* profile); |
41 | 41 |
42 // Extracts and returns search terms from |url|. Does not consider Instant | 42 // Extracts and returns search terms from |url|. Does not consider Instant |
43 // support state of the page and does not check for a privileged process, so | 43 // support state of the page and does not check for a privileged process. |
Peter Kasting
2016/08/13 05:03:44
I suspect you don't even need the second sentence,
Marc Treib
2016/08/16 12:00:17
Fair enough, removed.
| |
44 // most callers should use GetSearchTerms() below instead. | |
45 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url); | 44 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url); |
46 | 45 |
47 // Returns true if it is okay to extract search terms from |url|. |url| must | 46 // Returns true if it is okay to extract search terms from |url|. |url| must |
48 // have a secure scheme and must contain the search terms replacement key for | 47 // have a secure scheme and must contain the search terms replacement key for |
49 // the default search provider. | 48 // the default search provider. |
50 bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url); | 49 bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url); |
51 | 50 |
52 // Returns the search terms attached to a specific NavigationEntry, or empty | |
53 // string otherwise. Does not check Instant support, so most callers should use | |
54 // GetSearchTerms() below instead. | |
55 base::string16 GetSearchTermsFromNavigationEntry( | |
56 const content::NavigationEntry* entry); | |
57 | |
58 // Returns search terms if this WebContents is a search results page. It looks | |
59 // in the visible NavigationEntry first, to see if search terms have already | |
60 // been extracted. Failing that, it tries to extract search terms from the URL. | |
61 // | |
62 // Returns a blank string if search terms were not found, or if search terms | |
63 // extraction is disabled for this WebContents or profile, or if |contents| | |
64 // does not support Instant. | |
65 base::string16 GetSearchTerms(const content::WebContents* contents); | |
66 | |
67 // Returns true if |url| should be rendered in the Instant renderer process. | 51 // Returns true if |url| should be rendered in the Instant renderer process. |
68 bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile); | 52 bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile); |
69 | 53 |
70 // Returns true if |contents| is rendered inside the Instant process for | 54 // Returns true if |contents| is rendered inside the Instant process for |
71 // |profile|. | 55 // |profile|. |
72 bool IsRenderedInInstantProcess(const content::WebContents* contents, | 56 bool IsRenderedInInstantProcess(const content::WebContents* contents, |
73 Profile* profile); | 57 Profile* profile); |
74 | 58 |
75 // Returns true if the Instant |url| should use process per site. | 59 // Returns true if the Instant |url| should use process per site. |
76 bool ShouldUseProcessPerSiteForInstantURL(const GURL& url, Profile* profile); | 60 bool ShouldUseProcessPerSiteForInstantURL(const GURL& url, Profile* profile); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 | 155 |
172 // Returns true if 'use_search_path_for_instant' flag is set to true in field | 156 // Returns true if 'use_search_path_for_instant' flag is set to true in field |
173 // trials to use an '/search' path in an alternate Instant search base page URL | 157 // trials to use an '/search' path in an alternate Instant search base page URL |
174 // for prefetching search results. This allows experimentation of Instant | 158 // for prefetching search results. This allows experimentation of Instant |
175 // search. | 159 // search. |
176 bool ShouldUseSearchPathForInstant(); | 160 bool ShouldUseSearchPathForInstant(); |
177 | 161 |
178 } // namespace search | 162 } // namespace search |
179 | 163 |
180 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 164 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
OLD | NEW |