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

Unified Diff: chrome/browser/search/search.cc

Issue 330653004: Adds a field trial flag to control whether to use an alternate Instant search base page URL for pre… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/search.cc
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index f659cea157c139afea25f84c98e2dea825b2c3bb..2ad80e861741b8eac284c209609de6e57c77c310 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -75,6 +75,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)
@@ -551,6 +557,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;
}
@@ -844,4 +859,10 @@ bool GetBoolValueForFlagWithDefault(const std::string& flag,
return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
}
+bool ShouldUseAltInstantURL() {
+ FieldTrialFlags flags;
+ return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
+ kUseAltInstantURL, false, flags);
+}
+
} // namespace chrome
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698