| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SEARCH_SEARCH_H_ | 5 #ifndef COMPONENTS_SEARCH_SEARCH_H_ |
| 6 #define COMPONENTS_SEARCH_SEARCH_H_ | 6 #define COMPONENTS_SEARCH_SEARCH_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const FieldTrialFlags& flags); | 51 const FieldTrialFlags& flags); |
| 52 | 52 |
| 53 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 53 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 54 // Exposed for testing only. | 54 // Exposed for testing only. |
| 55 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 55 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 56 bool default_value, | 56 bool default_value, |
| 57 const FieldTrialFlags& flags); | 57 const FieldTrialFlags& flags); |
| 58 | 58 |
| 59 // Returns a string indicating whether InstantExtended is enabled, suitable | 59 // Returns a string indicating whether InstantExtended is enabled, suitable |
| 60 // for adding as a query string param to the homepage or search requests. | 60 // for adding as a query string param to the homepage or search requests. |
| 61 // Returns an empty string otherwise. | 61 std::string InstantExtendedEnabledParam(); |
| 62 // | |
| 63 // |for_search| should be set to true for search requests, in which case this | |
| 64 // returns a non-empty string only if query extraction is enabled. | |
| 65 std::string InstantExtendedEnabledParam(bool for_search); | |
| 66 | 62 |
| 67 // Returns a string that will cause the search results page to update | 63 // Returns a string that will cause the search results page to update |
| 68 // incrementally. Currently, Instant Extended passes a different param to | 64 // incrementally. Currently, Instant Extended passes a different param to |
| 69 // search results pages that also has this effect, so by default this function | 65 // search results pages that also has this effect, so by default this function |
| 70 // returns the empty string when Instant Extended is enabled. However, when | 66 // returns the empty string when Instant Extended is enabled. However, when |
| 71 // doing instant search result prerendering, we still need to pass this param, | 67 // doing instant search result prerendering, we still need to pass this param, |
| 72 // as Instant Extended does not cause incremental updates by default for the | 68 // as Instant Extended does not cause incremental updates by default for the |
| 73 // prerender page. Callers should set |for_prerender| in this case to force | 69 // prerender page. Callers should set |for_prerender| in this case to force |
| 74 // the returned string to be non-empty. | 70 // the returned string to be non-empty. |
| 75 std::string ForceInstantResultsParam(bool for_prerender); | 71 std::string ForceInstantResultsParam(bool for_prerender); |
| 76 | 72 |
| 77 // Returns true if 'prefetch_results' flag is set to true in field trials to | 73 // Returns true if 'prefetch_results' flag is set to true in field trials to |
| 78 // prefetch high-confidence search suggestions. | 74 // prefetch high-confidence search suggestions. |
| 79 bool ShouldPrefetchSearchResults(); | 75 bool ShouldPrefetchSearchResults(); |
| 80 | 76 |
| 81 // Returns true if 'reuse_instant_search_base_page' flag is set to true in field | 77 // Returns true if 'reuse_instant_search_base_page' flag is set to true in field |
| 82 // trials to reuse the prerendered page to commit any search query. | 78 // trials to reuse the prerendered page to commit any search query. |
| 83 bool ShouldReuseInstantSearchBasePage(); | 79 bool ShouldReuseInstantSearchBasePage(); |
| 84 | 80 |
| 85 // |url| should either have a secure scheme or have a non-HTTPS base URL that | 81 // |url| should either have a secure scheme or have a non-HTTPS base URL that |
| 86 // the user specified using --google-base-url. (This allows testers to use | 82 // the user specified using --google-base-url. (This allows testers to use |
| 87 // --google-base-url to point at non-HTTPS servers, which eases testing.) | 83 // --google-base-url to point at non-HTTPS servers, which eases testing.) |
| 88 bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url); | 84 bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url); |
| 89 | 85 |
| 90 } // namespace search | 86 } // namespace search |
| 91 | 87 |
| 92 #endif // COMPONENTS_SEARCH_SEARCH_H_ | 88 #endif // COMPONENTS_SEARCH_SEARCH_H_ |
| OLD | NEW |