Commit ade8f1f7 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Fix removing spinner on crostini apps

We now only remove the spinner from crostini apps after the
window is showing, and we ensure that the icon stays in the same
position the whole time.

In crrev.com/c/2294742, I changed to always call CloseSpinner when
a crostini app is launched.  The result of this is that we were
removing the spinner and icon from the shelf, and then the icon was
being added back later (usually a few seconds) when the window appears.
Note that it was possible that the shelf position could change if
other apps were opened while the spinner was showing.

Bug: 1132089
Change-Id: I1b03c0df5f88ffa892d352b0fdfc36f93daa0a47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532341
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827670}
parent 40382efe
...@@ -106,11 +106,6 @@ void OnApplicationLaunched(const std::string& app_id, ...@@ -106,11 +106,6 @@ void OnApplicationLaunched(const std::string& app_id,
const crostini::CrostiniResult failure_result, const crostini::CrostiniResult failure_result,
bool success, bool success,
const std::string& failure_reason) { const std::string& failure_reason) {
// Remove the spinner. Controller doesn't exist in tests.
// TODO(timloh): Consider also displaying a notification for failure.
if (auto* chrome_controller = ChromeLauncherController::instance()) {
chrome_controller->GetShelfSpinnerController()->CloseSpinner(app_id);
}
RecordAppLaunchResultHistogram(success ? crostini::CrostiniResult::SUCCESS RecordAppLaunchResultHistogram(success ? crostini::CrostiniResult::SUCCESS
: failure_result); : failure_result);
std::move(callback).Run(success, failure_reason); std::move(callback).Run(success, failure_reason);
...@@ -121,6 +116,11 @@ void OnLaunchFailed( ...@@ -121,6 +116,11 @@ void OnLaunchFailed(
crostini::CrostiniSuccessCallback callback, crostini::CrostiniSuccessCallback callback,
const std::string& failure_reason, const std::string& failure_reason,
crostini::CrostiniResult result = crostini::CrostiniResult::UNKNOWN_ERROR) { crostini::CrostiniResult result = crostini::CrostiniResult::UNKNOWN_ERROR) {
// Remove the spinner and icon. Controller doesn't exist in tests.
// TODO(timloh): Consider also displaying a notification for failure.
if (auto* chrome_controller = ChromeLauncherController::instance()) {
chrome_controller->GetShelfSpinnerController()->CloseSpinner(app_id);
}
OnApplicationLaunched(app_id, std::move(callback), result, false, OnApplicationLaunched(app_id, std::move(callback), result, false,
failure_reason); failure_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