Commit 465e82e3 authored by Nicholas Verne's avatar Nicholas Verne Committed by Commit Bot

No longer show Upgrade Succeeded message if container was restored.

The Restore operation only happens if the Crostini container upgrade failed.

Bug: 1064915
Change-Id: I5b3b0e1bce6c26d756e6fb9e70346736740b63fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141568Reviewed-by: default avatarNic Hollingum <hollingum@google.com>
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757733}
parent 1202edf4
...@@ -4356,6 +4356,12 @@ ...@@ -4356,6 +4356,12 @@
<message name="IDS_CROSTINI_UPGRADER_RESTORE_TITLE" desc="Title of the Crostini upgrader when the container upgrade fails and restore of a backup is in progress."> <message name="IDS_CROSTINI_UPGRADER_RESTORE_TITLE" desc="Title of the Crostini upgrader when the container upgrade fails and restore of a backup is in progress.">
Restoring Linux Restoring Linux
</message> </message>
<message name="IDS_CROSTINI_UPGRADER_RESTORE_SUCCEEDED_TITLE" desc="Title of the Crostini upgrader when the upgrade failed but the restore of a backup completed successfully.">
Restore complete
</message>
<message name="IDS_CROSTINI_UPGRADER_RESTORE_SUCCEEDED_MESSAGE" desc="Text shown by the Crostini upgrader when the upgrade failed but the restore of a backup completed successfully..">
Linux backup has been successfully restored.
</message>
<message name="IDS_CROSTINI_UPGRADER_ERROR_TITLE" desc="Title of the Crostini upgrader when an error occurs."> <message name="IDS_CROSTINI_UPGRADER_ERROR_TITLE" desc="Title of the Crostini upgrader when an error occurs.">
Error upgrading Linux Error upgrading Linux
</message> </message>
......
...@@ -26,6 +26,7 @@ const State = { ...@@ -26,6 +26,7 @@ const State = {
UPGRADING: 'upgrading', UPGRADING: 'upgrading',
OFFER_RESTORE: 'offerRestore', OFFER_RESTORE: 'offerRestore',
RESTORE: 'restore', RESTORE: 'restore',
RESTORE_SUCCEEDED: 'restoreSucceeded',
ERROR: 'error', ERROR: 'error',
CANCELING: 'canceling', CANCELING: 'canceling',
SUCCEEDED: 'succeeded', SUCCEEDED: 'succeeded',
...@@ -166,7 +167,7 @@ Polymer({ ...@@ -166,7 +167,7 @@ Polymer({
}), }),
callbackRouter.onRestoreSucceeded.addListener(() => { callbackRouter.onRestoreSucceeded.addListener(() => {
assert(this.state_ === State.RESTORE); assert(this.state_ === State.RESTORE);
this.state_ = State.SUCCEEDED; this.state_ = State.RESTORE_SUCCEEDED;
}), }),
callbackRouter.onRestoreFailed.addListener(() => { callbackRouter.onRestoreFailed.addListener(() => {
assert(this.state_ === State.RESTORE); assert(this.state_ === State.RESTORE);
...@@ -201,6 +202,7 @@ Polymer({ ...@@ -201,6 +202,7 @@ Polymer({
onActionButtonClick_() { onActionButtonClick_() {
switch (this.state_) { switch (this.state_) {
case State.SUCCEEDED: case State.SUCCEEDED:
case State.RESTORE_SUCCEEDED:
BrowserProxy.getInstance().handler.launch(); BrowserProxy.getInstance().handler.launch();
this.closeDialog_(); this.closeDialog_();
break; break;
...@@ -304,6 +306,7 @@ Polymer({ ...@@ -304,6 +306,7 @@ Polymer({
case State.PRECHECKS_FAILED: case State.PRECHECKS_FAILED:
case State.SUCCEEDED: case State.SUCCEEDED:
case State.OFFER_RESTORE: case State.OFFER_RESTORE:
case State.RESTORE_SUCCEEDED:
return true; return true;
} }
return false; return false;
...@@ -356,6 +359,9 @@ Polymer({ ...@@ -356,6 +359,9 @@ Polymer({
case State.RESTORE: case State.RESTORE:
titleId = 'restoreTitle'; titleId = 'restoreTitle';
break; break;
case State.RESTORE_SUCCEEDED:
titleId = 'restoreSucceededTitle';
break;
case State.CANCELING: case State.CANCELING:
titleId = 'cancelingTitle'; titleId = 'cancelingTitle';
break; break;
...@@ -382,6 +388,7 @@ Polymer({ ...@@ -382,6 +388,7 @@ Polymer({
case State.ERROR: case State.ERROR:
return loadTimeData.getString('cancel'); return loadTimeData.getString('cancel');
case State.SUCCEEDED: case State.SUCCEEDED:
case State.RESTORE_SUCCEEDED:
return loadTimeData.getString('done'); return loadTimeData.getString('done');
case State.OFFER_RESTORE: case State.OFFER_RESTORE:
return loadTimeData.getString('restore'); return loadTimeData.getString('restore');
...@@ -397,6 +404,7 @@ Polymer({ ...@@ -397,6 +404,7 @@ Polymer({
getCancelButtonLabel_(state) { getCancelButtonLabel_(state) {
switch (state) { switch (state) {
case State.SUCCEEDED: case State.SUCCEEDED:
case State.RESTORE_SUCCEEDED:
return loadTimeData.getString('close'); return loadTimeData.getString('close');
default: default:
return loadTimeData.getString('cancel'); return loadTimeData.getString('cancel');
...@@ -443,6 +451,9 @@ Polymer({ ...@@ -443,6 +451,9 @@ Polymer({
case State.RESTORE: case State.RESTORE:
messageId = 'restoreMessage'; messageId = 'restoreMessage';
break; break;
case State.RESTORE_SUCCEEDED:
messageId = 'restoreSucceededMessage';
break;
case State.SUCCEEDED: case State.SUCCEEDED:
messageId = 'succeededMessage'; messageId = 'succeededMessage';
break; break;
...@@ -470,6 +481,7 @@ Polymer({ ...@@ -470,6 +481,7 @@ Polymer({
getIllustrationStyle_(state) { getIllustrationStyle_(state) {
switch (state) { switch (state) {
case State.BACKUP_SUCCEEDED: case State.BACKUP_SUCCEEDED:
case State.RESTORE_SUCCEEDED:
case State.PRECHECKS_FAILED: case State.PRECHECKS_FAILED:
case State.ERROR: case State.ERROR:
return 'img-square-illustration'; return 'img-square-illustration';
...@@ -485,6 +497,7 @@ Polymer({ ...@@ -485,6 +497,7 @@ Polymer({
getIllustrationURI_(state) { getIllustrationURI_(state) {
switch (state) { switch (state) {
case State.BACKUP_SUCCEEDED: case State.BACKUP_SUCCEEDED:
case State.RESTORE_SUCCEEDED:
return 'images/success_illustration.svg'; return 'images/success_illustration.svg';
case State.PRECHECKS_FAILED: case State.PRECHECKS_FAILED:
case State.ERROR: case State.ERROR:
...@@ -493,6 +506,7 @@ Polymer({ ...@@ -493,6 +506,7 @@ Polymer({
return 'images/linux_illustration.png'; return 'images/linux_illustration.png';
}, },
/** @private */
updateProgressLine_() { updateProgressLine_() {
if (this.progressLineNumber_ < this.upgradeProgress_) { if (this.progressLineNumber_ < this.upgradeProgress_) {
this.lastProgressLine_ = this.lastProgressLine_ =
......
...@@ -53,6 +53,7 @@ void AddStringResources(content::WebUIDataSource* source) { ...@@ -53,6 +53,7 @@ void AddStringResources(content::WebUIDataSource* source) {
{"prechecksFailedTitle", IDS_CROSTINI_UPGRADER_PRECHECKS_FAILED_TITLE}, {"prechecksFailedTitle", IDS_CROSTINI_UPGRADER_PRECHECKS_FAILED_TITLE},
{"upgradingTitle", IDS_CROSTINI_UPGRADER_UPGRADING_TITLE}, {"upgradingTitle", IDS_CROSTINI_UPGRADER_UPGRADING_TITLE},
{"restoreTitle", IDS_CROSTINI_UPGRADER_RESTORE_TITLE}, {"restoreTitle", IDS_CROSTINI_UPGRADER_RESTORE_TITLE},
{"restoreSucceededTitle", IDS_CROSTINI_UPGRADER_RESTORE_SUCCEEDED_TITLE},
{"succeededTitle", IDS_CROSTINI_UPGRADER_SUCCEEDED_TITLE}, {"succeededTitle", IDS_CROSTINI_UPGRADER_SUCCEEDED_TITLE},
{"cancelingTitle", IDS_CROSTINI_UPGRADER_CANCELING_TITLE}, {"cancelingTitle", IDS_CROSTINI_UPGRADER_CANCELING_TITLE},
{"errorTitle", IDS_CROSTINI_UPGRADER_ERROR_TITLE}, {"errorTitle", IDS_CROSTINI_UPGRADER_ERROR_TITLE},
...@@ -69,6 +70,8 @@ void AddStringResources(content::WebUIDataSource* source) { ...@@ -69,6 +70,8 @@ void AddStringResources(content::WebUIDataSource* source) {
{"cancelingMessage", IDS_CROSTINI_UPGRADER_CANCELING}, {"cancelingMessage", IDS_CROSTINI_UPGRADER_CANCELING},
{"offerRestoreMessage", IDS_CROSTINI_UPGRADER_OFFER_RESTORE_MESSAGE}, {"offerRestoreMessage", IDS_CROSTINI_UPGRADER_OFFER_RESTORE_MESSAGE},
{"restoreMessage", IDS_CROSTINI_UPGRADER_RESTORE_MESSAGE}, {"restoreMessage", IDS_CROSTINI_UPGRADER_RESTORE_MESSAGE},
{"restoreSucceededMessage",
IDS_CROSTINI_UPGRADER_RESTORE_SUCCEEDED_MESSAGE},
{"backupCheckboxMessage", IDS_CROSTINI_UPGRADER_BACKUP_CHECKBOX_MESSAGE}, {"backupCheckboxMessage", IDS_CROSTINI_UPGRADER_BACKUP_CHECKBOX_MESSAGE},
{"backupChangeLocation", IDS_CROSTINI_UPGRADER_BACKUP_CHANGE_LOCATION}, {"backupChangeLocation", IDS_CROSTINI_UPGRADER_BACKUP_CHANGE_LOCATION},
......
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