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/timer/timer.h" | 7 #include "base/timer/timer.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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 void Cleanup() { delete this; } | 33 void Cleanup() { delete this; } |
34 | 34 |
35 // StartupAppLauncher::Delegate overrides: | 35 // StartupAppLauncher::Delegate overrides: |
36 virtual void InitializeNetwork() OVERRIDE { | 36 virtual 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 virtual bool IsNetworkReady() OVERRIDE { |
| 43 // See comments above. Network is assumed to be online here. |
| 44 return true; |
| 45 } |
42 virtual void OnLoadingOAuthFile() OVERRIDE {} | 46 virtual void OnLoadingOAuthFile() OVERRIDE {} |
43 virtual void OnInitializingTokenService() OVERRIDE {} | 47 virtual void OnInitializingTokenService() OVERRIDE {} |
44 virtual void OnInstallingApp() OVERRIDE {} | 48 virtual void OnInstallingApp() OVERRIDE {} |
45 virtual void OnReadyToLaunch() OVERRIDE { | 49 virtual void OnReadyToLaunch() OVERRIDE { |
46 startup_app_launcher_->LaunchApp(); | 50 startup_app_launcher_->LaunchApp(); |
47 } | 51 } |
48 virtual void OnLaunchSucceeded() OVERRIDE { Cleanup(); } | 52 virtual void OnLaunchSucceeded() OVERRIDE { Cleanup(); } |
49 virtual void OnLaunchFailed(KioskAppLaunchError::Error error) OVERRIDE { | 53 virtual void OnLaunchFailed(KioskAppLaunchError::Error error) OVERRIDE { |
50 KioskAppLaunchError::Save(error); | 54 KioskAppLaunchError::Save(error); |
51 chrome::AttemptUserExit(); | 55 chrome::AttemptUserExit(); |
52 Cleanup(); | 56 Cleanup(); |
53 } | 57 } |
54 | 58 |
55 scoped_ptr<StartupAppLauncher> startup_app_launcher_; | 59 scoped_ptr<StartupAppLauncher> startup_app_launcher_; |
56 | 60 |
57 DISALLOW_COPY_AND_ASSIGN(AppLaunchManager); | 61 DISALLOW_COPY_AND_ASSIGN(AppLaunchManager); |
58 }; | 62 }; |
59 | 63 |
60 void LaunchAppOrDie(Profile* profile, const std::string& app_id) { | 64 void LaunchAppOrDie(Profile* profile, const std::string& app_id) { |
61 // AppLaunchManager manages its own lifetime. | 65 // AppLaunchManager manages its own lifetime. |
62 (new AppLaunchManager(profile, app_id))->Start(); | 66 (new AppLaunchManager(profile, app_id))->Start(); |
63 } | 67 } |
64 | 68 |
65 } // namespace chromeos | 69 } // namespace chromeos |
OLD | NEW |