Commit 9b8ade13 authored by Nicholas Hollingum's avatar Nicholas Hollingum Committed by Commit Bot

Crostini Upgrader: Do not proceed if user cancels backup

Previously if the user cancelled the backup, we would proceed with the
upgrade as though the user had elected not to backup at all.

With this change, the flow will instead return to the initial screen
when the user cancels, rather than proceed.

Bug: 1061203
Change-Id: I7be99a2c7a6caa4b5fd143def5ba0c6f9b4d5004
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2102935Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Commit-Queue: Nic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#750833}
parent 843c6e5a
...@@ -123,11 +123,10 @@ void CrostiniUpgrader::StatusTracker::SetStatusDoneUI() { ...@@ -123,11 +123,10 @@ void CrostiniUpgrader::StatusTracker::SetStatusDoneUI() {
} }
void CrostiniUpgrader::StatusTracker::SetStatusCancelledUI() { void CrostiniUpgrader::StatusTracker::SetStatusCancelledUI() {
// Successfully canceled backup/restore. Upgrade can continue but we will not // Cancelling the restore results in "success" i.e. we successfully didn't try
// use that backup to restore from. // to restore. Cancelling the backup is a no-op that returns you to the
if (type() == ExportImportType::EXPORT) { // original screen.
upgrader_->OnBackup(CrostiniResult::SUCCESS, base::nullopt); if (type() == ExportImportType::IMPORT) {
} else {
upgrader_->OnRestore(CrostiniResult::SUCCESS); upgrader_->OnRestore(CrostiniResult::SUCCESS);
} }
for (auto& observer : upgrader_->upgrader_observers_) { for (auto& observer : upgrader_->upgrader_observers_) {
......
...@@ -106,7 +106,7 @@ Polymer({ ...@@ -106,7 +106,7 @@ Polymer({
this.listenerIds_ = [ this.listenerIds_ = [
callbackRouter.onBackupProgress.addListener((percent) => { callbackRouter.onBackupProgress.addListener((percent) => {
assert(this.state_ === State.BACKUP); this.state_ = State.BACKUP;
this.backupProgress_ = percent; this.backupProgress_ = percent;
}), }),
callbackRouter.onBackupSucceeded.addListener((wasCancelled) => { callbackRouter.onBackupSucceeded.addListener((wasCancelled) => {
...@@ -256,7 +256,6 @@ Polymer({ ...@@ -256,7 +256,6 @@ Polymer({
* @private * @private
*/ */
startBackup_(showFileChooser) { startBackup_(showFileChooser) {
this.state_ = State.BACKUP;
BrowserProxy.getInstance().handler.backup(showFileChooser); BrowserProxy.getInstance().handler.backup(showFileChooser);
}, },
......
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