Commit 89f2b714 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Chromium LUCI CQ

[ntp] Add flag to disable the middle slot promo

Makes the middle slot promo Finch-configurable. Flag is enabled by
default.

Bug: 1166869
Change-Id: If6d4e06577f99b635f04fbe406334b66f62210b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638934
Commit-Queue: Esmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Auto-Submit: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845381}
parent b7ecc344
......@@ -94,7 +94,9 @@
--tile-hover-color: rgba(255, 255, 255, .1);
}
ntp-middle-slot-promo:not([hidden]) + ntp-module-wrapper,
/* ~ because the dom-if results in a template between the middle-slot-promo
and the first ntp-module-wrapper. */
ntp-middle-slot-promo:not([hidden]) ~ ntp-module-wrapper,
ntp-module-wrapper + ntp-module-wrapper {
margin-top: 16px;
}
......@@ -266,9 +268,11 @@
use-title-pill$="[[theme_.shortcutUseTitlePill]]">
</ntp-most-visited>
</template>
<ntp-middle-slot-promo
on-ntp-middle-slot-promo-loaded="onMiddleSlotPromoLoaded_">
</ntp-middle-slot-promo>
<template is="dom-if" if="[[middleSlotPromoEnabled_]]">
<ntp-middle-slot-promo
on-ntp-middle-slot-promo-loaded="onMiddleSlotPromoLoaded_">
</ntp-middle-slot-promo>
</template>
<template is="dom-repeat" items="[[moduleDescriptors_]]" id="modules"
on-dom-change="onModulesLoaded_">
<ntp-module-wrapper descriptor="[[item]]"
......
......@@ -196,6 +196,12 @@ class AppElement extends PolymerElement {
value: () => loadTimeData.getBoolean('shortcutsEnabled'),
},
/** @private */
middleSlotPromoEnabled_: {
type: Boolean,
value: () => loadTimeData.getBoolean('middleSlotPromoEnabled'),
},
/** @private */
modulesEnabled_: {
type: Boolean,
......@@ -517,7 +523,8 @@ class AppElement extends PolymerElement {
* @private
*/
computePromoAndModulesLoaded_() {
return this.middleSlotPromoLoaded_ &&
return (!loadTimeData.getBoolean('middleSlotPromoEnabled') ||
this.middleSlotPromoLoaded_) &&
(!loadTimeData.getBoolean('modulesEnabled') || this.modulesLoaded_);
}
......
......@@ -100,6 +100,9 @@ content::WebUIDataSource* CreateNewTabPageUiHtmlSource(Profile* profile) {
base::FeatureList::IsEnabled(ntp_features::kWebUIThemeModeDoodles));
source->AddBoolean("shortcutsEnabled",
base::FeatureList::IsEnabled(ntp_features::kNtpShortcuts));
source->AddBoolean(
"middleSlotPromoEnabled",
base::FeatureList::IsEnabled(ntp_features::kNtpMiddleSlotPromo));
source->AddBoolean("modulesEnabled",
base::FeatureList::IsEnabled(ntp_features::kModules));
source->AddInteger("modulesLoadTimeout",
......
......@@ -79,6 +79,10 @@ const base::Feature kWebUIThemeModeDoodles{"WebUIThemeModeDoodles",
const base::Feature kNtpShortcuts{"NtpShortcuts",
base::FEATURE_ENABLED_BY_DEFAULT};
// If enabled, middle slot promo will be shown.
const base::Feature kNtpMiddleSlotPromo{"NtpMiddleSlotPromo",
base::FEATURE_ENABLED_BY_DEFAULT};
// If enabled, modules will be shown.
const base::Feature kModules{"NtpModules", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -27,6 +27,7 @@ extern const base::Feature kRealboxUseGoogleGIcon;
extern const base::Feature kWebUI;
extern const base::Feature kWebUIThemeModeDoodles;
extern const base::Feature kNtpShortcuts;
extern const base::Feature kNtpMiddleSlotPromo;
extern const base::Feature kModules;
extern const base::Feature kNtpRecipeTasksModule;
extern const base::Feature kNtpShoppingTasksModule;
......
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