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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/wallpaper/wallpaper_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_controller.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 base::Closure callback_; | 166 base::Closure callback_; |
167 | 167 |
168 DISALLOW_COPY_AND_ASSIGN(AnimationObserver); | 168 DISALLOW_COPY_AND_ASSIGN(AnimationObserver); |
169 }; | 169 }; |
170 | 170 |
171 // ShowLoginWizard is split into two parts. This function is sometimes called | 171 // ShowLoginWizard is split into two parts. This function is sometimes called |
172 // from ShowLoginWizard(), and sometimes from OnLanguageSwitchedCallback() | 172 // from ShowLoginWizard(), and sometimes from OnLanguageSwitchedCallback() |
173 // (if locale was updated). | 173 // (if locale was updated). |
174 void ShowLoginWizardFinish( | 174 void ShowLoginWizardFinish( |
175 const std::string& first_screen_name, | 175 chromeos::OobeScreen first_screen_name, |
176 const chromeos::StartupCustomizationDocument* startup_manifest, | 176 const chromeos::StartupCustomizationDocument* startup_manifest, |
177 chromeos::LoginDisplayHost* display_host) { | 177 chromeos::LoginDisplayHost* display_host) { |
178 TRACE_EVENT0("chromeos", "ShowLoginWizard::ShowLoginWizardFinish"); | 178 TRACE_EVENT0("chromeos", "ShowLoginWizard::ShowLoginWizardFinish"); |
179 | 179 |
180 display_host->StartWizard(first_screen_name); | 180 display_host->StartWizard(first_screen_name); |
181 | 181 |
182 // Set initial timezone if specified by customization. | 182 // Set initial timezone if specified by customization. |
183 const std::string timezone_name = startup_manifest->initial_timezone(); | 183 const std::string timezone_name = startup_manifest->initial_timezone(); |
184 VLOG(1) << "Initial time zone: " << timezone_name; | 184 VLOG(1) << "Initial time zone: " << timezone_name; |
185 // Apply locale customizations only once to preserve whatever locale | 185 // Apply locale customizations only once to preserve whatever locale |
186 // user has changed to during OOBE. | 186 // user has changed to during OOBE. |
187 if (!timezone_name.empty()) { | 187 if (!timezone_name.empty()) { |
188 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 188 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
189 base::UTF8ToUTF16(timezone_name)); | 189 base::UTF8ToUTF16(timezone_name)); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 struct ShowLoginWizardSwitchLanguageCallbackData { | 193 struct ShowLoginWizardSwitchLanguageCallbackData { |
194 explicit ShowLoginWizardSwitchLanguageCallbackData( | 194 explicit ShowLoginWizardSwitchLanguageCallbackData( |
195 const std::string& first_screen_name, | 195 chromeos::OobeScreen first_screen_name, |
196 const chromeos::StartupCustomizationDocument* startup_manifest, | 196 const chromeos::StartupCustomizationDocument* startup_manifest, |
197 chromeos::LoginDisplayHost* display_host) | 197 chromeos::LoginDisplayHost* display_host) |
198 : first_screen_name(first_screen_name), | 198 : first_screen_name(first_screen_name), |
199 startup_manifest(startup_manifest), | 199 startup_manifest(startup_manifest), |
200 display_host(display_host) {} | 200 display_host(display_host) {} |
201 | 201 |
202 const std::string first_screen_name; | 202 const chromeos::OobeScreen first_screen_name; |
203 const chromeos::StartupCustomizationDocument* const startup_manifest; | 203 const chromeos::StartupCustomizationDocument* const startup_manifest; |
204 chromeos::LoginDisplayHost* const display_host; | 204 chromeos::LoginDisplayHost* const display_host; |
205 | 205 |
206 // lock UI while resource bundle is being reloaded. | 206 // lock UI while resource bundle is being reloaded. |
207 chromeos::InputEventsBlocker events_blocker; | 207 chromeos::InputEventsBlocker events_blocker; |
208 }; | 208 }; |
209 | 209 |
210 void OnLanguageSwitchedCallback( | 210 void OnLanguageSwitchedCallback( |
211 std::unique_ptr<ShowLoginWizardSwitchLanguageCallbackData> self, | 211 std::unique_ptr<ShowLoginWizardSwitchLanguageCallbackData> self, |
212 const chromeos::locale_util::LanguageSwitchResult& result) { | 212 const chromeos::locale_util::LanguageSwitchResult& result) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 else if (login_view_) | 523 else if (login_view_) |
524 login_view_->SetStatusAreaVisible(visible); | 524 login_view_->SetStatusAreaVisible(visible); |
525 } | 525 } |
526 | 526 |
527 AutoEnrollmentController* LoginDisplayHostImpl::GetAutoEnrollmentController() { | 527 AutoEnrollmentController* LoginDisplayHostImpl::GetAutoEnrollmentController() { |
528 if (!auto_enrollment_controller_) | 528 if (!auto_enrollment_controller_) |
529 auto_enrollment_controller_.reset(new AutoEnrollmentController()); | 529 auto_enrollment_controller_.reset(new AutoEnrollmentController()); |
530 return auto_enrollment_controller_.get(); | 530 return auto_enrollment_controller_.get(); |
531 } | 531 } |
532 | 532 |
533 void LoginDisplayHostImpl::StartWizard(const std::string& first_screen_name) { | 533 void LoginDisplayHostImpl::StartWizard(OobeScreen first_screen_name) { |
534 DisableKeyboardOverscroll(); | 534 DisableKeyboardOverscroll(); |
535 | 535 |
536 startup_sound_honors_spoken_feedback_ = false; | 536 startup_sound_honors_spoken_feedback_ = false; |
537 TryToPlayStartupSound(); | 537 TryToPlayStartupSound(); |
538 | 538 |
539 // Keep parameters to restore if renderer crashes. | 539 // Keep parameters to restore if renderer crashes. |
540 restore_path_ = RESTORE_WIZARD; | 540 restore_path_ = RESTORE_WIZARD; |
541 first_screen_name_ = first_screen_name; | 541 first_screen_name_ = first_screen_name; |
542 is_showing_login_ = false; | 542 is_showing_login_ = false; |
543 | 543 |
544 if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) { | 544 if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) { |
545 VLOG(1) << "Login WebUI >> wizard postponed"; | 545 VLOG(1) << "Login WebUI >> wizard postponed"; |
546 return; | 546 return; |
547 } | 547 } |
548 VLOG(1) << "Login WebUI >> wizard"; | 548 VLOG(1) << "Login WebUI >> wizard"; |
549 | 549 |
550 if (!login_window_) | 550 if (!login_window_) |
551 LoadURL(GURL(kOobeURL)); | 551 LoadURL(GURL(kOobeURL)); |
552 | 552 |
553 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; | 553 DVLOG(1) << "Starting wizard, first_screen_name: " |
| 554 << GetOobeScreenName(first_screen_name); |
554 // Create and show the wizard. | 555 // Create and show the wizard. |
555 // Note, dtor of the old WizardController should be called before ctor of the | 556 // Note, dtor of the old WizardController should be called before ctor of the |
556 // new one, because "default_controller()" is updated there. So pure "reset()" | 557 // new one, because "default_controller()" is updated there. So pure "reset()" |
557 // is done before new controller creation. | 558 // is done before new controller creation. |
558 wizard_controller_.reset(); | 559 wizard_controller_.reset(); |
559 wizard_controller_.reset(CreateWizardController()); | 560 wizard_controller_.reset(CreateWizardController()); |
560 | 561 |
561 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); | 562 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); |
562 SetOobeProgressBarVisible(oobe_progress_bar_visible_); | 563 SetOobeProgressBarVisible(oobe_progress_bar_visible_); |
563 wizard_controller_->Init(first_screen_name); | 564 wizard_controller_->Init(first_screen_name); |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 ->GetOobeUI() | 1240 ->GetOobeUI() |
1240 ->GetGaiaScreenActor() | 1241 ->GetGaiaScreenActor() |
1241 ->DisableRestrictiveProxyCheckForTest(); | 1242 ->DisableRestrictiveProxyCheckForTest(); |
1242 } | 1243 } |
1243 | 1244 |
1244 //////////////////////////////////////////////////////////////////////////////// | 1245 //////////////////////////////////////////////////////////////////////////////// |
1245 // external | 1246 // external |
1246 | 1247 |
1247 // Declared in login_wizard.h so that others don't need to depend on our .h. | 1248 // Declared in login_wizard.h so that others don't need to depend on our .h. |
1248 // TODO(nkostylev): Split this into a smaller functions. | 1249 // TODO(nkostylev): Split this into a smaller functions. |
1249 void ShowLoginWizard(const std::string& first_screen_name) { | 1250 void ShowLoginWizard(OobeScreen first_screen_name) { |
1250 if (browser_shutdown::IsTryingToQuit()) | 1251 if (browser_shutdown::IsTryingToQuit()) |
1251 return; | 1252 return; |
1252 | 1253 |
1253 VLOG(1) << "Showing OOBE screen: " << first_screen_name; | 1254 VLOG(1) << "Showing OOBE screen: " << GetOobeScreenName(first_screen_name); |
1254 | 1255 |
1255 chromeos::input_method::InputMethodManager* manager = | 1256 chromeos::input_method::InputMethodManager* manager = |
1256 chromeos::input_method::InputMethodManager::Get(); | 1257 chromeos::input_method::InputMethodManager::Get(); |
1257 | 1258 |
1258 // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty | 1259 // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty |
1259 // and US dvorak keyboard layouts. | 1260 // and US dvorak keyboard layouts. |
1260 if (g_browser_process && g_browser_process->local_state()) { | 1261 if (g_browser_process && g_browser_process->local_state()) { |
1261 manager->GetActiveIMEState()->SetInputMethodLoginDefault(); | 1262 manager->GetActiveIMEState()->SetInputMethodLoginDefault(); |
1262 | 1263 |
1263 PrefService* prefs = g_browser_process->local_state(); | 1264 PrefService* prefs = g_browser_process->local_state(); |
(...skipping 11 matching lines...) Expand all Loading... |
1275 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 1276 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
1276 | 1277 |
1277 session_manager::SessionManager::Get()->SetSessionState( | 1278 session_manager::SessionManager::Get()->SetSessionState( |
1278 StartupUtils::IsOobeCompleted() | 1279 StartupUtils::IsOobeCompleted() |
1279 ? session_manager::SessionState::LOGIN_PRIMARY | 1280 ? session_manager::SessionState::LOGIN_PRIMARY |
1280 : session_manager::SessionState::OOBE); | 1281 : session_manager::SessionState::OOBE); |
1281 | 1282 |
1282 LoginDisplayHostImpl* display_host = new LoginDisplayHostImpl(screen_bounds); | 1283 LoginDisplayHostImpl* display_host = new LoginDisplayHostImpl(screen_bounds); |
1283 | 1284 |
1284 bool show_app_launch_splash_screen = | 1285 bool show_app_launch_splash_screen = |
1285 (first_screen_name == WizardController::kAppLaunchSplashScreenName); | 1286 (first_screen_name == OobeScreen::SCREEN_APP_LAUNCH_SPLASH); |
1286 if (show_app_launch_splash_screen) { | 1287 if (show_app_launch_splash_screen) { |
1287 const std::string& auto_launch_app_id = | 1288 const std::string& auto_launch_app_id = |
1288 KioskAppManager::Get()->GetAutoLaunchApp(); | 1289 KioskAppManager::Get()->GetAutoLaunchApp(); |
1289 const bool diagnostic_mode = false; | 1290 const bool diagnostic_mode = false; |
1290 const bool auto_launch = true; | 1291 const bool auto_launch = true; |
1291 display_host->StartAppLaunch(auto_launch_app_id, | 1292 display_host->StartAppLaunch(auto_launch_app_id, |
1292 diagnostic_mode, | 1293 diagnostic_mode, |
1293 auto_launch); | 1294 auto_launch); |
1294 return; | 1295 return; |
1295 } | 1296 } |
1296 | 1297 |
1297 // Check whether we need to execute OOBE flow. | 1298 // Check whether we need to execute OOBE flow. |
1298 const policy::EnrollmentConfig enrollment_config = | 1299 const policy::EnrollmentConfig enrollment_config = |
1299 g_browser_process->platform_part() | 1300 g_browser_process->platform_part() |
1300 ->browser_policy_connector_chromeos() | 1301 ->browser_policy_connector_chromeos() |
1301 ->GetPrescribedEnrollmentConfig(); | 1302 ->GetPrescribedEnrollmentConfig(); |
1302 if (enrollment_config.should_enroll() && first_screen_name.empty()) { | 1303 if (enrollment_config.should_enroll() && |
| 1304 first_screen_name == OobeScreen::SCREEN_UNKNOWN) { |
1303 // Shows networks screen instead of enrollment screen to resume the | 1305 // Shows networks screen instead of enrollment screen to resume the |
1304 // interrupted auto start enrollment flow because enrollment screen does | 1306 // interrupted auto start enrollment flow because enrollment screen does |
1305 // not handle flaky network. See http://crbug.com/332572 | 1307 // not handle flaky network. See http://crbug.com/332572 |
1306 display_host->StartWizard(WizardController::kNetworkScreenName); | 1308 display_host->StartWizard(OobeScreen::SCREEN_OOBE_NETWORK); |
1307 return; | 1309 return; |
1308 } | 1310 } |
1309 | 1311 |
1310 if (StartupUtils::IsEulaAccepted()) { | 1312 if (StartupUtils::IsEulaAccepted()) { |
1311 DelayNetworkCall( | 1313 DelayNetworkCall( |
1312 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS), | 1314 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS), |
1313 ServicesCustomizationDocument::GetInstance() | 1315 ServicesCustomizationDocument::GetInstance() |
1314 ->EnsureCustomizationAppliedClosure()); | 1316 ->EnsureCustomizationAppliedClosure()); |
1315 | 1317 |
1316 g_browser_process->platform_part() | 1318 g_browser_process->platform_part() |
1317 ->GetTimezoneResolverManager() | 1319 ->GetTimezoneResolverManager() |
1318 ->UpdateTimezoneResolver(); | 1320 ->UpdateTimezoneResolver(); |
1319 } | 1321 } |
1320 | 1322 |
1321 bool show_login_screen = | 1323 bool show_login_screen = |
1322 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || | 1324 (first_screen_name == OobeScreen::SCREEN_UNKNOWN && |
1323 first_screen_name == WizardController::kLoginScreenName; | 1325 StartupUtils::IsOobeCompleted()) || |
| 1326 first_screen_name == OobeScreen::SCREEN_SPECIAL_LOGIN; |
1324 | 1327 |
1325 if (show_login_screen) { | 1328 if (show_login_screen) { |
1326 display_host->StartSignInScreen(LoginScreenContext()); | 1329 display_host->StartSignInScreen(LoginScreenContext()); |
1327 return; | 1330 return; |
1328 } | 1331 } |
1329 | 1332 |
1330 // Load startup manifest. | 1333 // Load startup manifest. |
1331 const StartupCustomizationDocument* startup_manifest = | 1334 const StartupCustomizationDocument* startup_manifest = |
1332 StartupCustomizationDocument::GetInstance(); | 1335 StartupCustomizationDocument::GetInstance(); |
1333 | 1336 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 | 1370 |
1368 locale_util::SwitchLanguageCallback callback( | 1371 locale_util::SwitchLanguageCallback callback( |
1369 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); | 1372 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); |
1370 | 1373 |
1371 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1374 // Load locale keyboards here. Hardware layout would be automatically enabled. |
1372 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, | 1375 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, |
1373 callback, ProfileManager::GetActiveUserProfile()); | 1376 callback, ProfileManager::GetActiveUserProfile()); |
1374 } | 1377 } |
1375 | 1378 |
1376 } // namespace chromeos | 1379 } // namespace chromeos |
OLD | NEW |