diff options
Diffstat (limited to 'components/search/search.h')
-rw-r--r-- | components/search/search.h | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/components/search/search.h b/components/search/search.h index 0a7a55b..2ce6204 100644 --- a/components/search/search.h +++ b/components/search/search.h @@ -13,7 +13,14 @@ #include "base/strings/string16.h" #include "base/strings/string_split.h" -namespace chrome { +class GURL; +class TemplateURL; + +namespace search { + +// Use this value for "start margin" to prevent the "es_sm" parameter from +// being used. +extern const int kDisableStartMargin; // Returns whether the Instant Extended API is enabled. bool IsInstantExtendedAPIEnabled(); @@ -55,6 +62,52 @@ bool GetBoolValueForFlagWithDefault(const std::string& flag, bool default_value, const FieldTrialFlags& flags); -} // namespace chrome +// Returns a string indicating whether InstantExtended is enabled, suitable +// for adding as a query string param to the homepage or search requests. +// Returns an empty string otherwise. +// +// |for_search| should be set to true for search requests, in which case this +// returns a non-empty string only if query extraction is enabled. +std::string InstantExtendedEnabledParam(bool for_search); + +// Returns a string that will cause the search results page to update +// incrementally. Currently, Instant Extended passes a different param to +// search results pages that also has this effect, so by default this function +// returns the empty string when Instant Extended is enabled. However, when +// doing instant search result prerendering, we still need to pass this param, +// as Instant Extended does not cause incremental updates by default for the +// prerender page. Callers should set |for_prerender| in this case to force +// the returned string to be non-empty. +std::string ForceInstantResultsParam(bool for_prerender); + +// Returns whether query extraction is enabled. +bool IsQueryExtractionEnabled(); + +// Returns true if 'prefetch_results' flag is set to true in field trials to +// prefetch high-confidence search suggestions. +bool ShouldPrefetchSearchResults(); + +// Returns true if 'reuse_instant_search_base_page' flag is set to true in field +// trials to reuse the prerendered page to commit any search query. +bool ShouldReuseInstantSearchBasePage(); + +// Returns true if 'allow_prefetch_non_default_match' flag is enabled in field +// trials to allow prefetching the suggestion marked to be prefetched by the +// suggest server even if it is not the default match. +bool ShouldAllowPrefetchNonDefaultMatch(); + +// |url| should either have a secure scheme or have a non-HTTPS base URL that +// the user specified using --google-base-url. (This allows testers to use +// --google-base-url to point at non-HTTPS servers, which eases testing.) +bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url); + +// ----------------------------------------------------- +// The following APIs are exposed for use in tests only. +// ----------------------------------------------------- + +// Forces query in the omnibox to be on for tests. +void EnableQueryExtractionForTesting(); + +} // namespace search #endif // COMPONENTS_SEARCH_SEARCH_H_ |