| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // for adding as a query string param to the homepage or search requests. | 82 // for adding as a query string param to the homepage or search requests. |
| 83 // Returns an empty string otherwise. | 83 // Returns an empty string otherwise. |
| 84 // | 84 // |
| 85 // |for_search| should be set to true for search requests, in which case this | 85 // |for_search| should be set to true for search requests, in which case this |
| 86 // returns a non-empty string only if query extraction is enabled. | 86 // returns a non-empty string only if query extraction is enabled. |
| 87 std::string InstantExtendedEnabledParam(bool for_search); | 87 std::string InstantExtendedEnabledParam(bool for_search); |
| 88 | 88 |
| 89 // Returns whether query extraction is enabled. | 89 // Returns whether query extraction is enabled. |
| 90 bool IsQueryExtractionEnabled(); | 90 bool IsQueryExtractionEnabled(); |
| 91 | 91 |
| 92 // Extracts and returns search terms from |url|. Returns empty string if the URL | 92 // Extracts and returns search terms from |url|. Does not consider |
| 93 // is not secure or doesn't have a search term replacement key. Does not | 93 // IsQueryExtractionEnabled() and Instant support state of the page and does |
| 94 // consider IsQueryExtractionEnabled() and Instant support state of the page and | 94 // not check for a privileged process, so most callers should use |
| 95 // does not check for a privileged process, so most callers should use | |
| 96 // GetSearchTerms() below instead. | 95 // GetSearchTerms() below instead. |
| 97 base::string16 GetSearchTermsFromURL(Profile* profile, const GURL& url); | 96 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url); |
| 97 |
| 98 // Returns true if it is okay to extract search terms from |url|. |url| must |
| 99 // have a secure scheme and must contain the search terms replacement key for |
| 100 // the default search provider. |
| 101 bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url); |
| 98 | 102 |
| 99 // Returns the search terms attached to a specific NavigationEntry, or empty | 103 // Returns the search terms attached to a specific NavigationEntry, or empty |
| 100 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not | 104 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not |
| 101 // check Instant support, so most callers should use GetSearchTerms() below | 105 // check Instant support, so most callers should use GetSearchTerms() below |
| 102 // instead. | 106 // instead. |
| 103 base::string16 GetSearchTermsFromNavigationEntry( | 107 base::string16 GetSearchTermsFromNavigationEntry( |
| 104 const content::NavigationEntry* entry); | 108 const content::NavigationEntry* entry); |
| 105 | 109 |
| 106 // Returns search terms if this WebContents is a search results page. It looks | 110 // Returns search terms if this WebContents is a search results page. It looks |
| 107 // in the visible NavigationEntry first, to see if search terms have already | 111 // 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... |
| 282 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 286 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 283 bool default_value, | 287 bool default_value, |
| 284 const FieldTrialFlags& flags); | 288 const FieldTrialFlags& flags); |
| 285 | 289 |
| 286 // Returns the Cacheable New Tab Page URL for the given |profile|. | 290 // Returns the Cacheable New Tab Page URL for the given |profile|. |
| 287 GURL GetNewTabPageURL(Profile* profile); | 291 GURL GetNewTabPageURL(Profile* profile); |
| 288 | 292 |
| 289 } // namespace chrome | 293 } // namespace chrome |
| 290 | 294 |
| 291 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 295 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
| OLD | NEW |