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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/lifetime/application_lifetime.h" | 29 #include "chrome/browser/lifetime/application_lifetime.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" | 31 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" |
32 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 32 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
33 #include "chromeos/settings/cros_settings_names.h" | 33 #include "chromeos/settings/cros_settings_names.h" |
34 #include "components/user_manager/known_user.h" | 34 #include "components/user_manager/known_user.h" |
35 #include "components/user_manager/user_manager.h" | 35 #include "components/user_manager/user_manager.h" |
36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
37 #include "extensions/browser/app_window/app_window.h" | 37 #include "extensions/browser/app_window/app_window.h" |
38 #include "extensions/browser/app_window/app_window_registry.h" | 38 #include "extensions/browser/app_window/app_window_registry.h" |
| 39 #include "extensions/common/features/feature_session_type.h" |
39 #include "net/base/network_change_notifier.h" | 40 #include "net/base/network_change_notifier.h" |
40 | 41 |
41 namespace chromeos { | 42 namespace chromeos { |
42 | 43 |
43 namespace { | 44 namespace { |
44 | 45 |
45 // Enum types for Kiosk.LaunchType UMA so don't change its values. | 46 // Enum types for Kiosk.LaunchType UMA so don't change its values. |
46 // KioskLaunchType in histogram.xml must be updated when making changes here. | 47 // KioskLaunchType in histogram.xml must be updated when making changes here. |
47 enum KioskLaunchType { | 48 enum KioskLaunchType { |
48 KIOSK_LAUNCH_ENTERPRISE_AUTO_LAUNCH = 0, | 49 KIOSK_LAUNCH_ENTERPRISE_AUTO_LAUNCH = 0, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); | 165 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); |
165 | 166 |
166 // TODO(tengs): Add a loading profile app launch state. | 167 // TODO(tengs): Add a loading profile app launch state. |
167 app_launch_splash_screen_actor_->SetDelegate(this); | 168 app_launch_splash_screen_actor_->SetDelegate(this); |
168 app_launch_splash_screen_actor_->Show(app_id_); | 169 app_launch_splash_screen_actor_->Show(app_id_); |
169 | 170 |
170 KioskAppManager::App app; | 171 KioskAppManager::App app; |
171 CHECK(KioskAppManager::Get()); | 172 CHECK(KioskAppManager::Get()); |
172 CHECK(KioskAppManager::Get()->GetApp(app_id_, &app)); | 173 CHECK(KioskAppManager::Get()->GetApp(app_id_, &app)); |
173 | 174 |
| 175 int auto_launch_delay = -1; |
174 if (is_auto_launch) { | 176 if (is_auto_launch) { |
175 int delay; | |
176 if (!CrosSettings::Get()->GetInteger( | 177 if (!CrosSettings::Get()->GetInteger( |
177 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { | 178 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
178 delay = 0; | 179 &auto_launch_delay)) { |
| 180 auto_launch_delay = 0; |
179 } | 181 } |
180 DCHECK_EQ(0, delay) << "Kiosks do not support non-zero auto-login delays"; | 182 DCHECK_EQ(0, auto_launch_delay) |
| 183 << "Kiosks do not support non-zero auto-login delays"; |
181 | 184 |
182 // If we are launching a kiosk app with zero delay, mark it appropriately. | 185 // If we are launching a kiosk app with zero delay, mark it appropriately. |
183 if (delay == 0) | 186 if (auto_launch_delay == 0) |
184 KioskAppManager::Get()->SetAppWasAutoLaunchedWithZeroDelay(app_id_); | 187 KioskAppManager::Get()->SetAppWasAutoLaunchedWithZeroDelay(app_id_); |
185 } | 188 } |
| 189 |
| 190 extensions::SetCurrentFeatureSessionType( |
| 191 is_auto_launch && auto_launch_delay == 0 |
| 192 ? extensions::FeatureSessionType::AUTOLAUNCHED_KIOSK |
| 193 : extensions::FeatureSessionType::KIOSK); |
| 194 |
186 kiosk_profile_loader_.reset( | 195 kiosk_profile_loader_.reset( |
187 new KioskProfileLoader(app.account_id, false, this)); | 196 new KioskProfileLoader(app.account_id, false, this)); |
188 kiosk_profile_loader_->Start(); | 197 kiosk_profile_loader_->Start(); |
189 } | 198 } |
190 | 199 |
191 // static | 200 // static |
192 void AppLaunchController::SkipSplashWaitForTesting() { | 201 void AppLaunchController::SkipSplashWaitForTesting() { |
193 skip_splash_wait_ = true; | 202 skip_splash_wait_ = true; |
194 } | 203 } |
195 | 204 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 KioskAppLaunchError::Save(error); | 492 KioskAppLaunchError::Save(error); |
484 chrome::AttemptUserExit(); | 493 chrome::AttemptUserExit(); |
485 CleanUp(); | 494 CleanUp(); |
486 } | 495 } |
487 | 496 |
488 bool AppLaunchController::IsShowingNetworkConfigScreen() { | 497 bool AppLaunchController::IsShowingNetworkConfigScreen() { |
489 return network_config_requested_; | 498 return network_config_requested_; |
490 } | 499 } |
491 | 500 |
492 } // namespace chromeos | 501 } // namespace chromeos |
OLD | NEW |