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 ...@@ -238,12 +238,20 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
mSiteSectionViewHolder = SiteSection.createViewHolder(getSiteSectionView(), mUiConfig); mSiteSectionViewHolder = SiteSection.createViewHolder(getSiteSectionView(), mUiConfig);
mSiteSectionViewHolder.bindDataSource(mTileGroup, tileRenderer); mSiteSectionViewHolder.bindDataSource(mTileGroup, tileRenderer);
if (ExploreSitesBridge.getVariation() == ExploreSitesVariation.ENABLED) { int variation = ExploreSitesBridge.getVariation();
mExploreSection = new ExploreSitesSection(mExploreSectionView, profile, switch (variation) {
mManager.getNavigationDelegate(), SuggestionsConfig.getTileStyle(mUiConfig)); case ExploreSitesVariation.ENABLED: // fall-through
} else if (ExploreSitesBridge.getVariation() == ExploreSitesVariation.EXPERIMENT) { case ExploreSitesVariation.PERSONALIZED:
mExploreSection = new ExperimentalExploreSitesSection( mExploreSection = new ExploreSitesSection(mExploreSectionView, profile,
mExploreSectionView, profile, mManager.getNavigationDelegate()); 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); mSearchProviderLogoView = findViewById(R.id.search_provider_logo);
......
...@@ -1118,8 +1118,12 @@ const FeatureEntry::FeatureVariation kNewNetErrorPageUIVariations[] = { ...@@ -1118,8 +1118,12 @@ const FeatureEntry::FeatureVariation kNewNetErrorPageUIVariations[] = {
const FeatureEntry::FeatureParam kExploreSitesExperimental = { const FeatureEntry::FeatureParam kExploreSitesExperimental = {
chrome::android::explore_sites::kExploreSitesVariationParameterName, chrome::android::explore_sites::kExploreSitesVariationParameterName,
chrome::android::explore_sites::kExploreSitesVariationExperimental}; chrome::android::explore_sites::kExploreSitesVariationExperimental};
const FeatureEntry::FeatureParam kExploreSitesPersonalized = {
chrome::android::explore_sites::kExploreSitesVariationParameterName,
chrome::android::explore_sites::kExploreSitesVariationPersonalized};
const FeatureEntry::FeatureVariation kExploreSitesVariations[] = { const FeatureEntry::FeatureVariation kExploreSitesVariations[] = {
{"Experimental", &kExploreSitesExperimental, 1, nullptr}}; {"Experimental", &kExploreSitesExperimental, 1, nullptr},
{"Personalized", &kExploreSitesPersonalized, 1, nullptr}};
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
const FeatureEntry::FeatureParam const FeatureEntry::FeatureParam
......
...@@ -15,6 +15,7 @@ namespace explore_sites { ...@@ -15,6 +15,7 @@ namespace explore_sites {
const char kExploreSitesVariationParameterName[] = "variation"; const char kExploreSitesVariationParameterName[] = "variation";
const char kExploreSitesVariationExperimental[] = "experiment"; const char kExploreSitesVariationExperimental[] = "experiment";
const char kExploreSitesVariationPersonalized[] = "personalized";
ExploreSitesVariation GetExploreSitesVariation() { ExploreSitesVariation GetExploreSitesVariation() {
if (base::FeatureList::IsEnabled(kExploreSites)) { if (base::FeatureList::IsEnabled(kExploreSites)) {
...@@ -23,6 +24,11 @@ ExploreSitesVariation GetExploreSitesVariation() { ...@@ -23,6 +24,11 @@ ExploreSitesVariation GetExploreSitesVariation() {
kExploreSitesVariationExperimental) { kExploreSitesVariationExperimental) {
return ExploreSitesVariation::EXPERIMENT; return ExploreSitesVariation::EXPERIMENT;
} }
if (base::GetFieldTrialParamValueByFeature(
kExploreSites, kExploreSitesVariationParameterName) ==
kExploreSitesVariationPersonalized) {
return ExploreSitesVariation::PERSONALIZED;
}
return ExploreSitesVariation::ENABLED; return ExploreSitesVariation::ENABLED;
} }
return ExploreSitesVariation::DISABLED; return ExploreSitesVariation::DISABLED;
......
...@@ -12,10 +12,16 @@ namespace explore_sites { ...@@ -12,10 +12,16 @@ namespace explore_sites {
extern const char kExploreSitesVariationParameterName[]; extern const char kExploreSitesVariationParameterName[];
extern const char kExploreSitesVariationExperimental[]; extern const char kExploreSitesVariationExperimental[];
extern const char kExploreSitesVariationPersonalized[];
// A Java counterpart will be generated for this enum. // A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.explore_sites // 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(); ExploreSitesVariation GetExploreSitesVariation();
......
...@@ -26,6 +26,8 @@ std::string GetChromeFlagsSetupString() { ...@@ -26,6 +26,8 @@ std::string GetChromeFlagsSetupString() {
return "Enabled"; return "Enabled";
case ExploreSitesVariation::EXPERIMENT: case ExploreSitesVariation::EXPERIMENT:
return "Experiment"; return "Experiment";
case ExploreSitesVariation::PERSONALIZED:
return "Personalized";
case ExploreSitesVariation::DISABLED: case ExploreSitesVariation::DISABLED:
return "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