Commit 170e86c4 authored by Cathy Li's avatar Cathy Li Committed by Commit Bot

[Explore sites] Add new feature parameter for personalization

Bug: 918436
Change-Id: I5311199b6dff15400d36308c35dbf7aa9469be98
Reviewed-on: https://chromium-review.googlesource.com/c/1392501
Commit-Queue: Cathy Li <chili@chromium.org>
Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619707}
parent 95e86e46
......@@ -238,12 +238,20 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
mSiteSectionViewHolder = SiteSection.createViewHolder(getSiteSectionView(), mUiConfig);
mSiteSectionViewHolder.bindDataSource(mTileGroup, tileRenderer);
if (ExploreSitesBridge.getVariation() == ExploreSitesVariation.ENABLED) {
mExploreSection = new ExploreSitesSection(mExploreSectionView, profile,
mManager.getNavigationDelegate(), SuggestionsConfig.getTileStyle(mUiConfig));
} else if (ExploreSitesBridge.getVariation() == ExploreSitesVariation.EXPERIMENT) {
mExploreSection = new ExperimentalExploreSitesSection(
mExploreSectionView, profile, mManager.getNavigationDelegate());
int variation = ExploreSitesBridge.getVariation();
switch (variation) {
case ExploreSitesVariation.ENABLED: // fall-through
case ExploreSitesVariation.PERSONALIZED:
mExploreSection = new ExploreSitesSection(mExploreSectionView, profile,
mManager.getNavigationDelegate(),
SuggestionsConfig.getTileStyle(mUiConfig));
break;
case ExploreSitesVariation.EXPERIMENT:
mExploreSection = new ExperimentalExploreSitesSection(
mExploreSectionView, profile, mManager.getNavigationDelegate());
break;
case ExploreSitesVariation.DISABLED: // fall-through
default: // do nothing.
}
mSearchProviderLogoView = findViewById(R.id.search_provider_logo);
......
......@@ -1118,8 +1118,12 @@ const FeatureEntry::FeatureVariation kNewNetErrorPageUIVariations[] = {
const FeatureEntry::FeatureParam kExploreSitesExperimental = {
chrome::android::explore_sites::kExploreSitesVariationParameterName,
chrome::android::explore_sites::kExploreSitesVariationExperimental};
const FeatureEntry::FeatureParam kExploreSitesPersonalized = {
chrome::android::explore_sites::kExploreSitesVariationParameterName,
chrome::android::explore_sites::kExploreSitesVariationPersonalized};
const FeatureEntry::FeatureVariation kExploreSitesVariations[] = {
{"Experimental", &kExploreSitesExperimental, 1, nullptr}};
{"Experimental", &kExploreSitesExperimental, 1, nullptr},
{"Personalized", &kExploreSitesPersonalized, 1, nullptr}};
#endif // defined(OS_ANDROID)
const FeatureEntry::FeatureParam
......
......@@ -15,6 +15,7 @@ namespace explore_sites {
const char kExploreSitesVariationParameterName[] = "variation";
const char kExploreSitesVariationExperimental[] = "experiment";
const char kExploreSitesVariationPersonalized[] = "personalized";
ExploreSitesVariation GetExploreSitesVariation() {
if (base::FeatureList::IsEnabled(kExploreSites)) {
......@@ -23,6 +24,11 @@ ExploreSitesVariation GetExploreSitesVariation() {
kExploreSitesVariationExperimental) {
return ExploreSitesVariation::EXPERIMENT;
}
if (base::GetFieldTrialParamValueByFeature(
kExploreSites, kExploreSitesVariationParameterName) ==
kExploreSitesVariationPersonalized) {
return ExploreSitesVariation::PERSONALIZED;
}
return ExploreSitesVariation::ENABLED;
}
return ExploreSitesVariation::DISABLED;
......
......@@ -12,10 +12,16 @@ namespace explore_sites {
extern const char kExploreSitesVariationParameterName[];
extern const char kExploreSitesVariationExperimental[];
extern const char kExploreSitesVariationPersonalized[];
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.explore_sites
enum class ExploreSitesVariation { ENABLED, EXPERIMENT, DISABLED };
enum class ExploreSitesVariation {
ENABLED,
EXPERIMENT,
PERSONALIZED,
DISABLED
};
ExploreSitesVariation GetExploreSitesVariation();
......
......@@ -26,6 +26,8 @@ std::string GetChromeFlagsSetupString() {
return "Enabled";
case ExploreSitesVariation::EXPERIMENT:
return "Experiment";
case ExploreSitesVariation::PERSONALIZED:
return "Personalized";
case ExploreSitesVariation::DISABLED:
return "Disabled";
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment