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