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

Side by Side Diff: chrome/browser/chromeos/app_mode/startup_app_launcher.cc

Issue 1904323002: kiosk: Install secondary app after DelayNetworkCall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix offline launch Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" 5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
6 6
7 #include "base/bind.h"
7 #include "base/command_line.h" 8 #include "base/command_line.h"
8 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
9 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
15 #include "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h" 16 #include "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h"
16 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 17 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
18 #include "chrome/browser/chromeos/net/delay_network_call.h"
17 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/install_tracker.h" 20 #include "chrome/browser/extensions/install_tracker.h"
19 #include "chrome/browser/extensions/install_tracker_factory.h" 21 #include "chrome/browser/extensions/install_tracker_factory.h"
20 #include "chrome/browser/extensions/updater/extension_updater.h" 22 #include "chrome/browser/extensions/updater/extension_updater.h"
21 #include "chrome/browser/lifetime/application_lifetime.h" 23 #include "chrome/browser/lifetime/application_lifetime.h"
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
23 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
24 #include "chrome/browser/ui/extensions/app_launch_params.h" 26 #include "chrome/browser/ui/extensions/app_launch_params.h"
25 #include "chrome/browser/ui/extensions/application_launch.h" 27 #include "chrome/browser/ui/extensions/application_launch.h"
26 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // Install secondary apps. 504 // Install secondary apps.
503 MaybeInstallSecondaryApps(); 505 MaybeInstallSecondaryApps();
504 } else { 506 } else {
505 // The extension is skipped for installation due to some error. 507 // The extension is skipped for installation due to some error.
506 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL); 508 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL);
507 } 509 }
508 } 510 }
509 511
510 void StartupAppLauncher::MaybeInstallSecondaryApps() { 512 void StartupAppLauncher::MaybeInstallSecondaryApps() {
511 if (!AreSecondaryAppsInstalled() && !delegate_->IsNetworkReady()) { 513 if (!AreSecondaryAppsInstalled() && !delegate_->IsNetworkReady()) {
512 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL); 514 DelayNetworkCall(
515 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS),
516 base::Bind(&StartupAppLauncher::MaybeInstallSecondaryApps,
517 AsWeakPtr()));
513 return; 518 return;
514 } 519 }
515 520
516 secondary_apps_installed_ = true; 521 secondary_apps_installed_ = true;
517 extensions::KioskModeInfo* info = 522 extensions::KioskModeInfo* info =
518 extensions::KioskModeInfo::Get(GetPrimaryAppExtension()); 523 extensions::KioskModeInfo::Get(GetPrimaryAppExtension());
519 KioskAppManager::Get()->InstallSecondaryApps(info->secondary_app_ids); 524 KioskAppManager::Get()->InstallSecondaryApps(info->secondary_app_ids);
520 if (IsAnySecondaryAppPending()) { 525 if (IsAnySecondaryAppPending()) {
521 delegate_->OnInstallingApp(); 526 delegate_->OnInstallingApp();
522 // Observe the crx installation events. 527 // Observe the crx installation events.
(...skipping 16 matching lines...) Expand all
539 UpdateAppData(); 544 UpdateAppData();
540 delegate_->OnReadyToLaunch(); 545 delegate_->OnReadyToLaunch();
541 } 546 }
542 547
543 void StartupAppLauncher::UpdateAppData() { 548 void StartupAppLauncher::UpdateAppData() {
544 KioskAppManager::Get()->ClearAppData(app_id_); 549 KioskAppManager::Get()->ClearAppData(app_id_);
545 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); 550 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL);
546 } 551 }
547 552
548 } // namespace chromeos 553 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698