Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 startup_app_launcher_.reset( | 259 startup_app_launcher_.reset( |
| 260 new StartupAppLauncher(profile_, app_id_, diagnostic_mode_, this)); | 260 new StartupAppLauncher(profile_, app_id_, diagnostic_mode_, this)); |
| 261 startup_app_launcher_->Initialize(); | 261 startup_app_launcher_->Initialize(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void AppLaunchController::OnProfileLoadFailed( | 264 void AppLaunchController::OnProfileLoadFailed( |
| 265 KioskAppLaunchError::Error error) { | 265 KioskAppLaunchError::Error error) { |
| 266 OnLaunchFailed(error); | 266 OnLaunchFailed(error); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void AppLaunchController::ClearNetworkWaitTimer() { | |
| 270 waiting_for_network_ = false; | |
| 271 network_wait_timer_.Stop(); | |
| 272 } | |
| 273 | |
| 269 void AppLaunchController::CleanUp() { | 274 void AppLaunchController::CleanUp() { |
| 275 ClearNetworkWaitTimer(); | |
| 270 kiosk_profile_loader_.reset(); | 276 kiosk_profile_loader_.reset(); |
| 271 startup_app_launcher_.reset(); | 277 startup_app_launcher_.reset(); |
| 272 splash_wait_timer_.Stop(); | 278 splash_wait_timer_.Stop(); |
| 273 | 279 |
| 274 if (host_) | 280 if (host_) |
| 275 host_->Finalize(); | 281 host_->Finalize(); |
| 276 } | 282 } |
| 277 | 283 |
| 278 void AppLaunchController::OnNetworkWaitTimedout() { | 284 void AppLaunchController::OnNetworkWaitTimedout() { |
| 279 DCHECK(waiting_for_network_); | 285 DCHECK(waiting_for_network_); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 | 369 |
| 364 void AppLaunchController::OnInitializingTokenService() { | 370 void AppLaunchController::OnInitializingTokenService() { |
| 365 app_launch_splash_screen_actor_->UpdateAppLaunchState( | 371 app_launch_splash_screen_actor_->UpdateAppLaunchState( |
| 366 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE); | 372 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE); |
| 367 } | 373 } |
| 368 | 374 |
| 369 void AppLaunchController::OnInstallingApp() { | 375 void AppLaunchController::OnInstallingApp() { |
| 370 app_launch_splash_screen_actor_->UpdateAppLaunchState( | 376 app_launch_splash_screen_actor_->UpdateAppLaunchState( |
| 371 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_INSTALLING_APPLICATION); | 377 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_INSTALLING_APPLICATION); |
| 372 | 378 |
| 373 waiting_for_network_ = false; | 379 ClearNetworkWaitTimer(); |
| 374 network_wait_timer_.Stop(); | |
| 375 app_launch_splash_screen_actor_->ToggleNetworkConfig(false); | 380 app_launch_splash_screen_actor_->ToggleNetworkConfig(false); |
| 376 | 381 |
| 377 // We have connectivity at this point, so we can skip the network | 382 // We have connectivity at this point, so we can skip the network |
| 378 // configuration dialog if it is being shown. | 383 // configuration dialog if it is being shown. |
| 379 if (showing_network_dialog_) { | 384 if (showing_network_dialog_) { |
| 380 app_launch_splash_screen_actor_->Show(app_id_); | 385 app_launch_splash_screen_actor_->Show(app_id_); |
| 381 showing_network_dialog_ = false; | 386 showing_network_dialog_ = false; |
| 382 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); | 387 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); |
| 383 } | 388 } |
| 384 } | 389 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 404 if (!skip_splash_wait_ && time_taken_ms < kAppInstallSplashScreenMinTimeMS) { | 409 if (!skip_splash_wait_ && time_taken_ms < kAppInstallSplashScreenMinTimeMS) { |
| 405 splash_wait_timer_.Start( | 410 splash_wait_timer_.Start( |
| 406 FROM_HERE, | 411 FROM_HERE, |
| 407 base::TimeDelta::FromMilliseconds( | 412 base::TimeDelta::FromMilliseconds( |
| 408 kAppInstallSplashScreenMinTimeMS - time_taken_ms), | 413 kAppInstallSplashScreenMinTimeMS - time_taken_ms), |
| 409 this, | 414 this, |
| 410 &AppLaunchController::OnReadyToLaunch); | 415 &AppLaunchController::OnReadyToLaunch); |
| 411 return; | 416 return; |
| 412 } | 417 } |
| 413 | 418 |
| 419 ClearNetworkWaitTimer(); | |
|
xiyuan
2015/03/06 17:43:52
Let's do this before line 403 (starting splash_wai
jennyz
2015/03/06 18:04:02
Done.
| |
| 414 startup_app_launcher_->LaunchApp(); | 420 startup_app_launcher_->LaunchApp(); |
| 415 } | 421 } |
| 416 | 422 |
| 417 void AppLaunchController::OnLaunchSucceeded() { | 423 void AppLaunchController::OnLaunchSucceeded() { |
| 418 DVLOG(1) << "Kiosk launch succeeded, wait for app window."; | 424 DVLOG(1) << "Kiosk launch succeeded, wait for app window."; |
| 419 app_launch_splash_screen_actor_->UpdateAppLaunchState( | 425 app_launch_splash_screen_actor_->UpdateAppLaunchState( |
| 420 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_WAITING_APP_WINDOW); | 426 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_WAITING_APP_WINDOW); |
| 421 | 427 |
| 422 DCHECK(!app_window_watcher_); | 428 DCHECK(!app_window_watcher_); |
| 423 app_window_watcher_.reset(new AppWindowWatcher(this, app_id_)); | 429 app_window_watcher_.reset(new AppWindowWatcher(this, app_id_)); |
| 424 } | 430 } |
| 425 | 431 |
| 426 void AppLaunchController::OnLaunchFailed(KioskAppLaunchError::Error error) { | 432 void AppLaunchController::OnLaunchFailed(KioskAppLaunchError::Error error) { |
| 427 LOG(ERROR) << "Kiosk launch failed. Will now shut down." | 433 LOG(ERROR) << "Kiosk launch failed. Will now shut down." |
| 428 << ", error=" << error; | 434 << ", error=" << error; |
| 429 DCHECK_NE(KioskAppLaunchError::NONE, error); | 435 DCHECK_NE(KioskAppLaunchError::NONE, error); |
| 430 | 436 |
| 431 // Saves the error and ends the session to go back to login screen. | 437 // Saves the error and ends the session to go back to login screen. |
| 432 KioskAppLaunchError::Save(error); | 438 KioskAppLaunchError::Save(error); |
| 433 chrome::AttemptUserExit(); | 439 chrome::AttemptUserExit(); |
| 434 CleanUp(); | 440 CleanUp(); |
| 435 } | 441 } |
| 436 | 442 |
| 437 bool AppLaunchController::IsShowingNetworkConfigScreen() { | 443 bool AppLaunchController::IsShowingNetworkConfigScreen() { |
| 438 return network_config_requested_; | 444 return network_config_requested_; |
| 439 } | 445 } |
| 440 | 446 |
| 441 } // namespace chromeos | 447 } // namespace chromeos |
| OLD | NEW |