Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / search / search.h
index 0e9e826..72d89fe 100644 (file)
@@ -56,6 +56,13 @@ enum OriginChipPosition {
   ORIGIN_CHIP_NUM_VALUES,
 };
 
+enum OriginChipV2HideTrigger {
+  ORIGIN_CHIP_V2_DISABLED,
+  ORIGIN_CHIP_V2_HIDE_ON_MOUSE_RELEASE,
+  ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT,
+  ORIGIN_CHIP_V2_NUM_VALUES,
+};
+
 // Use this value for "start margin" to prevent the "es_sm" parameter from
 // being used.
 extern const int kDisableStartMargin;
@@ -71,15 +78,37 @@ bool IsSuggestPrefEnabled(Profile* profile);
 // the Instant Extended API is not enabled.
 uint64 EmbeddedSearchPageVersion();
 
+// 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();
 
-// Extracts and returns search terms from |url|. Returns empty string if the URL
-// is not secure or doesn't have a search term replacement key.  Does not
-// consider IsQueryExtractionEnabled() and Instant support state of the page and
-// does not check for a privileged process, so most callers should use
+// Extracts and returns search terms from |url|. Does not consider
+// IsQueryExtractionEnabled() and Instant support state of the page and does
+// not check for a privileged process, so most callers should use
 // GetSearchTerms() below instead.
-base::string16 GetSearchTermsFromURL(Profile* profile, const GURL& url);
+base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url);
+
+// Returns true if it is okay to extract search terms from |url|. |url| must
+// have a secure scheme and must contain the search terms replacement key for
+// the default search provider.
+bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url);
 
 // Returns the search terms attached to a specific NavigationEntry, or empty
 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not
@@ -165,13 +194,28 @@ bool ShouldHideTopVerbatimMatch();
 DisplaySearchButtonConditions GetDisplaySearchButtonConditions();
 
 // Returns true if the origin chip should be shown in the toolbar. This
-// also includes the related changes to the omnibox.
+// also includes the related changes to the omnibox. Always returns false if
+// ShouldDisplayOriginChipV2() returns true.
 bool ShouldDisplayOriginChip();
 
 // Returns a value indicating where the origin chip should be positioned on the
 // toolbar.
 OriginChipPosition GetOriginChipPosition();
 
+// Returns true if version 2 of the origin chip should be shown.  This version
+// places the origin chip inside the location bar instead of the toolbar and
+// adds show/hide behavior and animations to make the relationship between the
+// chip and the text in the Omnibox clearer.
+bool ShouldDisplayOriginChipV2();
+
+// Returns a value indicating what event should trigger hiding the origin chip
+// in the location bar.
+OriginChipV2HideTrigger GetOriginChipV2HideTrigger();
+
+// Returns true if the local new tab page should show a Google logo and search
+// box for users whose default search provider is Google, or false if not.
+bool ShouldShowGoogleLocalNTP();
+
 // Transforms the input |url| into its "effective URL". The returned URL
 // facilitates grouping process-per-site. The |url| is transformed, for
 // example, from