Commit 63e60485 authored by Alex Danilo's avatar Alex Danilo Committed by Chromium LUCI CQ

[files-progress] Remove util function

When files transfer progress details was managed by a feature flag,
there was a run-time support function called isTransferDetailsEnabled().

Remove the utility function and all references to it.

Remove the now obsolete function generateDestinationString_().

Bug: 953308
Change-Id: Ia011cba72621187d3c5e74af25ec5cb32789482f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600427
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839062}
parent 37a55497
...@@ -1483,14 +1483,6 @@ util.isZipUnpackEnabled = () => { ...@@ -1483,14 +1483,6 @@ util.isZipUnpackEnabled = () => {
return loadTimeData.getBoolean('ZIP_UNPACK'); return loadTimeData.getBoolean('ZIP_UNPACK');
}; };
/**
* Returns true if transfer details flag is enabled.
* @return {boolean}
*/
util.isTransferDetailsEnabled = () => {
return true;
};
/** /**
* Returns true if FilesSinglePartitionFormat flag is enabled. * Returns true if FilesSinglePartitionFormat flag is enabled.
* @return {boolean} * @return {boolean}
......
...@@ -33,11 +33,6 @@ export function setUp() { ...@@ -33,11 +33,6 @@ export function setUp() {
loadTimeData.getString = id => { loadTimeData.getString = id => {
return loadTimeData.data_[id] || id; return loadTimeData.data_[id] || id;
}; };
/** @return {boolean} */
window.isTransferDetailsEnabled = () => {
return enableFilesTransferDetails;
};
} }
export function tearDown() { export function tearDown() {
......
...@@ -311,11 +311,10 @@ ...@@ -311,11 +311,10 @@
if (button) { if (button) {
button.removeEventListener('click', this.toggleSummary); button.removeEventListener('click', this.toggleSummary);
} }
if (util.isTransferDetailsEnabled()) { // For transfer summary details.
const textDiv = summaryPanel.textDiv; const textDiv = summaryPanel.textDiv;
if (textDiv) { if (textDiv) {
textDiv.removeEventListener('click', this.toggleSummary); textDiv.removeEventListener('click', this.toggleSummary);
}
} }
summaryPanel.remove(); summaryPanel.remove();
this.panels_.hidden = false; this.panels_.hidden = false;
...@@ -328,20 +327,16 @@ ...@@ -328,20 +327,16 @@
summaryPanel = document.createElement('xf-panel-item'); summaryPanel = document.createElement('xf-panel-item');
summaryPanel.setAttribute('panel-type', 1); summaryPanel.setAttribute('panel-type', 1);
summaryPanel.id = 'summary-panel'; summaryPanel.id = 'summary-panel';
if (util.isTransferDetailsEnabled()) { summaryPanel.setAttribute('detailed-summary', '');
summaryPanel.setAttribute('detailed-summary', '');
}
const button = summaryPanel.primaryButton; const button = summaryPanel.primaryButton;
if (button) { if (button) {
button.parent = this; button.parent = this;
button.addEventListener('click', this.toggleSummary); button.addEventListener('click', this.toggleSummary);
} }
if (util.isTransferDetailsEnabled()) { const textDiv = summaryPanel.textDiv;
const textDiv = summaryPanel.textDiv; if (textDiv) {
if (textDiv) { textDiv.parent = this;
textDiv.parent = this; textDiv.addEventListener('click', this.toggleSummary);
textDiv.addEventListener('click', this.toggleSummary);
}
} }
summaryHost.appendChild(summaryPanel); summaryHost.appendChild(summaryPanel);
// Setup the panels based on expand/collapse state of the summary panel. // Setup the panels based on expand/collapse state of the summary panel.
...@@ -374,9 +369,7 @@ ...@@ -374,9 +369,7 @@
panel.setAttribute('indicator', 'progress'); panel.setAttribute('indicator', 'progress');
this.items_.push(/** @type {!PanelItem} */ (panel)); this.items_.push(/** @type {!PanelItem} */ (panel));
this.setAriaHidden_(); this.setAriaHidden_();
if (util.isTransferDetailsEnabled()) { this.setAttribute('detailed-panel', 'detailed-panel');
this.setAttribute('detailed-panel', 'detailed-panel');
}
return /** @type {!PanelItem} */ (panel); return /** @type {!PanelItem} */ (panel);
} }
......
...@@ -259,9 +259,7 @@ ...@@ -259,9 +259,7 @@
* @private * @private
*/ */
setPanelType(type) { setPanelType(type) {
if (util.isTransferDetailsEnabled()) { this.setAttribute('detailed-panel', 'detailed-panel');
this.setAttribute('detailed-panel', 'detailed-panel');
}
if (this.panelType_ === type) { if (this.panelType_ === type) {
return; return;
......
...@@ -100,45 +100,6 @@ class ProgressCenterPanel { ...@@ -100,45 +100,6 @@ class ProgressCenterPanel {
return true; return true;
} }
/**
* Generate destination string for display on the feedback panel.
* @param {!ProgressCenterItem} item Item we're generating a message for.
* @param {Object} info Cached information to use for formatting.
* @return {string} String formatted based on the item state.
*/
generateDestinationString_(item, info) {
const hasDestination = this.isNonEmptyString_(info['destination']);
switch (item.state) {
case 'progressing':
if (hasDestination) {
return strf('TO_FOLDER_NAME', info['destination']);
}
break;
case 'completed':
if (item.type === ProgressItemType.COPY) {
if (hasDestination) {
return strf('COPIED_TO', info['destination']);
} else {
return str('COPIED');
}
} else if (item.type === ProgressItemType.MOVE) {
if (hasDestination) {
return strf('MOVED_TO', info['destination']);
} else {
return str('MOVED');
}
}
break;
case 'error':
case 'canceled':
break;
default:
assertNotReached();
break;
}
return '';
}
/** /**
* Generate primary text string for display on the feedback panel. * Generate primary text string for display on the feedback panel.
* It is used for TransferDetails mode. * It is used for TransferDetails mode.
...@@ -284,17 +245,8 @@ class ProgressCenterPanel { ...@@ -284,17 +245,8 @@ class ProgressCenterPanel {
}; };
} }
let primaryText, secondaryText; const primaryText = this.generatePrimaryString_(item, panelItem.userData);
if (util.isTransferDetailsEnabled()) { panelItem.secondaryText = this.generateRemainingTimeMessage(item);
primaryText = this.generatePrimaryString_(item, panelItem.userData);
panelItem.secondaryText = this.generateRemainingTimeMessage(item);
} else {
primaryText = this.generateSourceString_(item, panelItem.userData);
if (item.destinationMessage) {
panelItem.secondaryText =
strf('TO_FOLDER_NAME', item.destinationMessage);
}
}
panelItem.primaryText = primaryText; panelItem.primaryText = primaryText;
panelItem.setAttribute('data-progress-id', item.id); panelItem.setAttribute('data-progress-id', item.id);
...@@ -321,12 +273,7 @@ class ProgressCenterPanel { ...@@ -321,12 +273,7 @@ class ProgressCenterPanel {
donePanelItem.id = item.id; donePanelItem.id = item.id;
donePanelItem.panelType = donePanelItem.panelTypeDone; donePanelItem.panelType = donePanelItem.panelTypeDone;
donePanelItem.primaryText = primaryText; donePanelItem.primaryText = primaryText;
if (util.isTransferDetailsEnabled()) { donePanelItem.secondaryText = str('COMPLETE_LABEL');
donePanelItem.secondaryText = str('COMPLETE_LABEL');
} else {
donePanelItem.secondaryText =
this.generateDestinationString_(item, panelItem.userData);
}
donePanelItem.signalCallback = (signal) => { donePanelItem.signalCallback = (signal) => {
if (signal === 'dismiss') { if (signal === 'dismiss') {
this.feedbackHost_.removePanelItem(donePanelItem); this.feedbackHost_.removePanelItem(donePanelItem);
......
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