Commit d21f9152 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

Fix missing filenames on relaunched panels

Closing and reopening File Manager with progress operations continuing
lost the text displayed on the feedback panels.

Add storage of the source and destination file/directory strings to the
background page to enable display when a new File Manager window is
created.

Needs test.

Bug: 988137, 994954
Change-Id: I3a473a1512ab0d13f5694c18b2d0765a52a900f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1828723
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701885}
parent 22773f51
...@@ -63,6 +63,9 @@ class FileOperationHandler { ...@@ -63,6 +63,9 @@ class FileOperationHandler {
item.id = event.taskId; item.id = event.taskId;
item.type = FileOperationHandler.getType_(event.status.operationType); item.type = FileOperationHandler.getType_(event.status.operationType);
item.message = FileOperationHandler.getMessage_(event); item.message = FileOperationHandler.getMessage_(event);
item.itemCount = event.status.numRemainingItems;
item.sourceMessage = event.status.processingEntryName;
item.destinationMessage = event.status.targetDirEntryName;
item.progressMax = event.status.totalBytes; item.progressMax = event.status.totalBytes;
item.progressValue = event.status.processedBytes; item.progressValue = event.status.processedBytes;
item.cancelCallback = this.fileOperationManager_.requestTaskCancel.bind( item.cancelCallback = this.fileOperationManager_.requestTaskCancel.bind(
......
...@@ -645,7 +645,8 @@ fileOperationUtil.Task = class { ...@@ -645,7 +645,8 @@ fileOperationUtil.Task = class {
numRemainingItems: this.numRemainingItems, numRemainingItems: this.numRemainingItems,
totalBytes: this.totalBytes, totalBytes: this.totalBytes,
processedBytes: this.processedBytes, processedBytes: this.processedBytes,
processingEntryName: processingEntry ? processingEntry.name : '' processingEntryName: processingEntry ? processingEntry.name : '',
targetDirEntryName: this.targetDirEntry.name
}; };
} }
......
...@@ -87,13 +87,6 @@ class ProgressCenterItem { ...@@ -87,13 +87,6 @@ class ProgressCenterItem {
*/ */
this.destinationMessage = ''; this.destinationMessage = '';
/**
* Optional sub message for the progress item.
* TODO(crbug.com/947388) get rid of the subMessage field.
* @type {string}
*/
this.subMessage = '';
/** /**
* Number of items being processed. * Number of items being processed.
* @type {number} * @type {number}
...@@ -189,19 +182,12 @@ class ProgressCenterItem { ...@@ -189,19 +182,12 @@ class ProgressCenterItem {
/** /**
* Clones the item. * Clones the item.
* @return {ProgressCenterItem} New item having the same properties with this. * TODO(adanilo) This is used by ProgressCenterItemGroup only, remove when
* VS feedback panels are turned on permanently.
* @return {!ProgressCenterItem} New item having the same properties as this.
*/ */
clone() { clone() {
const newItem = new ProgressCenterItem(); const clonedItem = Object.assign(new ProgressCenterItem(), this);
newItem.id = this.id; return /** @type {!ProgressCenterItem} */ (clonedItem);
newItem.state = this.state;
newItem.message = this.message;
newItem.progressMax = this.progressMax;
newItem.progressValue = this.progressValue;
newItem.type = this.type;
newItem.single = this.single;
newItem.quiet = this.quiet;
newItem.cancelCallback = this.cancelCallback;
return newItem;
} }
} }
...@@ -547,8 +547,6 @@ class FileTransferController { ...@@ -547,8 +547,6 @@ class FileTransferController {
const destinationName = util.getEntryLabel( const destinationName = util.getEntryLabel(
destinationLocationInfo, destinationEntry); destinationLocationInfo, destinationEntry);
item.destinationMessage = destinationName; item.destinationMessage = destinationName;
item.subMessage =
strf('TO_FOLDER_NAME', item.destinationMessage);
this.progressCenter_.updateItem(item); this.progressCenter_.updateItem(item);
// Start the pasting operation. // Start the pasting operation.
......
...@@ -420,8 +420,10 @@ class ProgressCenterPanel { ...@@ -420,8 +420,10 @@ class ProgressCenterPanel {
this.generateSourceString_(item, panelItem.userData); this.generateSourceString_(item, panelItem.userData);
panelItem.setAttribute('primary-text', primaryText); panelItem.setAttribute('primary-text', primaryText);
panelItem.setAttribute('data-progress-id', item.id); panelItem.setAttribute('data-progress-id', item.id);
if (item.subMessage) { if (item.destinationMessage) {
panelItem.setAttribute('secondary-text', item.subMessage); panelItem.setAttribute(
'secondary-text',
strf('TO_FOLDER_NAME', item.destinationMessage));
} }
// On progress panels, make the cancel button aria-lable more useful. // On progress panels, make the cancel button aria-lable more useful.
const cancelLabel = strf('CANCEL_ACTIVITY_LABEL', primaryText); const cancelLabel = strf('CANCEL_ACTIVITY_LABEL', primaryText);
......
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