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" |
57 #include "chromeos/chromeos_switches.h" | 58 #include "chromeos/chromeos_switches.h" |
58 #include "chromeos/dbus/dbus_thread_manager.h" | 59 #include "chromeos/dbus/dbus_thread_manager.h" |
59 #include "chromeos/dbus/session_manager_client.h" | 60 #include "chromeos/dbus/session_manager_client.h" |
60 #include "chromeos/login/login_state.h" | 61 #include "chromeos/login/login_state.h" |
61 #include "chromeos/settings/timezone_settings.h" | 62 #include "chromeos/settings/timezone_settings.h" |
| 63 #include "chromeos/timezone/timezone_resolver.h" |
62 #include "components/session_manager/core/session_manager.h" | 64 #include "components/session_manager/core/session_manager.h" |
63 #include "components/user_manager/user_manager.h" | 65 #include "components/user_manager/user_manager.h" |
64 #include "content/public/browser/notification_service.h" | 66 #include "content/public/browser/notification_service.h" |
65 #include "content/public/browser/notification_types.h" | 67 #include "content/public/browser/notification_types.h" |
66 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
67 #include "content/public/browser/web_ui.h" | 69 #include "content/public/browser/web_ui.h" |
68 #include "media/audio/sounds/sounds_manager.h" | 70 #include "media/audio/sounds/sounds_manager.h" |
69 #include "ui/aura/window.h" | 71 #include "ui/aura/window.h" |
70 #include "ui/base/ime/chromeos/extension_ime_util.h" | 72 #include "ui/base/ime/chromeos/extension_ime_util.h" |
71 #include "ui/base/ime/chromeos/input_method_manager.h" | 73 #include "ui/base/ime/chromeos/input_method_manager.h" |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); | 1146 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); |
1145 } | 1147 } |
1146 | 1148 |
1147 void LoginDisplayHostImpl::OnLoginPromptVisible() { | 1149 void LoginDisplayHostImpl::OnLoginPromptVisible() { |
1148 if (!login_prompt_visible_time_.is_null()) | 1150 if (!login_prompt_visible_time_.is_null()) |
1149 return; | 1151 return; |
1150 login_prompt_visible_time_ = base::TimeTicks::Now(); | 1152 login_prompt_visible_time_ = base::TimeTicks::Now(); |
1151 TryToPlayStartupSound(); | 1153 TryToPlayStartupSound(); |
1152 } | 1154 } |
1153 | 1155 |
| 1156 void LoginDisplayHostImpl::StartTimeZoneResolve() { |
| 1157 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1158 chromeos::switches::kEnableTimeZoneTrackingOption)) { |
| 1159 return; |
| 1160 } |
| 1161 |
| 1162 if (!g_browser_process->local_state()->GetBoolean( |
| 1163 prefs::kResolveDeviceTimezoneByGeolocation)) { |
| 1164 return; |
| 1165 } |
| 1166 |
| 1167 if (system::HasSystemTimezonePolicy()) |
| 1168 return; |
| 1169 |
| 1170 // Do not start resolver if we are inside active user session. |
| 1171 // If user preferences permit, it will be started on preferences |
| 1172 // initialization. |
| 1173 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginUser)) |
| 1174 return; |
| 1175 |
| 1176 g_browser_process->platform_part()->timezone_resolver()->Start(); |
| 1177 } |
| 1178 |
1154 //////////////////////////////////////////////////////////////////////////////// | 1179 //////////////////////////////////////////////////////////////////////////////// |
1155 // external | 1180 // external |
1156 | 1181 |
1157 // Declared in login_wizard.h so that others don't need to depend on our .h. | 1182 // 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. | 1183 // TODO(nkostylev): Split this into a smaller functions. |
1159 void ShowLoginWizard(const std::string& first_screen_name) { | 1184 void ShowLoginWizard(const std::string& first_screen_name) { |
1160 if (browser_shutdown::IsTryingToQuit()) | 1185 if (browser_shutdown::IsTryingToQuit()) |
1161 return; | 1186 return; |
1162 | 1187 |
1163 VLOG(1) << "Showing OOBE screen: " << first_screen_name; | 1188 VLOG(1) << "Showing OOBE screen: " << first_screen_name; |
(...skipping 21 matching lines...) Expand all Loading... |
1185 switches::kNaturalScrollDefault)); | 1210 switches::kNaturalScrollDefault)); |
1186 #endif | 1211 #endif |
1187 | 1212 |
1188 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 1213 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
1189 | 1214 |
1190 g_browser_process->platform_part()->SessionManager()->SetSessionState( | 1215 g_browser_process->platform_part()->SessionManager()->SetSessionState( |
1191 StartupUtils::IsOobeCompleted() | 1216 StartupUtils::IsOobeCompleted() |
1192 ? session_manager::SESSION_STATE_LOGIN_PRIMARY | 1217 ? session_manager::SESSION_STATE_LOGIN_PRIMARY |
1193 : session_manager::SESSION_STATE_OOBE); | 1218 : session_manager::SESSION_STATE_OOBE); |
1194 | 1219 |
1195 LoginDisplayHost* display_host = new LoginDisplayHostImpl(screen_bounds); | 1220 LoginDisplayHostImpl* display_host = new LoginDisplayHostImpl(screen_bounds); |
1196 | 1221 |
1197 bool show_app_launch_splash_screen = | 1222 bool show_app_launch_splash_screen = |
1198 (first_screen_name == WizardController::kAppLaunchSplashScreenName); | 1223 (first_screen_name == WizardController::kAppLaunchSplashScreenName); |
1199 if (show_app_launch_splash_screen) { | 1224 if (show_app_launch_splash_screen) { |
1200 const std::string& auto_launch_app_id = | 1225 const std::string& auto_launch_app_id = |
1201 KioskAppManager::Get()->GetAutoLaunchApp(); | 1226 KioskAppManager::Get()->GetAutoLaunchApp(); |
1202 display_host->StartAppLaunch(auto_launch_app_id, | 1227 display_host->StartAppLaunch(auto_launch_app_id, |
1203 false /* diagnostic_mode */); | 1228 false /* diagnostic_mode */); |
1204 return; | 1229 return; |
1205 } | 1230 } |
1206 | 1231 |
1207 // Check whether we need to execute OOBE flow. | 1232 // Check whether we need to execute OOBE flow. |
1208 const policy::EnrollmentConfig enrollment_config = | 1233 const policy::EnrollmentConfig enrollment_config = |
1209 g_browser_process->platform_part() | 1234 g_browser_process->platform_part() |
1210 ->browser_policy_connector_chromeos() | 1235 ->browser_policy_connector_chromeos() |
1211 ->GetPrescribedEnrollmentConfig(); | 1236 ->GetPrescribedEnrollmentConfig(); |
1212 if (enrollment_config.should_enroll() && first_screen_name.empty()) { | 1237 if (enrollment_config.should_enroll() && first_screen_name.empty()) { |
1213 // Shows networks screen instead of enrollment screen to resume the | 1238 // Shows networks screen instead of enrollment screen to resume the |
1214 // interrupted auto start enrollment flow because enrollment screen does | 1239 // interrupted auto start enrollment flow because enrollment screen does |
1215 // not handle flaky network. See http://crbug.com/332572 | 1240 // not handle flaky network. See http://crbug.com/332572 |
1216 display_host->StartWizard(WizardController::kNetworkScreenName); | 1241 display_host->StartWizard(WizardController::kNetworkScreenName); |
1217 return; | 1242 return; |
1218 } | 1243 } |
1219 | 1244 |
1220 if (StartupUtils::IsEulaAccepted()) { | 1245 if (StartupUtils::IsEulaAccepted()) { |
1221 DelayNetworkCall( | 1246 DelayNetworkCall( |
| 1247 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS), |
1222 ServicesCustomizationDocument::GetInstance() | 1248 ServicesCustomizationDocument::GetInstance() |
1223 ->EnsureCustomizationAppliedClosure(), | 1249 ->EnsureCustomizationAppliedClosure()); |
1224 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS)); | 1250 |
| 1251 display_host->StartTimeZoneResolve(); |
1225 } | 1252 } |
1226 | 1253 |
1227 bool show_login_screen = | 1254 bool show_login_screen = |
1228 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || | 1255 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || |
1229 first_screen_name == WizardController::kLoginScreenName; | 1256 first_screen_name == WizardController::kLoginScreenName; |
1230 | 1257 |
1231 if (show_login_screen) { | 1258 if (show_login_screen) { |
1232 display_host->StartSignInScreen(LoginScreenContext()); | 1259 display_host->StartSignInScreen(LoginScreenContext()); |
1233 return; | 1260 return; |
1234 } | 1261 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 | 1302 |
1276 locale_util::SwitchLanguageCallback callback( | 1303 locale_util::SwitchLanguageCallback callback( |
1277 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); | 1304 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); |
1278 | 1305 |
1279 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1306 // Load locale keyboards here. Hardware layout would be automatically enabled. |
1280 locale_util::SwitchLanguage( | 1307 locale_util::SwitchLanguage( |
1281 locale, true, true /* login_layouts_only */, callback); | 1308 locale, true, true /* login_layouts_only */, callback); |
1282 } | 1309 } |
1283 | 1310 |
1284 } // namespace chromeos | 1311 } // namespace chromeos |
OLD | NEW |