Commit 0bda49b6 authored by Regan Hsu's avatar Regan Hsu Committed by Commit Bot

[DlcSettingsUi] Default feature flag to on, and remove fake dlc results.

Fixed: 1070712
Change-Id: I7f3fc2c906112d615f22b8298f093cd6c02277f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225482
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774286}
parent 17a568b6
...@@ -7,48 +7,6 @@ ...@@ -7,48 +7,6 @@
* 'os-settings-dlc-subpage' is the Downloaded Content subpage. * 'os-settings-dlc-subpage' is the Downloaded Content subpage.
*/ */
cr.define('settings', function() { cr.define('settings', function() {
/**
* TODO(hsuregan): Delete when DLC subpage is finished.
* Whether to fetch fake DLC list.
* @type {boolean}
*/
const USE_FAKE_DLC_LIST = true;
/**
* TODO(hsuregan): Delete when DLC subpage is finished.
* Fake function to simulate async DevicePageBrowserProxy getDlcList().
* @return {!Promise<!Array<!settings.DlcMetadata>>} A list of DLC metadata.
*/
function getFakeDlcList() {
/**
* @param {number} max The upper bound integer.
* @return {number} A random in the range [0, max).
*/
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
const fakeRandomResults =
[...Array(getRandomInt(getRandomInt(40))).keys()].map((idx) => {
const dlcDescription = getRandomInt(2) ?
`fake description ${idx} `.repeat(getRandomInt(500)) :
'';
return {
id: `fake id ${idx}`,
name: `fake name ${idx}`,
description: dlcDescription,
diskUsageLabel: `fake diskUsageLabel`,
};
});
console.log(fakeRandomResults);
return new Promise(resolve => {
setTimeout(() => {
resolve(fakeRandomResults);
}, 0);
});
}
Polymer({ Polymer({
is: 'os-settings-dlc-subpage', is: 'os-settings-dlc-subpage',
...@@ -77,11 +35,6 @@ cr.define('settings', function() { ...@@ -77,11 +35,6 @@ cr.define('settings', function() {
/** @override */ /** @override */
attached() { attached() {
if (USE_FAKE_DLC_LIST) {
getFakeDlcList().then(this.onDlcListChanged_.bind(this));
return;
}
this.addWebUIListener( this.addWebUIListener(
'dlc-list-changed', this.onDlcListChanged_.bind(this)); 'dlc-list-changed', this.onDlcListChanged_.bind(this));
this.browserProxy_.notifyDlcSubpageReady(); this.browserProxy_.notifyDlcSubpageReady();
......
...@@ -765,9 +765,10 @@ DeviceSection::DeviceSection(Profile* profile, ...@@ -765,9 +765,10 @@ DeviceSection::DeviceSection(Profile* profile,
} }
// DLC settings search tags are added/removed dynamically. // DLC settings search tags are added/removed dynamically.
if (features::ShouldShowDlcSettings()) { DlcserviceClient* dlcservice_client = DlcserviceClient::Get();
DlcserviceClient::Get()->AddObserver(this); if (features::ShouldShowDlcSettings() && dlcservice_client) {
DlcserviceClient::Get()->GetExistingDlcs(base::BindOnce( dlcservice_client->AddObserver(this);
dlcservice_client->GetExistingDlcs(base::BindOnce(
&DeviceSection::OnGetExistingDlcs, weak_ptr_factory_.GetWeakPtr())); &DeviceSection::OnGetExistingDlcs, weak_ptr_factory_.GetWeakPtr()));
} }
} }
...@@ -785,8 +786,9 @@ DeviceSection::~DeviceSection() { ...@@ -785,8 +786,9 @@ DeviceSection::~DeviceSection() {
if (night_light_controller) if (night_light_controller)
night_light_controller->RemoveObserver(this); night_light_controller->RemoveObserver(this);
if (features::ShouldShowDlcSettings()) DlcserviceClient* dlcservice_client = DlcserviceClient::Get();
DlcserviceClient::Get()->RemoveObserver(this); if (features::ShouldShowDlcSettings() && dlcservice_client)
dlcservice_client->RemoveObserver(this);
} }
void DeviceSection::AddLoadTimeData(content::WebUIDataSource* html_source) { void DeviceSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
......
...@@ -157,7 +157,7 @@ const base::Feature kDriveFsMirroring{"DriveFsMirroring", ...@@ -157,7 +157,7 @@ const base::Feature kDriveFsMirroring{"DriveFsMirroring",
// Enables the DLC Settings subpage in Device section of OS Settings. // Enables the DLC Settings subpage in Device section of OS Settings.
const base::Feature kDlcSettingsUi{"DlcSettingsUi", const base::Feature kDlcSettingsUi{"DlcSettingsUi",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
// If enabled, allows Unicorn users to add secondary EDU accounts. // If enabled, allows Unicorn users to add secondary EDU accounts.
const base::Feature kEduCoexistence{"EduCoexistence", const base::Feature kEduCoexistence{"EduCoexistence",
......
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