| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 37 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
| 38 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 38 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
| 39 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 39 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 40 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 40 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 41 #include "chrome/browser/chromeos/login/wizard_controller.h" | 41 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 42 #include "chrome/browser/chromeos/mobile_config.h" | 42 #include "chrome/browser/chromeos/mobile_config.h" |
| 43 #include "chrome/browser/chromeos/net/delay_network_call.h" | 43 #include "chrome/browser/chromeos/net/delay_network_call.h" |
| 44 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 44 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 45 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 45 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| 46 #include "chrome/browser/chromeos/system/input_device_settings.h" | 46 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 47 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 47 #include "chrome/browser/chromeos/ui/focus_ring_controller.h" | 48 #include "chrome/browser/chromeos/ui/focus_ring_controller.h" |
| 48 #include "chrome/browser/lifetime/application_lifetime.h" | 49 #include "chrome/browser/lifetime/application_lifetime.h" |
| 49 #include "chrome/browser/profiles/profile_manager.h" | 50 #include "chrome/browser/profiles/profile_manager.h" |
| 50 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 51 #include "chrome/common/chrome_constants.h" | 52 #include "chrome/common/chrome_constants.h" |
| 52 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 54 #include "chrome/grit/browser_resources.h" | 55 #include "chrome/grit/browser_resources.h" |
| 55 #include "chromeos/audio/chromeos_sounds.h" | 56 #include "chromeos/audio/chromeos_sounds.h" |
| 56 #include "chromeos/chromeos_constants.h" | 57 #include "chromeos/chromeos_constants.h" |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); | 1145 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); |
| 1145 } | 1146 } |
| 1146 | 1147 |
| 1147 void LoginDisplayHostImpl::OnLoginPromptVisible() { | 1148 void LoginDisplayHostImpl::OnLoginPromptVisible() { |
| 1148 if (!login_prompt_visible_time_.is_null()) | 1149 if (!login_prompt_visible_time_.is_null()) |
| 1149 return; | 1150 return; |
| 1150 login_prompt_visible_time_ = base::TimeTicks::Now(); | 1151 login_prompt_visible_time_ = base::TimeTicks::Now(); |
| 1151 TryToPlayStartupSound(); | 1152 TryToPlayStartupSound(); |
| 1152 } | 1153 } |
| 1153 | 1154 |
| 1155 void LoginDisplayHostImpl::StartTimeZoneResolve() { |
| 1156 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1157 chromeos::switches::kEnableTimeZoneTrackingOption)) { |
| 1158 return; |
| 1159 } |
| 1160 |
| 1161 if (!g_browser_process->local_state()->GetBoolean( |
| 1162 prefs::kResolveDeviceTimezoneByGeolocation)) { |
| 1163 return; |
| 1164 } |
| 1165 |
| 1166 if (system::HasSystemTimezonePolicy()) |
| 1167 return; |
| 1168 |
| 1169 g_browser_process->platform_part()->timezone_resolver()->Start(); |
| 1170 } |
| 1171 |
| 1154 //////////////////////////////////////////////////////////////////////////////// | 1172 //////////////////////////////////////////////////////////////////////////////// |
| 1155 // external | 1173 // external |
| 1156 | 1174 |
| 1157 // Declared in login_wizard.h so that others don't need to depend on our .h. | 1175 // Declared in login_wizard.h so that others don't need to depend on our .h. |
| 1158 // TODO(nkostylev): Split this into a smaller functions. | 1176 // TODO(nkostylev): Split this into a smaller functions. |
| 1159 void ShowLoginWizard(const std::string& first_screen_name) { | 1177 void ShowLoginWizard(const std::string& first_screen_name) { |
| 1160 if (browser_shutdown::IsTryingToQuit()) | 1178 if (browser_shutdown::IsTryingToQuit()) |
| 1161 return; | 1179 return; |
| 1162 | 1180 |
| 1163 VLOG(1) << "Showing OOBE screen: " << first_screen_name; | 1181 VLOG(1) << "Showing OOBE screen: " << first_screen_name; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1185 switches::kNaturalScrollDefault)); | 1203 switches::kNaturalScrollDefault)); |
| 1186 #endif | 1204 #endif |
| 1187 | 1205 |
| 1188 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 1206 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
| 1189 | 1207 |
| 1190 g_browser_process->platform_part()->SessionManager()->SetSessionState( | 1208 g_browser_process->platform_part()->SessionManager()->SetSessionState( |
| 1191 StartupUtils::IsOobeCompleted() | 1209 StartupUtils::IsOobeCompleted() |
| 1192 ? session_manager::SESSION_STATE_LOGIN_PRIMARY | 1210 ? session_manager::SESSION_STATE_LOGIN_PRIMARY |
| 1193 : session_manager::SESSION_STATE_OOBE); | 1211 : session_manager::SESSION_STATE_OOBE); |
| 1194 | 1212 |
| 1195 LoginDisplayHost* display_host = new LoginDisplayHostImpl(screen_bounds); | 1213 LoginDisplayHostImpl* display_host_impl = |
| 1214 new LoginDisplayHostImpl(screen_bounds); |
| 1215 LoginDisplayHost* display_host = display_host_impl; |
| 1196 | 1216 |
| 1197 bool show_app_launch_splash_screen = | 1217 bool show_app_launch_splash_screen = |
| 1198 (first_screen_name == WizardController::kAppLaunchSplashScreenName); | 1218 (first_screen_name == WizardController::kAppLaunchSplashScreenName); |
| 1199 if (show_app_launch_splash_screen) { | 1219 if (show_app_launch_splash_screen) { |
| 1200 const std::string& auto_launch_app_id = | 1220 const std::string& auto_launch_app_id = |
| 1201 KioskAppManager::Get()->GetAutoLaunchApp(); | 1221 KioskAppManager::Get()->GetAutoLaunchApp(); |
| 1202 display_host->StartAppLaunch(auto_launch_app_id, | 1222 display_host->StartAppLaunch(auto_launch_app_id, |
| 1203 false /* diagnostic_mode */); | 1223 false /* diagnostic_mode */); |
| 1204 return; | 1224 return; |
| 1205 } | 1225 } |
| 1206 | 1226 |
| 1207 // Check whether we need to execute OOBE flow. | 1227 // Check whether we need to execute OOBE flow. |
| 1208 const policy::EnrollmentConfig enrollment_config = | 1228 const policy::EnrollmentConfig enrollment_config = |
| 1209 g_browser_process->platform_part() | 1229 g_browser_process->platform_part() |
| 1210 ->browser_policy_connector_chromeos() | 1230 ->browser_policy_connector_chromeos() |
| 1211 ->GetPrescribedEnrollmentConfig(); | 1231 ->GetPrescribedEnrollmentConfig(); |
| 1212 if (enrollment_config.should_enroll() && first_screen_name.empty()) { | 1232 if (enrollment_config.should_enroll() && first_screen_name.empty()) { |
| 1213 // Shows networks screen instead of enrollment screen to resume the | 1233 // Shows networks screen instead of enrollment screen to resume the |
| 1214 // interrupted auto start enrollment flow because enrollment screen does | 1234 // interrupted auto start enrollment flow because enrollment screen does |
| 1215 // not handle flaky network. See http://crbug.com/332572 | 1235 // not handle flaky network. See http://crbug.com/332572 |
| 1216 display_host->StartWizard(WizardController::kNetworkScreenName); | 1236 display_host->StartWizard(WizardController::kNetworkScreenName); |
| 1217 return; | 1237 return; |
| 1218 } | 1238 } |
| 1219 | 1239 |
| 1220 if (StartupUtils::IsEulaAccepted()) { | 1240 if (StartupUtils::IsEulaAccepted()) { |
| 1221 DelayNetworkCall( | 1241 DelayNetworkCall( |
| 1222 ServicesCustomizationDocument::GetInstance() | 1242 ServicesCustomizationDocument::GetInstance() |
| 1223 ->EnsureCustomizationAppliedClosure(), | 1243 ->EnsureCustomizationAppliedClosure(), |
| 1224 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS)); | 1244 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS)); |
| 1245 |
| 1246 display_host_impl->StartTimeZoneResolve(); |
| 1225 } | 1247 } |
| 1226 | 1248 |
| 1227 bool show_login_screen = | 1249 bool show_login_screen = |
| 1228 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || | 1250 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || |
| 1229 first_screen_name == WizardController::kLoginScreenName; | 1251 first_screen_name == WizardController::kLoginScreenName; |
| 1230 | 1252 |
| 1231 if (show_login_screen) { | 1253 if (show_login_screen) { |
| 1232 display_host->StartSignInScreen(LoginScreenContext()); | 1254 display_host->StartSignInScreen(LoginScreenContext()); |
| 1233 return; | 1255 return; |
| 1234 } | 1256 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 | 1297 |
| 1276 locale_util::SwitchLanguageCallback callback( | 1298 locale_util::SwitchLanguageCallback callback( |
| 1277 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); | 1299 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); |
| 1278 | 1300 |
| 1279 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1301 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1280 locale_util::SwitchLanguage( | 1302 locale_util::SwitchLanguage( |
| 1281 locale, true, true /* login_layouts_only */, callback); | 1303 locale, true, true /* login_layouts_only */, callback); |
| 1282 } | 1304 } |
| 1283 | 1305 |
| 1284 } // namespace chromeos | 1306 } // namespace chromeos |
| OLD | NEW |