| 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/login/app_launch_controller.h" | 5 #include "chrome/browser/chromeos/login/app_launch_controller.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 diagnostic_mode_(diagnostic_mode), | 112 diagnostic_mode_(diagnostic_mode), |
| 113 host_(host), | 113 host_(host), |
| 114 oobe_display_(oobe_display), | 114 oobe_display_(oobe_display), |
| 115 app_launch_splash_screen_actor_( | 115 app_launch_splash_screen_actor_( |
| 116 oobe_display_->GetAppLaunchSplashScreenActor()), | 116 oobe_display_->GetAppLaunchSplashScreenActor()), |
| 117 webui_visible_(false), | 117 webui_visible_(false), |
| 118 launcher_ready_(false), | 118 launcher_ready_(false), |
| 119 waiting_for_network_(false), | 119 waiting_for_network_(false), |
| 120 network_wait_timedout_(false), | 120 network_wait_timedout_(false), |
| 121 showing_network_dialog_(false), | 121 showing_network_dialog_(false), |
| 122 network_config_requested_(false), |
| 122 launch_splash_start_time_(0) { | 123 launch_splash_start_time_(0) { |
| 123 } | 124 } |
| 124 | 125 |
| 125 AppLaunchController::~AppLaunchController() { | 126 AppLaunchController::~AppLaunchController() { |
| 126 app_launch_splash_screen_actor_->SetDelegate(NULL); | 127 app_launch_splash_screen_actor_->SetDelegate(NULL); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void AppLaunchController::StartAppLaunch() { | 130 void AppLaunchController::StartAppLaunch() { |
| 130 DVLOG(1) << "Starting kiosk mode..."; | 131 DVLOG(1) << "Starting kiosk mode..."; |
| 131 | 132 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 OnReadyToLaunch(); | 210 OnReadyToLaunch(); |
| 210 } | 211 } |
| 211 | 212 |
| 212 void AppLaunchController::OnCancelAppLaunch() { | 213 void AppLaunchController::OnCancelAppLaunch() { |
| 213 if (KioskAppManager::Get()->GetDisableBailoutShortcut()) | 214 if (KioskAppManager::Get()->GetDisableBailoutShortcut()) |
| 214 return; | 215 return; |
| 215 | 216 |
| 216 OnLaunchFailed(KioskAppLaunchError::USER_CANCEL); | 217 OnLaunchFailed(KioskAppLaunchError::USER_CANCEL); |
| 217 } | 218 } |
| 218 | 219 |
| 220 void AppLaunchController::OnNetworkConfigRequested(bool requested) { |
| 221 network_config_requested_ = requested; |
| 222 if (requested) |
| 223 MaybeShowNetworkConfigureUI(); |
| 224 } |
| 225 |
| 219 void AppLaunchController::OnNetworkStateChanged(bool online) { | 226 void AppLaunchController::OnNetworkStateChanged(bool online) { |
| 220 if (!waiting_for_network_) | 227 if (!waiting_for_network_) |
| 221 return; | 228 return; |
| 222 | 229 |
| 223 if (online) | 230 if (online && !network_config_requested_) |
| 224 startup_app_launcher_->ContinueWithNetworkReady(); | 231 startup_app_launcher_->ContinueWithNetworkReady(); |
| 225 else if (network_wait_timedout_) | 232 else if (network_wait_timedout_) |
| 226 MaybeShowNetworkConfigureUI(); | 233 MaybeShowNetworkConfigureUI(); |
| 227 } | 234 } |
| 228 | 235 |
| 229 void AppLaunchController::OnProfileLoaded(Profile* profile) { | 236 void AppLaunchController::OnProfileLoaded(Profile* profile) { |
| 230 DVLOG(1) << "Profile loaded... Starting app launch."; | 237 DVLOG(1) << "Profile loaded... Starting app launch."; |
| 231 profile_ = profile; | 238 profile_ = profile; |
| 232 | 239 |
| 233 kiosk_profile_loader_.reset(); | 240 kiosk_profile_loader_.reset(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 showing_network_dialog_ = true; | 312 showing_network_dialog_ = true; |
| 306 app_launch_splash_screen_actor_->ShowNetworkConfigureUI(); | 313 app_launch_splash_screen_actor_->ShowNetworkConfigureUI(); |
| 307 } | 314 } |
| 308 } else { | 315 } else { |
| 309 app_launch_splash_screen_actor_->UpdateAppLaunchState( | 316 app_launch_splash_screen_actor_->UpdateAppLaunchState( |
| 310 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); | 317 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); |
| 311 } | 318 } |
| 312 } | 319 } |
| 313 | 320 |
| 314 void AppLaunchController::InitializeNetwork() { | 321 void AppLaunchController::InitializeNetwork() { |
| 315 // Show the network configration dialog if network is not initialized | 322 // Show the network configuration dialog if network is not initialized |
| 316 // after a brief wait time. | 323 // after a brief wait time. |
| 317 waiting_for_network_ = true; | 324 waiting_for_network_ = true; |
| 318 network_wait_timer_.Start( | 325 network_wait_timer_.Start( |
| 319 FROM_HERE, | 326 FROM_HERE, |
| 320 base::TimeDelta::FromSeconds(network_wait_time_), | 327 base::TimeDelta::FromSeconds(network_wait_time_), |
| 321 this, &AppLaunchController::OnNetworkWaitTimedout); | 328 this, &AppLaunchController::OnNetworkWaitTimedout); |
| 322 | 329 |
| 323 app_launch_splash_screen_actor_->UpdateAppLaunchState( | 330 app_launch_splash_screen_actor_->UpdateAppLaunchState( |
| 324 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK); | 331 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK); |
| 325 } | 332 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 << ", error=" << error; | 403 << ", error=" << error; |
| 397 DCHECK_NE(KioskAppLaunchError::NONE, error); | 404 DCHECK_NE(KioskAppLaunchError::NONE, error); |
| 398 | 405 |
| 399 // Saves the error and ends the session to go back to login screen. | 406 // Saves the error and ends the session to go back to login screen. |
| 400 KioskAppLaunchError::Save(error); | 407 KioskAppLaunchError::Save(error); |
| 401 chrome::AttemptUserExit(); | 408 chrome::AttemptUserExit(); |
| 402 CleanUp(); | 409 CleanUp(); |
| 403 } | 410 } |
| 404 | 411 |
| 405 } // namespace chromeos | 412 } // namespace chromeos |
| OLD | NEW |