| 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 "ash/audio/sounds.h" | 9 #include "ash/audio/sounds.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "chrome/browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.h" | 43 #include "chrome/browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.h" |
| 44 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 44 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
| 45 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 45 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 46 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 46 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 47 #include "chrome/browser/chromeos/login/wizard_controller.h" | 47 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 48 #include "chrome/browser/chromeos/mobile_config.h" | 48 #include "chrome/browser/chromeos/mobile_config.h" |
| 49 #include "chrome/browser/chromeos/net/delay_network_call.h" | 49 #include "chrome/browser/chromeos/net/delay_network_call.h" |
| 50 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 50 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 51 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 51 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| 52 #include "chrome/browser/chromeos/system/input_device_settings.h" | 52 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 53 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 53 #include "chrome/browser/chromeos/ui/focus_ring_controller.h" | 54 #include "chrome/browser/chromeos/ui/focus_ring_controller.h" |
| 54 #include "chrome/browser/lifetime/application_lifetime.h" | 55 #include "chrome/browser/lifetime/application_lifetime.h" |
| 55 #include "chrome/browser/profiles/profile_manager.h" | 56 #include "chrome/browser/profiles/profile_manager.h" |
| 56 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 57 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 57 #include "chrome/common/chrome_constants.h" | 58 #include "chrome/common/chrome_constants.h" |
| 58 #include "chrome/common/chrome_switches.h" | 59 #include "chrome/common/chrome_switches.h" |
| 59 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 60 #include "chrome/grit/browser_resources.h" | 61 #include "chrome/grit/browser_resources.h" |
| 61 #include "chromeos/audio/chromeos_sounds.h" | 62 #include "chromeos/audio/chromeos_sounds.h" |
| 62 #include "chromeos/chromeos_constants.h" | 63 #include "chromeos/chromeos_constants.h" |
| 63 #include "chromeos/chromeos_switches.h" | 64 #include "chromeos/chromeos_switches.h" |
| 64 #include "chromeos/dbus/dbus_thread_manager.h" | 65 #include "chromeos/dbus/dbus_thread_manager.h" |
| 65 #include "chromeos/dbus/session_manager_client.h" | 66 #include "chromeos/dbus/session_manager_client.h" |
| 66 #include "chromeos/login/login_state.h" | 67 #include "chromeos/login/login_state.h" |
| 67 #include "chromeos/settings/timezone_settings.h" | 68 #include "chromeos/settings/timezone_settings.h" |
| 69 #include "chromeos/timezone/timezone_resolver.h" |
| 68 #include "components/session_manager/core/session_manager.h" | 70 #include "components/session_manager/core/session_manager.h" |
| 69 #include "components/user_manager/user_manager.h" | 71 #include "components/user_manager/user_manager.h" |
| 70 #include "content/public/browser/notification_service.h" | 72 #include "content/public/browser/notification_service.h" |
| 71 #include "content/public/browser/notification_types.h" | 73 #include "content/public/browser/notification_types.h" |
| 72 #include "content/public/browser/web_contents.h" | 74 #include "content/public/browser/web_contents.h" |
| 73 #include "content/public/browser/web_ui.h" | 75 #include "content/public/browser/web_ui.h" |
| 74 #include "media/audio/sounds/sounds_manager.h" | 76 #include "media/audio/sounds/sounds_manager.h" |
| 75 #include "ui/aura/window.h" | 77 #include "ui/aura/window.h" |
| 76 #include "ui/base/ime/chromeos/extension_ime_util.h" | 78 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 77 #include "ui/base/ime/chromeos/input_method_manager.h" | 79 #include "ui/base/ime/chromeos/input_method_manager.h" |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); | 1082 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); |
| 1081 } | 1083 } |
| 1082 | 1084 |
| 1083 void LoginDisplayHostImpl::OnLoginPromptVisible() { | 1085 void LoginDisplayHostImpl::OnLoginPromptVisible() { |
| 1084 if (!login_prompt_visible_time_.is_null()) | 1086 if (!login_prompt_visible_time_.is_null()) |
| 1085 return; | 1087 return; |
| 1086 login_prompt_visible_time_ = base::TimeTicks::Now(); | 1088 login_prompt_visible_time_ = base::TimeTicks::Now(); |
| 1087 TryToPlayStartupSound(); | 1089 TryToPlayStartupSound(); |
| 1088 } | 1090 } |
| 1089 | 1091 |
| 1092 void LoginDisplayHostImpl::StartTimeZoneResolve() { |
| 1093 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1094 chromeos::switches::kEnableTimeZoneTrackingOption)) { |
| 1095 return; |
| 1096 } |
| 1097 |
| 1098 if (!g_browser_process->local_state()->GetBoolean( |
| 1099 prefs::kResolveDeviceTimezoneByGeolocation)) { |
| 1100 return; |
| 1101 } |
| 1102 |
| 1103 if (system::HasSystemTimezonePolicy()) |
| 1104 return; |
| 1105 |
| 1106 // Do not start resolver if we are inside active user session. |
| 1107 // If user preferences permit, it will be started on preferences |
| 1108 // initialization. |
| 1109 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginUser)) |
| 1110 return; |
| 1111 |
| 1112 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); |
| 1113 } |
| 1114 |
| 1090 //////////////////////////////////////////////////////////////////////////////// | 1115 //////////////////////////////////////////////////////////////////////////////// |
| 1091 // external | 1116 // external |
| 1092 | 1117 |
| 1093 // Declared in login_wizard.h so that others don't need to depend on our .h. | 1118 // Declared in login_wizard.h so that others don't need to depend on our .h. |
| 1094 // TODO(nkostylev): Split this into a smaller functions. | 1119 // TODO(nkostylev): Split this into a smaller functions. |
| 1095 void ShowLoginWizard(const std::string& first_screen_name) { | 1120 void ShowLoginWizard(const std::string& first_screen_name) { |
| 1096 if (browser_shutdown::IsTryingToQuit()) | 1121 if (browser_shutdown::IsTryingToQuit()) |
| 1097 return; | 1122 return; |
| 1098 | 1123 |
| 1099 VLOG(1) << "Showing OOBE screen: " << first_screen_name; | 1124 VLOG(1) << "Showing OOBE screen: " << first_screen_name; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1118 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1143 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1119 switches::kNaturalScrollDefault)); | 1144 switches::kNaturalScrollDefault)); |
| 1120 | 1145 |
| 1121 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 1146 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
| 1122 | 1147 |
| 1123 g_browser_process->platform_part()->SessionManager()->SetSessionState( | 1148 g_browser_process->platform_part()->SessionManager()->SetSessionState( |
| 1124 StartupUtils::IsOobeCompleted() | 1149 StartupUtils::IsOobeCompleted() |
| 1125 ? session_manager::SESSION_STATE_LOGIN_PRIMARY | 1150 ? session_manager::SESSION_STATE_LOGIN_PRIMARY |
| 1126 : session_manager::SESSION_STATE_OOBE); | 1151 : session_manager::SESSION_STATE_OOBE); |
| 1127 | 1152 |
| 1128 LoginDisplayHost* display_host = new LoginDisplayHostImpl(screen_bounds); | 1153 LoginDisplayHostImpl* display_host = new LoginDisplayHostImpl(screen_bounds); |
| 1129 | 1154 |
| 1130 bool show_app_launch_splash_screen = | 1155 bool show_app_launch_splash_screen = |
| 1131 (first_screen_name == WizardController::kAppLaunchSplashScreenName); | 1156 (first_screen_name == WizardController::kAppLaunchSplashScreenName); |
| 1132 if (show_app_launch_splash_screen) { | 1157 if (show_app_launch_splash_screen) { |
| 1133 const std::string& auto_launch_app_id = | 1158 const std::string& auto_launch_app_id = |
| 1134 KioskAppManager::Get()->GetAutoLaunchApp(); | 1159 KioskAppManager::Get()->GetAutoLaunchApp(); |
| 1135 display_host->StartAppLaunch(auto_launch_app_id, | 1160 display_host->StartAppLaunch(auto_launch_app_id, |
| 1136 false /* diagnostic_mode */); | 1161 false /* diagnostic_mode */); |
| 1137 return; | 1162 return; |
| 1138 } | 1163 } |
| 1139 | 1164 |
| 1140 // Check whether we need to execute OOBE flow. | 1165 // Check whether we need to execute OOBE flow. |
| 1141 const policy::EnrollmentConfig enrollment_config = | 1166 const policy::EnrollmentConfig enrollment_config = |
| 1142 g_browser_process->platform_part() | 1167 g_browser_process->platform_part() |
| 1143 ->browser_policy_connector_chromeos() | 1168 ->browser_policy_connector_chromeos() |
| 1144 ->GetPrescribedEnrollmentConfig(); | 1169 ->GetPrescribedEnrollmentConfig(); |
| 1145 if (enrollment_config.should_enroll() && first_screen_name.empty()) { | 1170 if (enrollment_config.should_enroll() && first_screen_name.empty()) { |
| 1146 // Shows networks screen instead of enrollment screen to resume the | 1171 // Shows networks screen instead of enrollment screen to resume the |
| 1147 // interrupted auto start enrollment flow because enrollment screen does | 1172 // interrupted auto start enrollment flow because enrollment screen does |
| 1148 // not handle flaky network. See http://crbug.com/332572 | 1173 // not handle flaky network. See http://crbug.com/332572 |
| 1149 display_host->StartWizard(WizardController::kNetworkScreenName); | 1174 display_host->StartWizard(WizardController::kNetworkScreenName); |
| 1150 return; | 1175 return; |
| 1151 } | 1176 } |
| 1152 | 1177 |
| 1153 if (StartupUtils::IsEulaAccepted()) { | 1178 if (StartupUtils::IsEulaAccepted()) { |
| 1154 DelayNetworkCall( | 1179 DelayNetworkCall( |
| 1180 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS), |
| 1155 ServicesCustomizationDocument::GetInstance() | 1181 ServicesCustomizationDocument::GetInstance() |
| 1156 ->EnsureCustomizationAppliedClosure(), | 1182 ->EnsureCustomizationAppliedClosure()); |
| 1157 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS)); | 1183 |
| 1184 display_host->StartTimeZoneResolve(); |
| 1158 } | 1185 } |
| 1159 | 1186 |
| 1160 bool show_login_screen = | 1187 bool show_login_screen = |
| 1161 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || | 1188 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || |
| 1162 first_screen_name == WizardController::kLoginScreenName; | 1189 first_screen_name == WizardController::kLoginScreenName; |
| 1163 | 1190 |
| 1164 if (show_login_screen) { | 1191 if (show_login_screen) { |
| 1165 display_host->StartSignInScreen(LoginScreenContext()); | 1192 display_host->StartSignInScreen(LoginScreenContext()); |
| 1166 return; | 1193 return; |
| 1167 } | 1194 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 | 1233 |
| 1207 locale_util::SwitchLanguageCallback callback( | 1234 locale_util::SwitchLanguageCallback callback( |
| 1208 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); | 1235 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); |
| 1209 | 1236 |
| 1210 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1237 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1211 locale_util::SwitchLanguage( | 1238 locale_util::SwitchLanguage( |
| 1212 locale, true, true /* login_layouts_only */, callback); | 1239 locale, true, true /* login_layouts_only */, callback); |
| 1213 } | 1240 } |
| 1214 | 1241 |
| 1215 } // namespace chromeos | 1242 } // namespace chromeos |
| OLD | NEW |