Commit 59c24989 authored by Jason Lin's avatar Jason Lin Committed by Commit Bot

Update parallels uninstall notification for shut down failure

Bug: b/160937379
Change-Id: I699cbed8cc17f1819510b10b34e41b3482270f38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2316190
Commit-Queue: Jason Lin <lxj@google.com>
Auto-Submit: Jason Lin <lxj@google.com>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792600}
parent e2b26e43
...@@ -5252,6 +5252,9 @@ ...@@ -5252,6 +5252,9 @@
<message name="IDS_PLUGIN_VM_REMOVING_NOTIFICATION_FAILED_MESSAGE" desc="Message in the notification shown when removing the 'Plugin VM' app failed."> <message name="IDS_PLUGIN_VM_REMOVING_NOTIFICATION_FAILED_MESSAGE" desc="Message in the notification shown when removing the 'Plugin VM' app failed.">
Couldn't uninstall <ph name="APP_NAME">$1<ex>Plugin VM</ex></ph> Couldn't uninstall <ph name="APP_NAME">$1<ex>Plugin VM</ex></ph>
</message> </message>
<message name="IDS_PLUGIN_VM_SHUTDOWN_WINDOWS_TO_UNINSTALL_MESSAGE" desc="Message in the notification shown when uninstalling Parallels Desktop failed because the Windows VM failed to shut down.">
Shut down Windows to uninstall <ph name="PARALLELS_DESKTOP">$1<ex>Parallels Desktop</ex></ph>.
</message>
<message name="IDS_PLUGIN_VM_DLC_INTERNAL_FAILED_MESSAGE" desc="Error message shown if Plugin VM installation fails because an internal error indicates the device needs to be updated."> <message name="IDS_PLUGIN_VM_DLC_INTERNAL_FAILED_MESSAGE" desc="Error message shown if Plugin VM installation fails because an internal error indicates the device needs to be updated.">
Your device needs to be updated before you can use <ph name="APP_NAME">$1<ex>Plugin VM</ex></ph>. Your device needs to be updated before you can use <ph name="APP_NAME">$1<ex>Plugin VM</ex></ph>.
</message> </message>
......
822970519f2796337233b2d7907952aacc08a51d
\ No newline at end of file
...@@ -252,7 +252,8 @@ void PluginVmManagerImpl::UninstallPluginVm() { ...@@ -252,7 +252,8 @@ void PluginVmManagerImpl::UninstallPluginVm() {
base::BindOnce(&PluginVmManagerImpl::OnListVmsForUninstall, base::BindOnce(&PluginVmManagerImpl::OnListVmsForUninstall,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
base::BindOnce(&PluginVmManagerImpl::UninstallFailed, base::BindOnce(&PluginVmManagerImpl::UninstallFailed,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr(),
PluginVmUninstallerNotification::FailedReason::kUnknown));
} }
uint64_t PluginVmManagerImpl::seneschal_server_handle() const { uint64_t PluginVmManagerImpl::seneschal_server_handle() const {
...@@ -650,7 +651,8 @@ void PluginVmManagerImpl::OnStopVmForUninstall( ...@@ -650,7 +651,8 @@ void PluginVmManagerImpl::OnStopVmForUninstall(
base::Optional<vm_tools::plugin_dispatcher::StopVmResponse> reply) { base::Optional<vm_tools::plugin_dispatcher::StopVmResponse> reply) {
if (!reply || reply->error() != vm_tools::plugin_dispatcher::VM_SUCCESS) { if (!reply || reply->error() != vm_tools::plugin_dispatcher::VM_SUCCESS) {
LOG(ERROR) << "Failed to stop VM."; LOG(ERROR) << "Failed to stop VM.";
UninstallFailed(); UninstallFailed(
PluginVmUninstallerNotification::FailedReason::kStopVmFailed);
return; return;
} }
...@@ -705,9 +707,10 @@ void PluginVmManagerImpl::UninstallSucceeded() { ...@@ -705,9 +707,10 @@ void PluginVmManagerImpl::UninstallSucceeded() {
uninstaller_notification_.reset(); uninstaller_notification_.reset();
} }
void PluginVmManagerImpl::UninstallFailed() { void PluginVmManagerImpl::UninstallFailed(
PluginVmUninstallerNotification::FailedReason reason) {
DCHECK(uninstaller_notification_); DCHECK(uninstaller_notification_);
uninstaller_notification_->SetFailed(); uninstaller_notification_->SetFailed(reason);
uninstaller_notification_.reset(); uninstaller_notification_.reset();
} }
......
...@@ -121,7 +121,9 @@ class PluginVmManagerImpl ...@@ -121,7 +121,9 @@ class PluginVmManagerImpl
base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response); base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response);
// Called when UninstallPluginVm() is unsuccessful. // Called when UninstallPluginVm() is unsuccessful.
void UninstallFailed(); void UninstallFailed(
PluginVmUninstallerNotification::FailedReason reason =
PluginVmUninstallerNotification::FailedReason::kUnknown);
Profile* profile_; Profile* profile_;
std::string owner_id_; std::string owner_id_;
......
...@@ -63,10 +63,18 @@ PluginVmUninstallerNotification::PluginVmUninstallerNotification( ...@@ -63,10 +63,18 @@ PluginVmUninstallerNotification::PluginVmUninstallerNotification(
PluginVmUninstallerNotification::~PluginVmUninstallerNotification() = default; PluginVmUninstallerNotification::~PluginVmUninstallerNotification() = default;
void PluginVmUninstallerNotification::SetFailed() { void PluginVmUninstallerNotification::SetFailed(FailedReason reason) {
base::string16 app_name = PluginVmAppName();
base::string16 message;
if (reason == FailedReason::kStopVmFailed) {
message = l10n_util::GetStringFUTF16(
IDS_PLUGIN_VM_SHUTDOWN_WINDOWS_TO_UNINSTALL_MESSAGE, app_name);
}
notification_->set_type(message_center::NOTIFICATION_TYPE_SIMPLE); notification_->set_type(message_center::NOTIFICATION_TYPE_SIMPLE);
notification_->set_title(l10n_util::GetStringFUTF16( notification_->set_title(l10n_util::GetStringFUTF16(
IDS_PLUGIN_VM_REMOVING_NOTIFICATION_FAILED_MESSAGE, PluginVmAppName())); IDS_PLUGIN_VM_REMOVING_NOTIFICATION_FAILED_MESSAGE, app_name));
notification_->set_message(message);
notification_->set_pinned(false); notification_->set_pinned(false);
notification_->set_never_timeout(false); notification_->set_never_timeout(false);
notification_->set_accent_color(ash::kSystemNotificationColorCriticalWarning); notification_->set_accent_color(ash::kSystemNotificationColorCriticalWarning);
......
...@@ -12,10 +12,15 @@ class Profile; ...@@ -12,10 +12,15 @@ class Profile;
class PluginVmUninstallerNotification { class PluginVmUninstallerNotification {
public: public:
enum class FailedReason {
kUnknown,
kStopVmFailed,
};
explicit PluginVmUninstallerNotification(Profile* profile); explicit PluginVmUninstallerNotification(Profile* profile);
virtual ~PluginVmUninstallerNotification(); virtual ~PluginVmUninstallerNotification();
void SetFailed(); void SetFailed(FailedReason reason);
void SetCompleted(); void SetCompleted();
// Will show the notification, even if it has been closed. // Will show the notification, even if it has been closed.
void ForceRedisplay(); void ForceRedisplay();
......
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