| OLD | NEW |
| 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/app_launch_utils.h" | 5 #include "chrome/browser/chromeos/app_mode/app_launch_utils.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 8 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 9 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" | 9 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
| 10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void InitializeNetwork() override { | 36 void InitializeNetwork() override { |
| 37 // This is on crash-restart path and assumes network is online. | 37 // This is on crash-restart path and assumes network is online. |
| 38 // TODO(xiyuan): Remove the crash-restart path for kiosk or add proper | 38 // TODO(xiyuan): Remove the crash-restart path for kiosk or add proper |
| 39 // network configure handling. | 39 // network configure handling. |
| 40 startup_app_launcher_->ContinueWithNetworkReady(); | 40 startup_app_launcher_->ContinueWithNetworkReady(); |
| 41 } | 41 } |
| 42 bool IsNetworkReady() override { | 42 bool IsNetworkReady() override { |
| 43 // See comments above. Network is assumed to be online here. | 43 // See comments above. Network is assumed to be online here. |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 bool ShouldSkipAppInstallation() override { |
| 47 // Given that this delegate does not reliably report whether the network is |
| 48 // ready, avoid making app update checks - this might take a while if |
| 49 // network is not online. Also, during crash-restart, we should continue |
| 50 // with the same app version as the restored session. |
| 51 return true; |
| 52 } |
| 46 void OnLoadingOAuthFile() override {} | 53 void OnLoadingOAuthFile() override {} |
| 47 void OnInitializingTokenService() override {} | 54 void OnInitializingTokenService() override {} |
| 48 void OnInstallingApp() override {} | 55 void OnInstallingApp() override {} |
| 49 void OnReadyToLaunch() override { startup_app_launcher_->LaunchApp(); } | 56 void OnReadyToLaunch() override { startup_app_launcher_->LaunchApp(); } |
| 50 void OnLaunchSucceeded() override { Cleanup(); } | 57 void OnLaunchSucceeded() override { Cleanup(); } |
| 51 void OnLaunchFailed(KioskAppLaunchError::Error error) override { | 58 void OnLaunchFailed(KioskAppLaunchError::Error error) override { |
| 52 KioskAppLaunchError::Save(error); | 59 KioskAppLaunchError::Save(error); |
| 53 chrome::AttemptUserExit(); | 60 chrome::AttemptUserExit(); |
| 54 Cleanup(); | 61 Cleanup(); |
| 55 } | 62 } |
| 56 bool IsShowingNetworkConfigScreen() override { return false; } | 63 bool IsShowingNetworkConfigScreen() override { return false; } |
| 57 | 64 |
| 58 std::unique_ptr<StartupAppLauncher> startup_app_launcher_; | 65 std::unique_ptr<StartupAppLauncher> startup_app_launcher_; |
| 59 | 66 |
| 60 DISALLOW_COPY_AND_ASSIGN(AppLaunchManager); | 67 DISALLOW_COPY_AND_ASSIGN(AppLaunchManager); |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 void LaunchAppOrDie(Profile* profile, const std::string& app_id) { | 70 void LaunchAppOrDie(Profile* profile, const std::string& app_id) { |
| 64 // AppLaunchManager manages its own lifetime. | 71 // AppLaunchManager manages its own lifetime. |
| 65 (new AppLaunchManager(profile, app_id))->Start(); | 72 (new AppLaunchManager(profile, app_id))->Start(); |
| 66 } | 73 } |
| 67 | 74 |
| 68 } // namespace chromeos | 75 } // namespace chromeos |
| OLD | NEW |