Commit 6c446a46 authored by Julian Watson's avatar Julian Watson Committed by Commit Bot

plugin_vm: expose launcher failure reasons in UI

Bug: 1017511
Change-Id: I1ccdea99c3154dd9920f8f86d527ac97cf786d5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909052
Auto-Submit: Julian Watson <juwa@google.com>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722315}
parent ce2afe1b
......@@ -4088,11 +4088,20 @@
<message name="IDS_PLUGIN_VM_LAUNCHER_FINISHED_MESSAGE" desc="Text of the Plugin VM installer after successful installation.">
Plugin VM is ready to use
</message>
<message name="IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE" desc="Text of the Plugin VM installer if the installation failed.">
Try installing again
<message name="IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_LOGIC_ERROR" desc="Text of the Plugin VM installer if the installation failed due to an internal error.">
Couldn't install Plugin VM. Please try again, or contact your organization's device administrator. Error code: <ph name="ERROR_CODE">$1<ex>7</ex></ph>.
</message>
<message name="IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_CONFIG_ERROR" desc="Text of the Plugin VM installer if the installation failed because there was an error in the configuration.">
Couldn't set up Plugin VM because of a configuration problem. Please contact your organization's device administrator. Error code: <ph name="ERROR_CODE">$1<ex>7</ex></ph>.
</message>
<message name="IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_DOWNLOAD_FAILED" desc="Text of the Plugin VM installer if the installation failed because something went wrong while downloading the virtual machine.">
Couldn't install the virtual machine because of a network error. Please try again, or contact your organization's device administrator. Error code: <ph name="ERROR_CODE">$1<ex>7</ex></ph>.
</message>
<message name="IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_INSTALLING_FAILED" desc="Text of the Plugin VM installer if the installation failed because downloaded Plugin VM could not be installed.">
Couldn't install the virtual machine. Please try again, or contact your organization's device administrator. Error code: <ph name="ERROR_CODE">$1<ex>7</ex></ph>.
</message>
<message name="IDS_PLUGIN_VM_LAUNCHER_NOT_ALLOWED_MESSAGE" desc="Error message to be shown if a setup/launch is attempted although Plugin VM is disallowed.">
Contact your organization's device admin
Plugin VM isn't allowed on this device. Contact your organization's device administrator.
</message>
<message name="IDS_PLUGIN_VM_LAUNCHER_DOWNLOAD_PROGRESS_MESSAGE" desc="Text of the Plugin VM installer during downloading Plugin VM image, showing download progress.">
<ph name="DOWNLOADED_SIZE">$1<ex>1.2</ex></ph>/<ph name="DOWNLOAD_SIZE">$2<ex>3.4 GB</ex></ph>
......
......@@ -7,6 +7,7 @@
#include <memory>
#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager_factory.h"
......@@ -379,14 +380,44 @@ base::string16 PluginVmLauncherView::GetMessage() const {
case State::FINISHED:
return l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_FINISHED_MESSAGE);
case State::ERROR:
using Reason = plugin_vm::PluginVmImageManager::FailureReason;
DCHECK(reason_);
switch (*reason_) {
case plugin_vm::PluginVmImageManager::FailureReason::NOT_ALLOWED:
return l10n_util::GetStringUTF16(
IDS_PLUGIN_VM_LAUNCHER_NOT_ALLOWED_MESSAGE);
default:
case Reason::LOGIC_ERROR:
case Reason::SIGNAL_NOT_CONNECTED:
case Reason::OPERATION_IN_PROGRESS:
case Reason::UNEXPECTED_DISK_IMAGE_STATUS:
case Reason::INVALID_DISK_IMAGE_STATUS_RESPONSE:
case Reason::DISPATCHER_NOT_AVAILABLE:
case Reason::CONCIERGE_NOT_AVAILABLE:
return l10n_util::GetStringFUTF16(
IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_LOGIC_ERROR,
base::NumberToString16(
static_cast<std::underlying_type_t<Reason>>(*reason_)));
case Reason::NOT_ALLOWED:
return l10n_util::GetStringUTF16(
IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE);
IDS_PLUGIN_VM_LAUNCHER_NOT_ALLOWED_MESSAGE);
case Reason::INVALID_IMAGE_URL:
case Reason::HASH_MISMATCH:
return l10n_util::GetStringFUTF16(
IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_CONFIG_ERROR,
base::NumberToString16(
static_cast<std::underlying_type_t<Reason>>(*reason_)));
case Reason::DOWNLOAD_FAILED_UNKNOWN:
case Reason::DOWNLOAD_FAILED_NETWORK:
case Reason::DOWNLOAD_FAILED_ABORTED:
return l10n_util::GetStringFUTF16(
IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_DOWNLOAD_FAILED,
base::NumberToString16(
static_cast<std::underlying_type_t<Reason>>(*reason_)));
case Reason::COULD_NOT_OPEN_IMAGE:
case Reason::INVALID_IMPORT_RESPONSE:
case Reason::IMAGE_IMPORT_FAILED:
return l10n_util::GetStringFUTF16(
IDS_PLUGIN_VM_LAUNCHER_ERROR_MESSAGE_INSTALLING_FAILED,
base::NumberToString16(
static_cast<std::underlying_type_t<Reason>>(*reason_)));
}
}
}
......
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