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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 14 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
15 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" | 15 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" |
16 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" | 16 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
17 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h" | 17 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h" |
18 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h
" | 18 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h
" |
19 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" | 19 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" |
20 | 20 |
21 class Profile; | 21 class Profile; |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 class LoginDisplayHost; | 25 class LoginDisplayHost; |
26 class OobeDisplay; | 26 class OobeDisplay; |
| 27 class UserManager; |
27 | 28 |
28 // Controller for the kiosk app launch process, responsible for | 29 // Controller for the kiosk app launch process, responsible for |
29 // coordinating loading the kiosk profile, launching the app, and | 30 // coordinating loading the kiosk profile, launching the app, and |
30 // updating the splash screen UI. | 31 // updating the splash screen UI. |
31 class AppLaunchController | 32 class AppLaunchController |
32 : public base::SupportsWeakPtr<AppLaunchController>, | 33 : public base::SupportsWeakPtr<AppLaunchController>, |
33 public AppLaunchSplashScreenActor::Delegate, | 34 public AppLaunchSplashScreenActor::Delegate, |
34 public KioskProfileLoader::Delegate, | 35 public KioskProfileLoader::Delegate, |
35 public StartupAppLauncher::Observer, | 36 public StartupAppLauncher::Observer, |
36 public AppLaunchSigninScreen::Delegate { | 37 public AppLaunchSigninScreen::Delegate { |
37 public: | 38 public: |
38 AppLaunchController(const std::string& app_id, | 39 AppLaunchController(const std::string& app_id, |
39 LoginDisplayHost* host, | 40 LoginDisplayHost* host, |
40 OobeDisplay* oobe_display); | 41 OobeDisplay* oobe_display); |
41 | 42 |
42 virtual ~AppLaunchController(); | 43 virtual ~AppLaunchController(); |
43 | 44 |
44 void StartAppLaunch(); | 45 void StartAppLaunch(); |
45 | 46 |
46 static void SkipSplashWaitForTesting(); | 47 // Customize controller for testing purposes. |
| 48 void SkipSplashWaitForTesting(); |
| 49 void SetNetworkWaitForTesting(int wait_time_secs); |
| 50 void SetUserManagerForTesting(UserManager* user_manager); |
47 | 51 |
48 private: | 52 private: |
49 void Cleanup(); | 53 void Cleanup(); |
50 void OnNetworkWaitTimedout(); | 54 void OnNetworkWaitTimedout(); |
| 55 UserManager* GetUserManager(); |
51 | 56 |
52 // KioskProfileLoader::Delegate overrides: | 57 // KioskProfileLoader::Delegate overrides: |
53 virtual void OnProfileLoaded(Profile* profile) OVERRIDE; | 58 virtual void OnProfileLoaded(Profile* profile) OVERRIDE; |
54 virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) OVERRIDE; | 59 virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) OVERRIDE; |
55 | 60 |
56 // AppLaunchSplashScreenActor::Delegate overrides: | 61 // AppLaunchSplashScreenActor::Delegate overrides: |
57 virtual void OnConfigureNetwork() OVERRIDE; | 62 virtual void OnConfigureNetwork() OVERRIDE; |
58 virtual void OnCancelAppLaunch() OVERRIDE; | 63 virtual void OnCancelAppLaunch() OVERRIDE; |
59 | 64 |
60 // StartupAppLauncher::Observer overrides: | 65 // StartupAppLauncher::Observer overrides: |
(...skipping 15 matching lines...) Expand all Loading... |
76 ErrorScreenActor* error_screen_actor_; | 81 ErrorScreenActor* error_screen_actor_; |
77 scoped_ptr<KioskProfileLoader> kiosk_profile_loader_; | 82 scoped_ptr<KioskProfileLoader> kiosk_profile_loader_; |
78 scoped_ptr<StartupAppLauncher> startup_app_launcher_; | 83 scoped_ptr<StartupAppLauncher> startup_app_launcher_; |
79 scoped_ptr<AppLaunchSigninScreen> signin_screen_; | 84 scoped_ptr<AppLaunchSigninScreen> signin_screen_; |
80 | 85 |
81 base::OneShotTimer<AppLaunchController> network_wait_timer_; | 86 base::OneShotTimer<AppLaunchController> network_wait_timer_; |
82 bool waiting_for_network_; | 87 bool waiting_for_network_; |
83 bool showing_network_dialog_; | 88 bool showing_network_dialog_; |
84 int64 launch_splash_start_time_; | 89 int64 launch_splash_start_time_; |
85 | 90 |
86 static bool skip_splash_wait_; | 91 bool skip_splash_wait_for_testing_; |
| 92 int network_wait_time_; |
| 93 UserManager* user_manager_for_testing_; |
87 | 94 |
88 DISALLOW_COPY_AND_ASSIGN(AppLaunchController); | 95 DISALLOW_COPY_AND_ASSIGN(AppLaunchController); |
89 }; | 96 }; |
90 | 97 |
91 } // namespace chromeos | 98 } // namespace chromeos |
92 | 99 |
93 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ | 100 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ |
OLD | NEW |