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) { |