Chromium Code Reviews| Index: chrome/browser/search/search.cc |
| diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc |
| index 43a52da7b590d5914f12725ff561f80354b9216d..b6635122ce9ec6cb8d1fa8d88164b89aaab09063 100644 |
| --- a/chrome/browser/search/search.cc |
| +++ b/chrome/browser/search/search.cc |
| @@ -74,6 +74,12 @@ const char kPrerenderInstantUrlOnOmniboxFocus[] = |
| // search query. |
| const char kReuseInstantSearchBasePage[] = "reuse_instant_search_base_page"; |
| +// Controls whether to use the alternate Instant search base URL. This allows |
| +// experimentation of Instant search. |
| +const char kUseAltInstantURL[] = "use_alternate_instant_url"; |
| +const char kAltInstantURLPath[] = "search"; |
| +const char kAltInstantURLQueryParams[] = "&qbp=1"; |
| + |
| const char kDisplaySearchButtonFlagName[] = "display_search_button"; |
| const char kOriginChipFlagName[] = "origin_chip"; |
| #if !defined(OS_IOS) && !defined(OS_ANDROID) |
| @@ -550,6 +556,15 @@ GURL GetInstantURL(Profile* profile, int start_margin, |
| if (!IsURLAllowedForSupervisedUser(instant_url, profile)) |
| return GURL(); |
| + if (ShouldUseAltInstantURL()) { |
| + GURL::Replacements replacements; |
| + const std::string path(kAltInstantURLPath); |
| + replacements.SetPathStr(path); |
| + const std::string query( |
| + instant_url.query() + std::string(kAltInstantURLQueryParams)); |
| + replacements.SetQueryStr(query); |
| + instant_url = instant_url.ReplaceComponents(replacements); |
| + } |
| return instant_url; |
| } |
| @@ -834,4 +849,10 @@ bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
| } |
| +bool ShouldUseAltInstantURL() { |
|
samarth
2014/06/20 04:43:23
Put this in an anonymous namespace?
kmadhusu
2014/06/20 16:01:53
If I put this in anonymous namespace, I will not b
|
| + FieldTrialFlags flags; |
| + return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( |
| + kUseAltInstantURL, false, flags); |
| +} |
| + |
| } // namespace chrome |