Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: ui/file_manager/file_manager/foreground/js/cws_container_client.js

Issue 1061133005: Wait for 'after_install' from widget before closing SuggestAppsDialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@break_up_suggest_apps_dialog
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/foreground/js/cws_container_client.js
diff --git a/ui/file_manager/file_manager/foreground/js/cws_container_client.js b/ui/file_manager/file_manager/foreground/js/cws_container_client.js
index d390553800f7fdcf9cb031b98112eb17a1447e04..403d71681b02b93b2da3e6513e49a0be2b53ebc4 100644
--- a/ui/file_manager/file_manager/foreground/js/cws_container_client.js
+++ b/ui/file_manager/file_manager/foreground/js/cws_container_client.js
@@ -41,7 +41,8 @@ CWSContainerClient.prototype = {
CWSContainerClient.Events = {
LOADED: 'CWSContainerClient.Events.LOADED',
LOAD_FAILED: 'CWSContainerClient.Events.LOAD_FAILED',
- REQUEST_INSTALL: 'CWSContainerClient.Events.REQUEST_INSTALL'
+ REQUEST_INSTALL: 'CWSContainerClient.Events.REQUEST_INSTALL',
+ INSTALL_DONE: 'CWSContainerClient.Events.INSTALL_DONE'
};
Object.freeze(CWSContainerClient.Events);
@@ -65,6 +66,9 @@ CWSContainerClient.prototype.onMessage_ = function(event) {
case 'before_install':
this.sendInstallRequest_(data['item_id']);
break;
+ case 'after_install':
+ this.sendInstallDone_(data['item_id']);
+ break;
default:
console.error('Unexpected message: ' + data['message'], data);
}
@@ -141,6 +145,18 @@ CWSContainerClient.prototype.sendInstallRequest_ = function(itemId) {
};
/**
+ * Notifies the suggest-app dialog that the item installation is completed.
+ *
+ * @param {string} itemId The installed item ID.
+ * @private
+ */
+CWSContainerClient.prototype.sendInstallDone_ = function(itemId) {
+ var event = new Event(CWSContainerClient.Events.INSTALL_DONE);
+ event.itemId = itemId;
+ this.dispatchEvent(event);
+};
+
+/**
* Send the 'install_failure' message to the widget.
*
* @param {string} itemId Item id to be installed.

Powered by Google App Engine
This is Rietveld 408576698