| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 22 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 23 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 23 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 24 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 24 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
| 25 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 25 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 27 #include "chrome/browser/chromeos/settings/cros_settings.h" | 27 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 28 #include "chrome/browser/lifetime/application_lifetime.h" | 28 #include "chrome/browser/lifetime/application_lifetime.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" | 30 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" |
| 31 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 31 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 32 #include "chromeos/settings/cros_settings_names.h" |
| 32 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
| 33 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 34 #include "extensions/browser/app_window/app_window.h" | 35 #include "extensions/browser/app_window/app_window.h" |
| 35 #include "extensions/browser/app_window/app_window_registry.h" | 36 #include "extensions/browser/app_window/app_window_registry.h" |
| 36 #include "net/base/network_change_notifier.h" | 37 #include "net/base/network_change_notifier.h" |
| 37 | 38 |
| 38 namespace chromeos { | 39 namespace chromeos { |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 network_wait_timedout_(false), | 120 network_wait_timedout_(false), |
| 120 showing_network_dialog_(false), | 121 showing_network_dialog_(false), |
| 121 network_config_requested_(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(bool is_auto_launch) { |
| 130 DVLOG(1) << "Starting kiosk mode..."; | 131 DVLOG(1) << "Starting kiosk mode..."; |
| 131 | 132 |
| 132 webui_visible_ = host_->GetWebUILoginView()->webui_visible(); | 133 webui_visible_ = host_->GetWebUILoginView()->webui_visible(); |
| 133 if (!webui_visible_) { | 134 if (!webui_visible_) { |
| 134 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 135 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| 135 content::NotificationService::AllSources()); | 136 content::NotificationService::AllSources()); |
| 136 } | 137 } |
| 137 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); | 138 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); |
| 138 | 139 |
| 139 // TODO(tengs): Add a loading profile app launch state. | 140 // TODO(tengs): Add a loading profile app launch state. |
| 140 app_launch_splash_screen_actor_->SetDelegate(this); | 141 app_launch_splash_screen_actor_->SetDelegate(this); |
| 141 app_launch_splash_screen_actor_->Show(app_id_); | 142 app_launch_splash_screen_actor_->Show(app_id_); |
| 142 | 143 |
| 143 KioskAppManager::App app; | 144 KioskAppManager::App app; |
| 144 CHECK(KioskAppManager::Get()); | 145 CHECK(KioskAppManager::Get()); |
| 145 CHECK(KioskAppManager::Get()->GetApp(app_id_, &app)); | 146 CHECK(KioskAppManager::Get()->GetApp(app_id_, &app)); |
| 147 |
| 148 if (is_auto_launch) { |
| 149 int delay; |
| 150 if (!CrosSettings::Get()->GetInteger( |
| 151 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { |
| 152 delay = 0; |
| 153 } |
| 154 DCHECK_EQ(0, delay) << "Kiosks do not support non-zero auto-login delays"; |
| 155 |
| 156 // If we are launching a kiosk app with zero delay, mark it appropriately. |
| 157 if (delay == 0) |
| 158 KioskAppManager::Get()->SetAppWasAutoLaunchedWithZeroDelay(app_id_); |
| 159 } |
| 160 |
| 146 kiosk_profile_loader_.reset( | 161 kiosk_profile_loader_.reset( |
| 147 new KioskProfileLoader(app.user_id, false, this)); | 162 new KioskProfileLoader(app.user_id, false, this)); |
| 148 kiosk_profile_loader_->Start(); | 163 kiosk_profile_loader_->Start(); |
| 149 } | 164 } |
| 150 | 165 |
| 151 // static | 166 // static |
| 152 void AppLaunchController::SkipSplashWaitForTesting() { | 167 void AppLaunchController::SkipSplashWaitForTesting() { |
| 153 skip_splash_wait_ = true; | 168 skip_splash_wait_ = true; |
| 154 } | 169 } |
| 155 | 170 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 KioskAppLaunchError::Save(error); | 433 KioskAppLaunchError::Save(error); |
| 419 chrome::AttemptUserExit(); | 434 chrome::AttemptUserExit(); |
| 420 CleanUp(); | 435 CleanUp(); |
| 421 } | 436 } |
| 422 | 437 |
| 423 bool AppLaunchController::IsShowingNetworkConfigScreen() { | 438 bool AppLaunchController::IsShowingNetworkConfigScreen() { |
| 424 return network_config_requested_; | 439 return network_config_requested_; |
| 425 } | 440 } |
| 426 | 441 |
| 427 } // namespace chromeos | 442 } // namespace chromeos |
| OLD | NEW |