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 21 matching lines...) Expand all Loading... |
32 // For reporting Cacheable NTP navigations. | 32 // For reporting Cacheable NTP navigations. |
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 | 42 // Extracts and returns search terms from |url|. Does not consider Instant |
43 // IsQueryExtractionEnabled() and Instant support state of the page and does | 43 // support state of the page and does not check for a privileged process, so |
44 // not check for a privileged process, so most callers should use | 44 // most callers should use GetSearchTerms() below instead. |
45 // GetSearchTerms() below instead. | |
46 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url); | 45 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url); |
47 | 46 |
48 // Returns true if it is okay to extract search terms from |url|. |url| must | 47 // Returns true if it is okay to extract search terms from |url|. |url| must |
49 // have a secure scheme and must contain the search terms replacement key for | 48 // have a secure scheme and must contain the search terms replacement key for |
50 // the default search provider. | 49 // the default search provider. |
51 bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url); | 50 bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url); |
52 | 51 |
53 // Returns the search terms attached to a specific NavigationEntry, or empty | 52 // Returns the search terms attached to a specific NavigationEntry, or empty |
54 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not | 53 // string otherwise. Does not check Instant support, so most callers should use |
55 // check Instant support, so most callers should use GetSearchTerms() below | 54 // GetSearchTerms() below instead. |
56 // instead. | |
57 base::string16 GetSearchTermsFromNavigationEntry( | 55 base::string16 GetSearchTermsFromNavigationEntry( |
58 const content::NavigationEntry* entry); | 56 const content::NavigationEntry* entry); |
59 | 57 |
60 // Returns search terms if this WebContents is a search results page. It looks | 58 // Returns search terms if this WebContents is a search results page. It looks |
61 // in the visible NavigationEntry first, to see if search terms have already | 59 // in the visible NavigationEntry first, to see if search terms have already |
62 // been extracted. Failing that, it tries to extract search terms from the URL. | 60 // been extracted. Failing that, it tries to extract search terms from the URL. |
63 // | 61 // |
64 // Returns a blank string if search terms were not found, or if search terms | 62 // Returns a blank string if search terms were not found, or if search terms |
65 // extraction is disabled for this WebContents or profile, or if |contents| | 63 // extraction is disabled for this WebContents or profile, or if |contents| |
66 // does not support Instant. | 64 // does not support Instant. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 171 |
174 // Returns true if 'use_search_path_for_instant' flag is set to true in field | 172 // Returns true if 'use_search_path_for_instant' flag is set to true in field |
175 // trials to use an '/search' path in an alternate Instant search base page URL | 173 // trials to use an '/search' path in an alternate Instant search base page URL |
176 // for prefetching search results. This allows experimentation of Instant | 174 // for prefetching search results. This allows experimentation of Instant |
177 // search. | 175 // search. |
178 bool ShouldUseSearchPathForInstant(); | 176 bool ShouldUseSearchPathForInstant(); |
179 | 177 |
180 } // namespace search | 178 } // namespace search |
181 | 179 |
182 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 180 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
OLD | NEW |