Commit 57c04cd6 authored by Alex Danilo's avatar Alex Danilo Committed by Chromium LUCI CQ

[progress center] Remove progress center groups

Progress center groups are not used, remove the code.

Move ProgressCenterItem array to progress_center_panel.js to replace
the equivalent from progress_center_item_group.js

Bug: 1027012
Change-Id: I7e9584aa8992ca0ece616bc7a046fb2da50f69a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568919
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832712}
parent 6a563da4
...@@ -221,10 +221,6 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, NavigationListModelTest) { ...@@ -221,10 +221,6 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, NavigationListModelTest) {
RunTestURL("foreground/js/navigation_list_model_unittest_gen.html"); RunTestURL("foreground/js/navigation_list_model_unittest_gen.html");
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProgressCenterItemGroupTest) {
RunTestURL("foreground/js/progress_center_item_group_unittest_gen.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProvidersModel) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProvidersModel) {
RunTestURL("foreground/js/providers_model_unittest_gen.html"); RunTestURL("foreground/js/providers_model_unittest_gen.html");
} }
......
...@@ -71,7 +71,6 @@ js_type_check("closure_compile_module") { ...@@ -71,7 +71,6 @@ js_type_check("closure_compile_module") {
":navigation_list_model", ":navigation_list_model",
":navigation_uma", ":navigation_uma",
":path_component", ":path_component",
":progress_center_item_group",
":providers_model", ":providers_model",
":quick_view_controller", ":quick_view_controller",
":quick_view_model", ":quick_view_model",
...@@ -700,20 +699,6 @@ js_library("path_component") { ...@@ -700,20 +699,6 @@ js_library("path_component") {
deps = [ "//ui/file_manager/base/js:volume_manager_types" ] deps = [ "//ui/file_manager/base/js:volume_manager_types" ]
} }
js_library("progress_center_item_group") {
deps = [
"//ui/file_manager/file_manager/common/js:progress_center_common",
"//ui/file_manager/file_manager/common/js:util",
]
}
js_unittest("progress_center_item_group_unittest") {
deps = [
":progress_center_item_group",
"//ui/file_manager/base/js:test_error_reporting",
]
}
js_library("providers_model") { js_library("providers_model") {
deps = [ "//ui/webui/resources/js:assert" ] deps = [ "//ui/webui/resources/js:assert" ]
} }
...@@ -914,7 +899,6 @@ js_test_gen_html("js_test_gen_html") { ...@@ -914,7 +899,6 @@ js_test_gen_html("js_test_gen_html") {
":import_controller_unittest", ":import_controller_unittest",
":list_thumbnail_loader_unittest", ":list_thumbnail_loader_unittest",
":navigation_list_model_unittest", ":navigation_list_model_unittest",
":progress_center_item_group_unittest",
":providers_model_unittest", ":providers_model_unittest",
":spinner_controller_unittest", ":spinner_controller_unittest",
":task_controller_unittest", ":task_controller_unittest",
......
...@@ -147,7 +147,6 @@ ...@@ -147,7 +147,6 @@
// <include src="navigation_list_model.js"> // <include src="navigation_list_model.js">
// <include src="navigation_uma.js"> // <include src="navigation_uma.js">
// <include src="path_component.js"> // <include src="path_component.js">
// <include src="progress_center_item_group.js">
// <include src="quick_view_controller.js"> // <include src="quick_view_controller.js">
// <include src="quick_view_model.js"> // <include src="quick_view_model.js">
// <include src="quick_view_uma.js"> // <include src="quick_view_uma.js">
......
...@@ -476,10 +476,7 @@ js_library("progress_center_panel") { ...@@ -476,10 +476,7 @@ js_library("progress_center_panel") {
# The progress_center on the background page maintains a list of panels. # The progress_center on the background page maintains a list of panels.
visibility += [ "//ui/file_manager/file_manager/background/*" ] visibility += [ "//ui/file_manager/file_manager/background/*" ]
deps = [ deps = [ "//ui/file_manager/file_manager/common/js:progress_center_common" ]
"//ui/file_manager/file_manager/common/js:progress_center_common",
"//ui/file_manager/file_manager/foreground/js:progress_center_item_group",
]
externs_list = [ "//ui/file_manager/externs/progress_center_panel.js" ] externs_list = [ "//ui/file_manager/externs/progress_center_panel.js" ]
} }
......
...@@ -15,18 +15,11 @@ class ProgressCenterPanel { ...@@ -15,18 +15,11 @@ class ProgressCenterPanel {
this.feedbackHost_ = document.querySelector('#progress-panel'); this.feedbackHost_ = document.querySelector('#progress-panel');
/** /**
* Item group for normal priority items. * Items that are progressing, or completed.
* @type {ProgressCenterItemGroup} * Key is item ID.
* @private * @private {!Object<ProgressCenterItem>}
*/ */
this.normalItemGroup_ = new ProgressCenterItemGroup('normal', false); this.items_ = {};
/**
* Item group for low priority items.
* @type {ProgressCenterItemGroup}
* @private
*/
this.quietItemGroup_ = new ProgressCenterItemGroup('quiet', true);
/** /**
* Callback to be called with the ID of the progress item when the cancel * Callback to be called with the ID of the progress item when the cancel
...@@ -325,6 +318,7 @@ class ProgressCenterPanel { ...@@ -325,6 +318,7 @@ class ProgressCenterPanel {
if (item.type === 'copy' || item.type === 'move' || if (item.type === 'copy' || item.type === 'move' ||
item.type === 'format') { item.type === 'format') {
const donePanelItem = this.feedbackHost_.addPanelItem(item.id); const donePanelItem = this.feedbackHost_.addPanelItem(item.id);
donePanelItem.id = item.id;
donePanelItem.panelType = donePanelItem.panelTypeDone; donePanelItem.panelType = donePanelItem.panelTypeDone;
donePanelItem.primaryText = primaryText; donePanelItem.primaryText = primaryText;
if (util.isTransferDetailsEnabled()) { if (util.isTransferDetailsEnabled()) {
...@@ -336,12 +330,14 @@ class ProgressCenterPanel { ...@@ -336,12 +330,14 @@ class ProgressCenterPanel {
donePanelItem.signalCallback = (signal) => { donePanelItem.signalCallback = (signal) => {
if (signal === 'dismiss') { if (signal === 'dismiss') {
this.feedbackHost_.removePanelItem(donePanelItem); this.feedbackHost_.removePanelItem(donePanelItem);
delete this.items_[donePanelItem.id];
} }
}; };
// Delete after 4 seconds, doesn't matter if it's manually deleted // Delete after 4 seconds, doesn't matter if it's manually deleted
// before the timer fires, as removePanelItem handles that case. // before the timer fires, as removePanelItem handles that case.
setTimeout(() => { setTimeout(() => {
this.feedbackHost_.removePanelItem(donePanelItem); this.feedbackHost_.removePanelItem(donePanelItem);
delete this.items_[donePanelItem.id];
}, 4000); }, 4000);
} }
// Drop through to remove the progress panel. // Drop through to remove the progress panel.
...@@ -362,38 +358,59 @@ class ProgressCenterPanel { ...@@ -362,38 +358,59 @@ class ProgressCenterPanel {
} }
} }
/**
* Starts the item update and checks state changes.
* @param {!ProgressCenterItem} item Item containing updated information.
*/
updateItemState_(item) {
// Compares the current state and the new state to check if the update is
// valid or not.
const previousItem = this.items_[item.id];
switch (item.state) {
case ProgressItemState.ERROR:
if (previousItem &&
previousItem.state !== ProgressItemState.PROGRESSING) {
return;
}
this.items_[item.id] = item.clone();
break;
case ProgressItemState.PROGRESSING:
case ProgressItemState.COMPLETED:
if ((!previousItem && item.state === ProgressItemState.COMPLETED) ||
(previousItem &&
previousItem.state !== ProgressItemState.PROGRESSING)) {
return;
}
this.items_[item.id] = item.clone();
break;
case ProgressItemState.CANCELED:
if (!previousItem ||
previousItem.state !== ProgressItemState.PROGRESSING) {
return;
}
delete this.items_[item.id];
}
}
/** /**
* Updates an item to the progress center panel. * Updates an item to the progress center panel.
* @param {!ProgressCenterItem} item Item including new contents. * @param {!ProgressCenterItem} item Item including new contents.
*/ */
updateItem(item) { updateItem(item) {
const targetGroup = this.getGroupForItem_(item); this.updateItemState_(item);
// Update the item.
targetGroup.update(item);
// Update an open view item. // Update an open view item.
const newItem = targetGroup.getItem(item.id); const newItem = this.items_[item.id] || null;
this.updateFeedbackPanelItem(item, newItem); this.updateFeedbackPanelItem(item, newItem);
} }
/** /**
* Requests all item groups to dismiss an error item. * Called by background page when an error dialog is dismissed.
* @param {string} id Item id. * @param {string} id Item id.
*/ */
dismissErrorItem(id) { dismissErrorItem(id) {
this.normalItemGroup_.dismissErrorItem(id); delete this.items_[id];
this.quietItemGroup_.dismissErrorItem(id);
}
/**
* Obtains the group for the item.
* @param {ProgressCenterItem} item Progress item.
* @return {ProgressCenterItemGroup} Item group that should contain the item.
* @private
*/
getGroupForItem_(item) {
return item.quiet ? this.quietItemGroup_ : this.normalItemGroup_;
} }
} }
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