Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: chrome/browser/chromeos/app_mode/startup_app_launcher.cc

Issue 2669203006: When restoring kiosk app after crash, skip app installation steps. Installed apps should already be… (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/app_mode/startup_app_launcher.cc
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
index 3142516dc7aaa104514f8e26b9e618c570c31b90..ed2177c8a7c72b39c77475d55852ec887e9495b3 100644
--- a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
+++ b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
@@ -96,14 +96,21 @@ void StartupAppLauncher::Initialize() {
}
void StartupAppLauncher::ContinueWithNetworkReady() {
- if (!network_ready_handled_) {
- network_ready_handled_ = true;
- // The network might not be ready when KioskAppManager tries to update
- // external cache initially. Update the external cache now that the network
- // is ready for sure.
- wait_for_crx_update_ = true;
- KioskAppManager::Get()->UpdateExternalCache();
+ if (network_ready_handled_)
+ return;
+
+ network_ready_handled_ = true;
+
+ if (delegate_->ShouldSkipAppInstallation()) {
+ MaybeLaunchApp();
+ return;
}
+
+ // The network might not be ready when KioskAppManager tries to update
+ // external cache initially. Update the external cache now that the network
+ // is ready for sure.
+ wait_for_crx_update_ = true;
+ KioskAppManager::Get()->UpdateExternalCache();
}
void StartupAppLauncher::StartLoadingOAuthFile() {
@@ -188,6 +195,11 @@ void StartupAppLauncher::MaybeInitializeNetwork() {
return;
}
+ if (delegate_->ShouldSkipAppInstallation()) {
+ MaybeLaunchApp();
+ return;
+ }
+
// Update the offline enabled crx cache if the network is ready;
// or just install the app.
if (delegate_->IsNetworkReady())
@@ -243,11 +255,20 @@ void StartupAppLauncher::OnRefreshTokensLoaded() {
}
void StartupAppLauncher::MaybeLaunchApp() {
- // Check if the app is offline enabled.
const Extension* extension = GetPrimaryAppExtension();
- DCHECK(extension);
+ // Verify that requred apps are installed. While the apps should be
+ // present at this point, crash recovery flow skips app installation steps -
+ // this means that the kiosk app might not yet be downloaded. If that is
+ // the case, bail out from the app launch.
+ if (!extension || !AreSecondaryAppsInstalled()) {
+ OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_LAUNCH);
+ return;
+ }
+
const bool offline_enabled =
extensions::OfflineEnabledInfo::IsOfflineEnabled(extension);
+ // If the app is not offline enabled, make sure the network is ready before
+ // launching.
if (offline_enabled || delegate_->IsNetworkReady()) {
BrowserThread::PostTask(
BrowserThread::UI,
« no previous file with comments | « chrome/browser/chromeos/app_mode/startup_app_launcher.h ('k') | chrome/browser/chromeos/login/app_launch_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698