Commit d47d28aa authored by Julian Watson's avatar Julian Watson Committed by Commit Bot

plugin_vm: pass failure reason enum to launcher view

Bug: 1017511
Change-Id: I5a7773cf33fbd69c0d400dbbf2fdf99cd4dfed48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904559
Commit-Queue: Julian Watson <juwa@google.com>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Auto-Submit: Julian Watson <juwa@google.com>
Cr-Commit-Position: refs/heads/master@{#714343}
parent 1f8f8d1a
...@@ -73,11 +73,15 @@ void PluginVmImageDownloadClient::OnDownloadUpdated(const std::string& guid, ...@@ -73,11 +73,15 @@ void PluginVmImageDownloadClient::OnDownloadUpdated(const std::string& guid,
void PluginVmImageDownloadClient::OnDownloadFailed( void PluginVmImageDownloadClient::OnDownloadFailed(
const std::string& guid, const std::string& guid,
const download::CompletionInfo& completion_info, const download::CompletionInfo& completion_info,
download::Client::FailureReason reason) { download::Client::FailureReason clientReason) {
VLOG(1) << __func__ << " called"; VLOG(1) << __func__ << " called";
switch (reason) { auto managerReason =
PluginVmImageManager::FailureReason::DOWNLOAD_FAILED_UNKNOWN;
switch (clientReason) {
case download::Client::FailureReason::NETWORK: case download::Client::FailureReason::NETWORK:
VLOG(1) << "Failure reason: NETWORK"; VLOG(1) << "Failure reason: NETWORK";
managerReason =
PluginVmImageManager::FailureReason::DOWNLOAD_FAILED_NETWORK;
break; break;
case download::Client::FailureReason::UPLOAD_TIMEDOUT: case download::Client::FailureReason::UPLOAD_TIMEDOUT:
VLOG(1) << "Failure reason: UPLOAD_TIMEDOUT"; VLOG(1) << "Failure reason: UPLOAD_TIMEDOUT";
...@@ -90,6 +94,8 @@ void PluginVmImageDownloadClient::OnDownloadFailed( ...@@ -90,6 +94,8 @@ void PluginVmImageDownloadClient::OnDownloadFailed(
break; break;
case download::Client::FailureReason::ABORTED: case download::Client::FailureReason::ABORTED:
VLOG(1) << "Failure reason: ABORTED"; VLOG(1) << "Failure reason: ABORTED";
managerReason =
PluginVmImageManager::FailureReason::DOWNLOAD_FAILED_ABORTED;
break; break;
case download::Client::FailureReason::CANCELLED: case download::Client::FailureReason::CANCELLED:
VLOG(1) << "Failure reason: CANCELLED"; VLOG(1) << "Failure reason: CANCELLED";
...@@ -101,10 +107,10 @@ void PluginVmImageDownloadClient::OnDownloadFailed( ...@@ -101,10 +107,10 @@ void PluginVmImageDownloadClient::OnDownloadFailed(
if (old_downloads_.find(guid) != old_downloads_.end()) if (old_downloads_.find(guid) != old_downloads_.end())
return; return;
if (reason == download::Client::FailureReason::CANCELLED) if (clientReason == download::Client::FailureReason::CANCELLED)
GetManager()->OnDownloadCancelled(); GetManager()->OnDownloadCancelled();
else else
GetManager()->OnDownloadFailed(); GetManager()->OnDownloadFailed(managerReason);
} }
void PluginVmImageDownloadClient::OnDownloadSucceeded( void PluginVmImageDownloadClient::OnDownloadSucceeded(
......
...@@ -53,7 +53,7 @@ void PluginVmImageManager::StartDownload() { ...@@ -53,7 +53,7 @@ void PluginVmImageManager::StartDownload() {
LOG(ERROR) << "Download of a PluginVm image couldn't be started as" LOG(ERROR) << "Download of a PluginVm image couldn't be started as"
<< " another PluginVm image is currently being processed " << " another PluginVm image is currently being processed "
<< "in state " << GetStateName(state_); << "in state " << GetStateName(state_);
OnDownloadFailed(); OnDownloadFailed(FailureReason::OPERATION_IN_PROGRESS);
return; return;
} }
...@@ -63,14 +63,14 @@ void PluginVmImageManager::StartDownload() { ...@@ -63,14 +63,14 @@ void PluginVmImageManager::StartDownload() {
if (!IsPluginVmAllowedForProfile(profile_)) { if (!IsPluginVmAllowedForProfile(profile_)) {
LOG(ERROR) << "Download of PluginVm image cannot be started because " LOG(ERROR) << "Download of PluginVm image cannot be started because "
<< "the user is not allowed to run PluginVm"; << "the user is not allowed to run PluginVm";
OnDownloadFailed(); OnDownloadFailed(FailureReason::NOT_ALLOWED);
return; return;
} }
state_ = State::DOWNLOADING; state_ = State::DOWNLOADING;
GURL url = GetPluginVmImageDownloadUrl(); GURL url = GetPluginVmImageDownloadUrl();
if (url.is_empty()) { if (url.is_empty()) {
OnDownloadFailed(); OnDownloadFailed(FailureReason::INVALID_IMAGE_URL);
return; return;
} }
download_service_->StartDownload(GetDownloadParams(url)); download_service_->StartDownload(GetDownloadParams(url));
...@@ -105,7 +105,7 @@ void PluginVmImageManager::OnDownloadCompleted( ...@@ -105,7 +105,7 @@ void PluginVmImageManager::OnDownloadCompleted(
if (!VerifyDownload(info.hash256)) { if (!VerifyDownload(info.hash256)) {
LOG(ERROR) << "Downloaded PluginVm image archive hash doesn't match " LOG(ERROR) << "Downloaded PluginVm image archive hash doesn't match "
<< "hash specified by the PluginVmImage policy"; << "hash specified by the PluginVmImage policy";
OnDownloadFailed(); OnDownloadFailed(FailureReason::HASH_MISMATCH);
return; return;
} }
...@@ -126,12 +126,12 @@ void PluginVmImageManager::OnDownloadCancelled() { ...@@ -126,12 +126,12 @@ void PluginVmImageManager::OnDownloadCancelled() {
state_ = State::NOT_STARTED; state_ = State::NOT_STARTED;
} }
void PluginVmImageManager::OnDownloadFailed() { void PluginVmImageManager::OnDownloadFailed(FailureReason reason) {
state_ = State::DOWNLOAD_FAILED; state_ = State::DOWNLOAD_FAILED;
RemoveTemporaryPluginVmImageArchiveIfExists(); RemoveTemporaryPluginVmImageArchiveIfExists();
current_download_guid_.clear(); current_download_guid_.clear();
if (observer_) if (observer_)
observer_->OnDownloadFailed(); observer_->OnDownloadFailed(reason);
} }
void PluginVmImageManager::StartImport() { void PluginVmImageManager::StartImport() {
...@@ -139,7 +139,7 @@ void PluginVmImageManager::StartImport() { ...@@ -139,7 +139,7 @@ void PluginVmImageManager::StartImport() {
LOG(ERROR) << "Importing of PluginVm image couldn't proceed as current " LOG(ERROR) << "Importing of PluginVm image couldn't proceed as current "
<< "state is " << GetStateName(state_) << " not " << "state is " << GetStateName(state_) << " not "
<< GetStateName(State::DOWNLOADED); << GetStateName(State::DOWNLOADED);
OnImported(false); OnImported(FailureReason::LOGIC_ERROR);
return; return;
} }
...@@ -157,7 +157,7 @@ void PluginVmImageManager::StartImport() { ...@@ -157,7 +157,7 @@ void PluginVmImageManager::StartImport() {
void PluginVmImageManager::OnPluginVmDispatcherStarted(bool success) { void PluginVmImageManager::OnPluginVmDispatcherStarted(bool success) {
if (!success) { if (!success) {
LOG(ERROR) << "Failed to start PluginVm dispatcher service"; LOG(ERROR) << "Failed to start PluginVm dispatcher service";
OnImported(false); OnImported(FailureReason::DISPATCHER_NOT_AVAILABLE);
return; return;
} }
GetConciergeClient()->WaitForServiceToBeAvailable( GetConciergeClient()->WaitForServiceToBeAvailable(
...@@ -168,12 +168,12 @@ void PluginVmImageManager::OnPluginVmDispatcherStarted(bool success) { ...@@ -168,12 +168,12 @@ void PluginVmImageManager::OnPluginVmDispatcherStarted(bool success) {
void PluginVmImageManager::OnConciergeAvailable(bool success) { void PluginVmImageManager::OnConciergeAvailable(bool success) {
if (!success) { if (!success) {
LOG(ERROR) << "Concierge did not become available"; LOG(ERROR) << "Concierge did not become available";
OnImported(false); OnImported(FailureReason::CONCIERGE_NOT_AVAILABLE);
return; return;
} }
if (!GetConciergeClient()->IsDiskImageProgressSignalConnected()) { if (!GetConciergeClient()->IsDiskImageProgressSignalConnected()) {
LOG(ERROR) << "Disk image progress signal is not connected"; LOG(ERROR) << "Disk image progress signal is not connected";
OnImported(false); OnImported(FailureReason::SIGNAL_NOT_CONNECTED);
return; return;
} }
VLOG(1) << "Plugin VM dispatcher service has been started and disk image " VLOG(1) << "Plugin VM dispatcher service has been started and disk image "
...@@ -212,7 +212,7 @@ void PluginVmImageManager::OnFDPrepared( ...@@ -212,7 +212,7 @@ void PluginVmImageManager::OnFDPrepared(
if (!maybeFd.has_value()) { if (!maybeFd.has_value()) {
LOG(ERROR) << "Could not open downloaded image archive"; LOG(ERROR) << "Could not open downloaded image archive";
OnImported(false); OnImported(FailureReason::COULD_NOT_OPEN_IMAGE);
return; return;
} }
...@@ -237,7 +237,7 @@ void PluginVmImageManager::OnImportDiskImage( ...@@ -237,7 +237,7 @@ void PluginVmImageManager::OnImportDiskImage(
if (!reply.has_value()) { if (!reply.has_value()) {
LOG(ERROR) << "Could not retrieve response from ImportDiskImage call to " LOG(ERROR) << "Could not retrieve response from ImportDiskImage call to "
<< "concierge"; << "concierge";
OnImported(false); OnImported(FailureReason::INVALID_IMPORT_RESPONSE);
return; return;
} }
...@@ -251,7 +251,7 @@ void PluginVmImageManager::OnImportDiskImage( ...@@ -251,7 +251,7 @@ void PluginVmImageManager::OnImportDiskImage(
vm_tools::concierge::DiskImageStatus::DISK_STATUS_IN_PROGRESS) { vm_tools::concierge::DiskImageStatus::DISK_STATUS_IN_PROGRESS) {
LOG(ERROR) << "Disk image is not in progress. Status: " << response.status() LOG(ERROR) << "Disk image is not in progress. Status: " << response.status()
<< ", " << response.failure_reason(); << ", " << response.failure_reason();
OnImported(false); OnImported(FailureReason::UNEXPECTED_DISK_IMAGE_STATUS);
return; return;
} }
...@@ -289,7 +289,7 @@ void PluginVmImageManager::OnDiskImageProgress( ...@@ -289,7 +289,7 @@ void PluginVmImageManager::OnDiskImageProgress(
LOG(ERROR) << "Disk image status signal has status: " << status LOG(ERROR) << "Disk image status signal has status: " << status
<< " with error message: " << signal.failure_reason() << " with error message: " << signal.failure_reason()
<< " and current progress: " << percent_completed; << " and current progress: " << percent_completed;
OnImported(false); OnImported(FailureReason::UNEXPECTED_DISK_IMAGE_STATUS);
return; return;
} }
} }
...@@ -308,7 +308,7 @@ void PluginVmImageManager::OnFinalDiskImageStatus( ...@@ -308,7 +308,7 @@ void PluginVmImageManager::OnFinalDiskImageStatus(
if (!reply.has_value()) { if (!reply.has_value()) {
LOG(ERROR) << "Could not retrieve response from DiskImageStatus call to " LOG(ERROR) << "Could not retrieve response from DiskImageStatus call to "
<< "concierge"; << "concierge";
OnImported(false); OnImported(FailureReason::INVALID_DISK_IMAGE_STATUS_RESPONSE);
return; return;
} }
...@@ -318,23 +318,25 @@ void PluginVmImageManager::OnFinalDiskImageStatus( ...@@ -318,23 +318,25 @@ void PluginVmImageManager::OnFinalDiskImageStatus(
vm_tools::concierge::DiskImageStatus::DISK_STATUS_CREATED) { vm_tools::concierge::DiskImageStatus::DISK_STATUS_CREATED) {
LOG(ERROR) << "Disk image is not created. Status: " << response.status() LOG(ERROR) << "Disk image is not created. Status: " << response.status()
<< ", " << response.failure_reason(); << ", " << response.failure_reason();
OnImported(false); OnImported(FailureReason::IMAGE_IMPORT_FAILED);
return; return;
} }
OnImported(true); OnImported(base::nullopt);
} }
void PluginVmImageManager::OnImported(bool success) { void PluginVmImageManager::OnImported(
base::Optional<FailureReason> failure_reason) {
GetConciergeClient()->RemoveDiskImageObserver(this); GetConciergeClient()->RemoveDiskImageObserver(this);
RemoveTemporaryPluginVmImageArchiveIfExists(); RemoveTemporaryPluginVmImageArchiveIfExists();
current_import_command_uuid_.clear(); current_import_command_uuid_.clear();
if (!success) { if (failure_reason) {
LOG(ERROR) << "Image import failed"; LOG(ERROR) << "Image import failed";
state_ = State::IMPORT_FAILED; state_ = State::IMPORT_FAILED;
if (observer_) if (observer_) {
observer_->OnImportFailed(); observer_->OnImportFailed(*failure_reason);
}
return; return;
} }
...@@ -505,7 +507,7 @@ void PluginVmImageManager::OnStartDownload( ...@@ -505,7 +507,7 @@ void PluginVmImageManager::OnStartDownload(
if (start_result == download::DownloadParams::ACCEPTED) if (start_result == download::DownloadParams::ACCEPTED)
current_download_guid_ = download_guid; current_download_guid_ = download_guid;
else else
OnDownloadFailed(); OnDownloadFailed(FailureReason::DOWNLOAD_FAILED_UNKNOWN);
} }
bool PluginVmImageManager::VerifyDownload( bool PluginVmImageManager::VerifyDownload(
......
...@@ -40,6 +40,27 @@ class PluginVmImageManager ...@@ -40,6 +40,27 @@ class PluginVmImageManager
: public KeyedService, : public KeyedService,
public chromeos::ConciergeClient::DiskImageObserver { public chromeos::ConciergeClient::DiskImageObserver {
public: public:
// FailureReasons values can be shown to the user. Do not reorder or renumber
// these values without careful consideration.
enum class FailureReason {
LOGIC_ERROR = 0,
SIGNAL_NOT_CONNECTED = 1,
OPERATION_IN_PROGRESS = 2,
NOT_ALLOWED = 3,
INVALID_IMAGE_URL = 4,
UNEXPECTED_DISK_IMAGE_STATUS = 5,
INVALID_DISK_IMAGE_STATUS_RESPONSE = 6,
DOWNLOAD_FAILED_UNKNOWN = 7,
DOWNLOAD_FAILED_NETWORK = 8,
DOWNLOAD_FAILED_ABORTED = 9,
HASH_MISMATCH = 10,
DISPATCHER_NOT_AVAILABLE = 11,
CONCIERGE_NOT_AVAILABLE = 12,
COULD_NOT_OPEN_IMAGE = 13,
INVALID_IMPORT_RESPONSE = 14,
IMAGE_IMPORT_FAILED = 15,
};
// Observer class for the PluginVm image related events. // Observer class for the PluginVm image related events.
class Observer { class Observer {
public: public:
...@@ -50,13 +71,12 @@ class PluginVmImageManager ...@@ -50,13 +71,12 @@ class PluginVmImageManager
base::TimeDelta elapsed_time) = 0; base::TimeDelta elapsed_time) = 0;
virtual void OnDownloadCompleted() = 0; virtual void OnDownloadCompleted() = 0;
virtual void OnDownloadCancelled() = 0; virtual void OnDownloadCancelled() = 0;
// TODO(https://crbug.com/904851): Add failure reasons. virtual void OnDownloadFailed(FailureReason reason) = 0;
virtual void OnDownloadFailed() = 0;
virtual void OnImportProgressUpdated(int percent_completed, virtual void OnImportProgressUpdated(int percent_completed,
base::TimeDelta elapsed_time) = 0; base::TimeDelta elapsed_time) = 0;
virtual void OnImported() = 0; virtual void OnImported() = 0;
virtual void OnImportCancelled() = 0; virtual void OnImportCancelled() = 0;
virtual void OnImportFailed() = 0; virtual void OnImportFailed(FailureReason reason) = 0;
}; };
explicit PluginVmImageManager(Profile* profile); explicit PluginVmImageManager(Profile* profile);
...@@ -86,7 +106,7 @@ class PluginVmImageManager ...@@ -86,7 +106,7 @@ class PluginVmImageManager
int64_t content_length); int64_t content_length);
void OnDownloadCompleted(const download::CompletionInfo& info); void OnDownloadCompleted(const download::CompletionInfo& info);
void OnDownloadCancelled(); void OnDownloadCancelled();
void OnDownloadFailed(); void OnDownloadFailed(FailureReason reason);
// ConciergeClient::DiskImageObserver: // ConciergeClient::DiskImageObserver:
void OnDiskImageProgress( void OnDiskImageProgress(
...@@ -171,8 +191,9 @@ class PluginVmImageManager ...@@ -171,8 +191,9 @@ class PluginVmImageManager
void OnFinalDiskImageStatus( void OnFinalDiskImageStatus(
base::Optional<vm_tools::concierge::DiskImageStatusResponse> reply); base::Optional<vm_tools::concierge::DiskImageStatusResponse> reply);
// Finishes the processing of PluginVm image. // Finishes the processing of PluginVm image. If |failure_reason| has a value,
void OnImported(bool success); // then the import has failed, otherwise it was successful.
void OnImported(base::Optional<FailureReason> failure_reason);
// Callback for the concierge CancelDiskImageOperation call. // Callback for the concierge CancelDiskImageOperation call.
void OnImportDiskImageCancelled( void OnImportDiskImageCancelled(
......
...@@ -62,12 +62,14 @@ class MockObserver : public PluginVmImageManager::Observer { ...@@ -62,12 +62,14 @@ class MockObserver : public PluginVmImageManager::Observer {
base::TimeDelta elapsed_time)); base::TimeDelta elapsed_time));
MOCK_METHOD0(OnDownloadCompleted, void()); MOCK_METHOD0(OnDownloadCompleted, void());
MOCK_METHOD0(OnDownloadCancelled, void()); MOCK_METHOD0(OnDownloadCancelled, void());
MOCK_METHOD0(OnDownloadFailed, void()); MOCK_METHOD1(OnDownloadFailed,
void(plugin_vm::PluginVmImageManager::FailureReason));
MOCK_METHOD2(OnImportProgressUpdated, MOCK_METHOD2(OnImportProgressUpdated,
void(int percent_completed, base::TimeDelta elapsed_time)); void(int percent_completed, base::TimeDelta elapsed_time));
MOCK_METHOD0(OnImported, void()); MOCK_METHOD0(OnImported, void());
MOCK_METHOD0(OnImportCancelled, void()); MOCK_METHOD0(OnImportCancelled, void());
MOCK_METHOD0(OnImportFailed, void()); MOCK_METHOD1(OnImportFailed,
void(plugin_vm::PluginVmImageManager::FailureReason));
}; };
class PluginVmImageManagerTest : public testing::Test { class PluginVmImageManagerTest : public testing::Test {
...@@ -252,7 +254,10 @@ TEST_F(PluginVmImageManagerTest, CanProceedWithANewImageWhenSucceededTest) { ...@@ -252,7 +254,10 @@ TEST_F(PluginVmImageManagerTest, CanProceedWithANewImageWhenSucceededTest) {
TEST_F(PluginVmImageManagerTest, CanProceedWithANewImageWhenFailedTest) { TEST_F(PluginVmImageManagerTest, CanProceedWithANewImageWhenFailedTest) {
SetupConciergeForSuccessfulDiskImageImport(fake_concierge_client_); SetupConciergeForSuccessfulDiskImageImport(fake_concierge_client_);
EXPECT_CALL(*observer_, OnDownloadFailed()); EXPECT_CALL(
*observer_,
OnDownloadFailed(
PluginVmImageManager::FailureReason::DOWNLOAD_FAILED_ABORTED));
EXPECT_CALL(*observer_, OnDownloadCompleted()); EXPECT_CALL(*observer_, OnDownloadCompleted());
EXPECT_CALL(*observer_, OnImportProgressUpdated(50.0, _)); EXPECT_CALL(*observer_, OnImportProgressUpdated(50.0, _));
EXPECT_CALL(*observer_, OnImported()); EXPECT_CALL(*observer_, OnImported());
...@@ -287,7 +292,9 @@ TEST_F(PluginVmImageManagerTest, ImportNonExistingImageTest) { ...@@ -287,7 +292,9 @@ TEST_F(PluginVmImageManagerTest, ImportNonExistingImageTest) {
SetupConciergeForSuccessfulDiskImageImport(fake_concierge_client_); SetupConciergeForSuccessfulDiskImageImport(fake_concierge_client_);
EXPECT_CALL(*observer_, OnDownloadCompleted()); EXPECT_CALL(*observer_, OnDownloadCompleted());
EXPECT_CALL(*observer_, OnImportFailed()); EXPECT_CALL(*observer_,
OnImportFailed(
PluginVmImageManager::FailureReason::COULD_NOT_OPEN_IMAGE));
ProcessImageUntilImporting(); ProcessImageUntilImporting();
// Should fail as fake downloaded file isn't set. // Should fail as fake downloaded file isn't set.
...@@ -318,7 +325,9 @@ TEST_F(PluginVmImageManagerTest, CancelledImportTest) { ...@@ -318,7 +325,9 @@ TEST_F(PluginVmImageManagerTest, CancelledImportTest) {
TEST_F(PluginVmImageManagerTest, EmptyPluginVmImageUrlTest) { TEST_F(PluginVmImageManagerTest, EmptyPluginVmImageUrlTest) {
SetPluginVmImagePref("", kHash); SetPluginVmImagePref("", kHash);
EXPECT_CALL(*observer_, OnDownloadFailed()); EXPECT_CALL(
*observer_,
OnDownloadFailed(PluginVmImageManager::FailureReason::INVALID_IMAGE_URL));
ProcessImageUntilImporting(); ProcessImageUntilImporting();
histogram_tester_->ExpectTotalCount(kPluginVmImageDownloadedSizeHistogram, 0); histogram_tester_->ExpectTotalCount(kPluginVmImageDownloadedSizeHistogram, 0);
...@@ -334,7 +343,9 @@ TEST_F(PluginVmImageManagerTest, VerifyDownloadTest) { ...@@ -334,7 +343,9 @@ TEST_F(PluginVmImageManagerTest, VerifyDownloadTest) {
TEST_F(PluginVmImageManagerTest, CannotStartDownloadIfPluginVmGetsDisabled) { TEST_F(PluginVmImageManagerTest, CannotStartDownloadIfPluginVmGetsDisabled) {
profile_->ScopedCrosSettingsTestHelper()->SetBoolean( profile_->ScopedCrosSettingsTestHelper()->SetBoolean(
chromeos::kPluginVmAllowed, false); chromeos::kPluginVmAllowed, false);
EXPECT_CALL(*observer_, OnDownloadFailed()); EXPECT_CALL(
*observer_,
OnDownloadFailed(PluginVmImageManager::FailureReason::NOT_ALLOWED));
ProcessImageUntilImporting(); ProcessImageUntilImporting();
} }
......
...@@ -285,7 +285,8 @@ void PluginVmLauncherView::OnDownloadCancelled() { ...@@ -285,7 +285,8 @@ void PluginVmLauncherView::OnDownloadCancelled() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
} }
void PluginVmLauncherView::OnDownloadFailed() { void PluginVmLauncherView::OnDownloadFailed(
plugin_vm::PluginVmImageManager::FailureReason reason) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
state_ = State::ERROR; state_ = State::ERROR;
...@@ -308,7 +309,8 @@ void PluginVmLauncherView::OnImportCancelled() { ...@@ -308,7 +309,8 @@ void PluginVmLauncherView::OnImportCancelled() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
} }
void PluginVmLauncherView::OnImportFailed() { void PluginVmLauncherView::OnImportFailed(
plugin_vm::PluginVmImageManager::FailureReason reason) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
state_ = State::ERROR; state_ = State::ERROR;
...@@ -396,6 +398,7 @@ void PluginVmLauncherView::AddedToWidget() { ...@@ -396,6 +398,7 @@ void PluginVmLauncherView::AddedToWidget() {
} }
void PluginVmLauncherView::OnStateUpdated() { void PluginVmLauncherView::OnStateUpdated() {
// TODO(https://crbug.com/1017511): display failure reasons.
SetBigMessageLabel(); SetBigMessageLabel();
SetMessageLabel(); SetMessageLabel();
SetBigImage(); SetBigImage();
......
...@@ -44,12 +44,14 @@ class PluginVmLauncherView : public views::BubbleDialogDelegateView, ...@@ -44,12 +44,14 @@ class PluginVmLauncherView : public views::BubbleDialogDelegateView,
base::TimeDelta elapsed_time) override; base::TimeDelta elapsed_time) override;
void OnDownloadCompleted() override; void OnDownloadCompleted() override;
void OnDownloadCancelled() override; void OnDownloadCancelled() override;
void OnDownloadFailed() override; void OnDownloadFailed(
plugin_vm::PluginVmImageManager::FailureReason reason) override;
void OnImportProgressUpdated(int percent_completed, void OnImportProgressUpdated(int percent_completed,
base::TimeDelta elapsed_time) override; base::TimeDelta elapsed_time) override;
void OnImported() override; void OnImported() override;
void OnImportCancelled() override; void OnImportCancelled() override;
void OnImportFailed() override; void OnImportFailed(
plugin_vm::PluginVmImageManager::FailureReason reason) override;
// Public for testing purposes. // Public for testing purposes.
base::string16 GetBigMessage() const; base::string16 GetBigMessage() const;
......
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