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