Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: components/search/search.h

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/search/DEPS ('k') | components/search/search.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/search/search.h
diff --git a/components/search/search.h b/components/search/search.h
index 0a7a55b89473a5fa4d6c302acd61b11e3dc788f5..2ce62047b68cef2597071108e4bba200a1b24c08 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_
« no previous file with comments | « components/search/DEPS ('k') | components/search/search.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698