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

Unified Diff: ui/file_manager/file_manager/foreground/js/app_installer.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/app_installer.js
diff --git a/ui/file_manager/file_manager/foreground/js/app_installer.js b/ui/file_manager/file_manager/foreground/js/app_installer.js
index a637c8db92e982bd95b80eba37f73848149b4aba..ead973b5b0533b9624e0217df6e527d7c0cc1ad3 100644
--- a/ui/file_manager/file_manager/foreground/js/app_installer.js
+++ b/ui/file_manager/file_manager/foreground/js/app_installer.js
@@ -52,6 +52,15 @@ AppInstaller.prototype.install = function(callback) {
};
/**
+ * Prevents {@code this.callback_} from being called.
+ */
+AppInstaller.prototype.cancel = function() {
+ // TODO(tbarzic): Would it make sense to uninstall the app on success if the
+ // app instaler is cancelled instead of just invalidating the callback?
+ this.callback_ = null;
+};
+
+/**
* Called when the installation is completed.
*
* @param {!Object|undefined} error Undefined if the installation is success,
@@ -59,6 +68,9 @@ AppInstaller.prototype.install = function(callback) {
* @private
*/
AppInstaller.prototype.onInstallCompleted_ = function(error) {
+ if (!this.callback_)
+ return;
+
var installerResult = AppInstaller.Result.SUCCESS;
var errorMessage = '';
if (error) {

Powered by Google App Engine
This is Rietveld 408576698