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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 bool IsInstantExtendedAPIEnabled(); | 71 bool IsInstantExtendedAPIEnabled(); |
72 | 72 |
73 // Returns whether the suggest is enabled for the given |profile|. | 73 // Returns whether the suggest is enabled for the given |profile|. |
74 bool IsSuggestPrefEnabled(Profile* profile); | 74 bool IsSuggestPrefEnabled(Profile* profile); |
75 | 75 |
76 // Returns the value to pass to the &espv CGI parameter when loading the | 76 // Returns the value to pass to the &espv CGI parameter when loading the |
77 // embedded search page from the user's default search provider. Returns 0 if | 77 // embedded search page from the user's default search provider. Returns 0 if |
78 // the Instant Extended API is not enabled. | 78 // the Instant Extended API is not enabled. |
79 uint64 EmbeddedSearchPageVersion(); | 79 uint64 EmbeddedSearchPageVersion(); |
80 | 80 |
81 // Returns whether query extraction is enabled. | 81 // Returns whether query extraction flag is enabled in the field trials. |
82 bool IsQueryExtractionEnabled(); | 82 bool IsQueryExtractionEnabled(); |
83 | 83 |
84 // Extracts and returns search terms from |url|. Returns empty string if the URL | 84 // Extracts and returns search terms from |url|. Does not consider |
85 // is not secure or doesn't have a search term replacement key. Does not | 85 // IsQueryExtractionEnabled() and Instant support state of the page and does |
86 // consider IsQueryExtractionEnabled() and Instant support state of the page and | 86 // not check for a privileged process, so most callers should use |
87 // does not check for a privileged process, so most callers should use | |
88 // GetSearchTerms() below instead. | 87 // GetSearchTerms() below instead. |
89 base::string16 GetSearchTermsFromURL(Profile* profile, const GURL& url); | 88 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url); |
89 | |
90 // Returns true if |url| passes some basic checks that must succeed for it to be | |
91 // usable as an instant URL: | |
Jered
2014/02/11 19:10:10
How about rewording this comment:
"Returns true if
kmadhusu
2014/02/11 23:24:32
Done.
| |
92 // (1) It contains the search terms replacement key of |template_url|, which is | |
93 // expected to be the TemplateURL* for the default search provider. | |
94 // (2) Either it has a secure scheme, or else the user has manually specified a | |
95 // --google-base-url and it uses that base URL. (This allows testers to use | |
96 // --google-base-url to point at non-HTTPS servers, which eases testing.) | |
97 bool IsSuitableURLForInstant(Profile* profile, const GURL& url); | |
kmadhusu
2014/02/11 01:40:03
This function deserves a better name. I would like
Jered
2014/02/11 19:10:10
How about IsQueryExtractionAllowedForURL()?
kmadhusu
2014/02/11 23:24:32
Done.
| |
90 | 98 |
91 // Returns the search terms attached to a specific NavigationEntry, or empty | 99 // Returns the search terms attached to a specific NavigationEntry, or empty |
92 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not | 100 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not |
93 // check Instant support, so most callers should use GetSearchTerms() below | 101 // check Instant support, so most callers should use GetSearchTerms() below |
94 // instead. | 102 // instead. |
95 base::string16 GetSearchTermsFromNavigationEntry( | 103 base::string16 GetSearchTermsFromNavigationEntry( |
96 const content::NavigationEntry* entry); | 104 const content::NavigationEntry* entry); |
97 | 105 |
98 // Returns search terms if this WebContents is a search results page. It looks | 106 // Returns search terms if this WebContents is a search results page. It looks |
99 // in the visible NavigationEntry first, to see if search terms have already | 107 // in the visible NavigationEntry first, to see if search terms have already |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 282 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
275 bool default_value, | 283 bool default_value, |
276 const FieldTrialFlags& flags); | 284 const FieldTrialFlags& flags); |
277 | 285 |
278 // Returns the Cacheable New Tab Page URL for the given |profile|. | 286 // Returns the Cacheable New Tab Page URL for the given |profile|. |
279 GURL GetNewTabPageURL(Profile* profile); | 287 GURL GetNewTabPageURL(Profile* profile); |
280 | 288 |
281 } // namespace chrome | 289 } // namespace chrome |
282 | 290 |
283 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 291 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
OLD | NEW |