OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | |
20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
21 #include "base/values.h" | 20 #include "base/values.h" |
22 #include "base/version.h" | 21 #include "base/version.h" |
23 #include "chrome/browser/accessibility/accessibility_events.h" | 22 #include "chrome/browser/accessibility/accessibility_events.h" |
24 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/browser_process_platform_part.h" | 24 #include "chrome/browser/browser_process_platform_part.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | |
28 #include "chrome/browser/chromeos/boot_times_loader.h" | 26 #include "chrome/browser/chromeos/boot_times_loader.h" |
29 #include "chrome/browser/chromeos/customization_document.h" | 27 #include "chrome/browser/chromeos/customization_document.h" |
30 #include "chrome/browser/chromeos/first_run/first_run.h" | |
31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 28 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
32 #include "chrome/browser/chromeos/login/helper.h" | 29 #include "chrome/browser/chromeos/login/helper.h" |
33 #include "chrome/browser/chromeos/login/login_utils.h" | 30 #include "chrome/browser/chromeos/login/login_utils.h" |
34 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 31 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
35 #include "chrome/browser/chromeos/login/startup_utils.h" | 32 #include "chrome/browser/chromeos/login/startup_utils.h" |
36 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 33 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
37 #include "chrome/browser/chromeos/login/user_flow.h" | 34 #include "chrome/browser/chromeos/login/user_flow.h" |
38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 35 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
39 #include "chrome/browser/chromeos/login/wizard_controller.h" | 36 #include "chrome/browser/chromeos/login/wizard_controller.h" |
40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
41 #include "chrome/browser/chromeos/policy/device_local_account.h" | 38 #include "chrome/browser/chromeos/policy/device_local_account.h" |
42 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 39 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
43 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 40 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
44 #include "chrome/browser/chromeos/settings/cros_settings.h" | 41 #include "chrome/browser/chromeos/settings/cros_settings.h" |
45 #include "chrome/browser/prefs/session_startup_pref.h" | |
46 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 42 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
47 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
48 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
49 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
50 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
51 #include "chrome/grit/generated_resources.h" | 47 #include "chrome/grit/generated_resources.h" |
52 #include "chromeos/chromeos_switches.h" | 48 #include "chromeos/chromeos_switches.h" |
53 #include "chromeos/dbus/dbus_thread_manager.h" | 49 #include "chromeos/dbus/dbus_thread_manager.h" |
54 #include "chromeos/dbus/power_manager_client.h" | 50 #include "chromeos/dbus/power_manager_client.h" |
55 #include "chromeos/dbus/session_manager_client.h" | 51 #include "chromeos/dbus/session_manager_client.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
81 #include "ui/views/widget/widget.h" | 77 #include "ui/views/widget/widget.h" |
82 | 78 |
83 namespace chromeos { | 79 namespace chromeos { |
84 | 80 |
85 namespace { | 81 namespace { |
86 | 82 |
87 // URL for account creation. | 83 // URL for account creation. |
88 const char kCreateAccountURL[] = | 84 const char kCreateAccountURL[] = |
89 "https://accounts.google.com/NewAccount?service=mail"; | 85 "https://accounts.google.com/NewAccount?service=mail"; |
90 | 86 |
91 // ChromeVox tutorial URL (used in place of "getting started" url when | |
92 // accessibility is enabled). | |
93 const char kChromeVoxTutorialURLPattern[] = | |
94 "http://www.chromevox.com/tutorial/index.html?lang=%s"; | |
95 | |
96 // Delay for transferring the auth cache to the system profile. | 87 // Delay for transferring the auth cache to the system profile. |
97 const long int kAuthCacheTransferDelayMs = 2000; | 88 const long int kAuthCacheTransferDelayMs = 2000; |
98 | 89 |
99 // Delay for restarting the ui if safe-mode login has failed. | 90 // Delay for restarting the ui if safe-mode login has failed. |
100 const long int kSafeModeRestartUiDelayMs = 30000; | 91 const long int kSafeModeRestartUiDelayMs = 30000; |
101 | 92 |
102 // Makes a call to the policy subsystem to reload the policy when we detect | 93 // Makes a call to the policy subsystem to reload the policy when we detect |
103 // authentication change. | 94 // authentication change. |
104 void RefreshPoliciesOnUIThread() { | 95 void RefreshPoliciesOnUIThread() { |
105 if (g_browser_process->policy_service()) | 96 if (g_browser_process->policy_service()) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 } | 309 } |
319 DCHECK(login_display_.get()); | 310 DCHECK(login_display_.get()); |
320 } | 311 } |
321 | 312 |
322 //////////////////////////////////////////////////////////////////////////////// | 313 //////////////////////////////////////////////////////////////////////////////// |
323 // ExistingUserController, LoginDisplay::Delegate implementation: | 314 // ExistingUserController, LoginDisplay::Delegate implementation: |
324 // | 315 // |
325 | 316 |
326 void ExistingUserController::CancelPasswordChangedFlow() { | 317 void ExistingUserController::CancelPasswordChangedFlow() { |
327 login_performer_.reset(NULL); | 318 login_performer_.reset(NULL); |
328 login_display_->SetUIEnabled(true); | 319 PerformLoginFinishedActions(ture /* start public session timer */); |
329 StartPublicSessionAutoLoginTimer(); | |
330 } | 320 } |
331 | 321 |
332 void ExistingUserController::CreateAccount() { | 322 void ExistingUserController::CreateAccount() { |
333 content::RecordAction(base::UserMetricsAction("Login.CreateAccount")); | 323 content::RecordAction(base::UserMetricsAction("Login.CreateAccount")); |
334 guest_mode_url_ = google_util::AppendGoogleLocaleParam( | 324 guest_mode_url_ = google_util::AppendGoogleLocaleParam( |
335 GURL(kCreateAccountURL), g_browser_process->GetApplicationLocale()); | 325 GURL(kCreateAccountURL), g_browser_process->GetApplicationLocale()); |
336 LoginAsGuest(); | 326 LoginAsGuest(); |
337 } | 327 } |
338 | 328 |
339 void ExistingUserController::CompleteLogin(const UserContext& user_context) { | 329 void ExistingUserController::CompleteLogin(const UserContext& user_context) { |
340 login_display_->set_signin_completed(true); | 330 login_display_->set_signin_completed(true); |
341 if (!host_) { | 331 if (!host_) { |
342 // Complete login event was generated already from UI. Ignore notification. | 332 // Complete login event was generated already from UI. Ignore notification. |
343 return; | 333 return; |
344 } | 334 } |
345 | 335 |
346 // Stop the auto-login timer when attempting login. | 336 PerformPreLoginActions(user_context); |
347 StopPublicSessionAutoLoginTimer(); | |
348 | |
349 // Disable UI while loading user profile. | |
350 login_display_->SetUIEnabled(false); | |
351 | 337 |
352 if (!time_init_.is_null()) { | 338 if (!time_init_.is_null()) { |
353 base::TimeDelta delta = base::Time::Now() - time_init_; | 339 base::TimeDelta delta = base::Time::Now() - time_init_; |
354 UMA_HISTOGRAM_MEDIUM_TIMES("Login.PromptToCompleteLoginTime", delta); | 340 UMA_HISTOGRAM_MEDIUM_TIMES("Login.PromptToCompleteLoginTime", delta); |
355 time_init_ = base::Time(); // Reset to null. | 341 time_init_ = base::Time(); // Reset to null. |
356 } | 342 } |
357 | 343 |
358 host_->OnCompleteLogin(); | 344 host_->OnCompleteLogin(); |
359 | 345 |
360 // Do an ownership check now to avoid auto-enrolling if the device has | 346 // Do an ownership check now to avoid auto-enrolling if the device has |
(...skipping 18 matching lines...) Expand all Loading... | |
379 do_auto_enrollment_ = false; | 365 do_auto_enrollment_ = false; |
380 auto_enrollment_username_ = user_context.GetUserID(); | 366 auto_enrollment_username_ = user_context.GetUserID(); |
381 resume_login_callback_ = base::Bind( | 367 resume_login_callback_ = base::Bind( |
382 &ExistingUserController::PerformLogin, | 368 &ExistingUserController::PerformLogin, |
383 weak_factory_.GetWeakPtr(), | 369 weak_factory_.GetWeakPtr(), |
384 user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 370 user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
385 ShowEnrollmentScreen(true, user_context.GetUserID()); | 371 ShowEnrollmentScreen(true, user_context.GetUserID()); |
386 // Enable UI for the enrollment screen. SetUIEnabled(true) will post a | 372 // Enable UI for the enrollment screen. SetUIEnabled(true) will post a |
387 // request to show the sign-in screen again when invoked at the sign-in | 373 // request to show the sign-in screen again when invoked at the sign-in |
388 // screen; invoke SetUIEnabled() after navigating to the enrollment screen. | 374 // screen; invoke SetUIEnabled() after navigating to the enrollment screen. |
389 login_display_->SetUIEnabled(true); | 375 PerformLoginFinishedActions(false /* don't start public session timer */); |
390 } else { | 376 } else { |
391 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 377 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
392 } | 378 } |
393 } | 379 } |
394 | 380 |
395 base::string16 ExistingUserController::GetConnectedNetworkName() { | 381 base::string16 ExistingUserController::GetConnectedNetworkName() { |
396 return network_state_helper_->GetCurrentNetworkName(); | 382 return network_state_helper_->GetCurrentNetworkName(); |
397 } | 383 } |
398 | 384 |
399 bool ExistingUserController::IsSigninInProgress() const { | 385 bool ExistingUserController::IsSigninInProgress() const { |
(...skipping 20 matching lines...) Expand all Loading... | |
420 LoginAsRetailModeUser(); | 406 LoginAsRetailModeUser(); |
421 return; | 407 return; |
422 } else if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { | 408 } else if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { |
423 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); | 409 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); |
424 return; | 410 return; |
425 } | 411 } |
426 | 412 |
427 if (!user_context.HasCredentials()) | 413 if (!user_context.HasCredentials()) |
428 return; | 414 return; |
429 | 415 |
430 // Stop the auto-login timer when attempting login. | 416 PerformPreLoginActions(user_context); |
431 StopPublicSessionAutoLoginTimer(); | |
432 | |
433 // Disable clicking on other windows. | |
434 login_display_->SetUIEnabled(false); | |
435 | |
436 if (last_login_attempt_username_ != user_context.GetUserID()) { | |
437 last_login_attempt_username_ = user_context.GetUserID(); | |
438 num_login_attempts_ = 0; | |
439 // Also reset state variables, which are used to determine password change. | |
440 offline_failed_ = false; | |
441 online_succeeded_for_.clear(); | |
442 } | |
443 num_login_attempts_++; | |
444 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); | 417 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); |
445 } | 418 } |
446 | 419 |
447 void ExistingUserController::PerformLogin( | 420 void ExistingUserController::PerformLogin( |
448 const UserContext& user_context, | 421 const UserContext& user_context, |
449 LoginPerformer::AuthorizationMode auth_mode) { | 422 LoginPerformer::AuthorizationMode auth_mode) { |
450 ChromeUserManager::Get()->GetUserFlow(last_login_attempt_username_)->set_host( | 423 ChromeUserManager::Get()->GetUserFlow(user_context.GetUserID())->set_host( |
451 host_); | 424 host_); |
452 | 425 |
453 BootTimesLoader::Get()->RecordLoginAttempted(); | 426 BootTimesLoader::Get()->RecordLoginAttempted(); |
454 | 427 |
455 // Disable UI while loading user profile. | |
456 login_display_->SetUIEnabled(false); | |
457 | |
458 // Use the same LoginPerformer for subsequent login as it has state | 428 // Use the same LoginPerformer for subsequent login as it has state |
459 // such as Authenticator instance. | 429 // such as Authenticator instance. |
460 if (!login_performer_.get() || num_login_attempts_ <= 1) { | 430 if (!login_performer_.get() || num_login_attempts_ <= 1) { |
461 // Only one instance of LoginPerformer should exist at a time. | 431 // Only one instance of LoginPerformer should exist at a time. |
462 login_performer_.reset(NULL); | 432 login_performer_.reset(NULL); |
463 login_performer_.reset(new LoginPerformer(this)); | 433 login_performer_.reset(new LoginPerformer(this)); |
464 } | 434 } |
465 | 435 |
466 is_login_in_progress_ = true; | |
467 if (gaia::ExtractDomainName(user_context.GetUserID()) == | 436 if (gaia::ExtractDomainName(user_context.GetUserID()) == |
468 chromeos::login::kSupervisedUserDomain) { | 437 chromeos::login::kSupervisedUserDomain) { |
469 login_performer_->LoginAsSupervisedUser(user_context); | 438 login_performer_->LoginAsSupervisedUser(user_context); |
470 } else { | 439 } else { |
471 login_performer_->PerformLogin(user_context, auth_mode); | 440 login_performer_->PerformLogin(user_context, auth_mode); |
472 } | 441 } |
473 SendAccessibilityAlert( | 442 SendAccessibilityAlert( |
474 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 443 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
475 } | 444 } |
476 | 445 |
477 void ExistingUserController::LoginAsRetailModeUser() { | 446 void ExistingUserController::LoginAsRetailModeUser() { |
478 // Stop the auto-login timer when attempting login. | 447 PerformPreLoginActions(UserContext(chromeos::login::kRetailModeUserName)); |
479 StopPublicSessionAutoLoginTimer(); | |
480 | 448 |
481 // Disable clicking on other windows. | |
482 login_display_->SetUIEnabled(false); | |
483 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once | 449 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once |
484 // the enterprise policy wiring is done for retail mode. | 450 // the enterprise policy wiring is done for retail mode. |
485 | 451 |
486 // Only one instance of LoginPerformer should exist at a time. | 452 // Only one instance of LoginPerformer should exist at a time. |
487 login_performer_.reset(NULL); | 453 login_performer_.reset(NULL); |
488 login_performer_.reset(new LoginPerformer(this)); | 454 login_performer_.reset(new LoginPerformer(this)); |
489 is_login_in_progress_ = true; | |
490 login_performer_->LoginRetailMode(); | 455 login_performer_->LoginRetailMode(); |
491 SendAccessibilityAlert( | 456 SendAccessibilityAlert( |
492 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | 457 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); |
493 } | 458 } |
494 | 459 |
495 void ExistingUserController::LoginAsGuest() { | 460 void ExistingUserController::LoginAsGuest() { |
496 if (is_login_in_progress_ || | 461 if (is_login_in_progress_ || |
497 user_manager::UserManager::Get()->IsUserLoggedIn()) { | 462 user_manager::UserManager::Get()->IsUserLoggedIn()) { |
498 return; | 463 return; |
499 } | 464 } |
500 | 465 |
501 // Stop the auto-login timer when attempting login. | 466 PerformPreLoginActions(UserContext(chromeos::login::kGuestUserName)); |
502 StopPublicSessionAutoLoginTimer(); | |
503 | |
504 // Disable clicking on other windows. | |
505 login_display_->SetUIEnabled(false); | |
506 | 467 |
507 CrosSettingsProvider::TrustedStatus status = | 468 CrosSettingsProvider::TrustedStatus status = |
508 cros_settings_->PrepareTrustedValues( | 469 cros_settings_->PrepareTrustedValues( |
509 base::Bind(&ExistingUserController::LoginAsGuest, | 470 base::Bind(&ExistingUserController::LoginAsGuest, |
510 weak_factory_.GetWeakPtr())); | 471 weak_factory_.GetWeakPtr())); |
511 // Must not proceed without signature verification. | 472 // Must not proceed without signature verification. |
512 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { | 473 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { |
513 login_display_->ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, 1, | 474 login_display_->ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, 1, |
514 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); | 475 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); |
515 // Reenable clicking on other windows and status area. | 476 PerformLoginFinishedActions(false /* don't start public session timer */); |
Nikita (slow)
2014/10/20 12:40:47
Thiemo, I think starting public session timer is n
Thiemo Nagel
2014/10/22 08:40:01
I'm the wrong person to ask about this, I've never
Nikita (slow)
2014/10/22 10:22:25
+dconnelly@
| |
516 login_display_->SetUIEnabled(true); | |
517 StartPublicSessionAutoLoginTimer(); | |
518 display_email_.clear(); | 477 display_email_.clear(); |
519 return; | 478 return; |
520 } else if (status != CrosSettingsProvider::TRUSTED) { | 479 } else if (status != CrosSettingsProvider::TRUSTED) { |
521 // Value of AllowNewUser setting is still not verified. | 480 // Value of AllowNewUser setting is still not verified. |
522 // Another attempt will be invoked after verification completion. | 481 // Another attempt will be invoked after verification completion. |
523 return; | 482 return; |
524 } | 483 } |
525 | 484 |
526 bool allow_guest; | 485 bool allow_guest; |
527 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 486 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
528 if (!allow_guest) { | 487 if (!allow_guest) { |
529 // Disallowed. The UI should normally not show the guest pod but if for some | 488 // Disallowed. The UI should normally not show the guest pod but if for some |
530 // reason this has been made available to the user here is the time to tell | 489 // reason this has been made available to the user here is the time to tell |
531 // this nicely. | 490 // this nicely. |
532 login_display_->ShowError(IDS_LOGIN_ERROR_WHITELIST, 1, | 491 login_display_->ShowError(IDS_LOGIN_ERROR_WHITELIST, 1, |
533 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); | 492 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); |
534 // Reenable clicking on other windows and status area. | 493 PerformLoginFinishedActions(ture /* start public session timer */); |
535 login_display_->SetUIEnabled(true); | |
536 StartPublicSessionAutoLoginTimer(); | |
537 display_email_.clear(); | 494 display_email_.clear(); |
538 return; | 495 return; |
539 } | 496 } |
540 | 497 |
541 // Only one instance of LoginPerformer should exist at a time. | 498 // Only one instance of LoginPerformer should exist at a time. |
542 login_performer_.reset(NULL); | 499 login_performer_.reset(NULL); |
543 login_performer_.reset(new LoginPerformer(this)); | 500 login_performer_.reset(new LoginPerformer(this)); |
544 is_login_in_progress_ = true; | |
545 login_performer_->LoginOffTheRecord(); | 501 login_performer_->LoginOffTheRecord(); |
546 SendAccessibilityAlert( | 502 SendAccessibilityAlert( |
547 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_OFFRECORD)); | 503 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_OFFRECORD)); |
548 } | 504 } |
549 | 505 |
550 void ExistingUserController::MigrateUserData(const std::string& old_password) { | 506 void ExistingUserController::MigrateUserData(const std::string& old_password) { |
551 // LoginPerformer instance has state of the user so it should exist. | 507 // LoginPerformer instance has state of the user so it should exist. |
552 if (login_performer_.get()) | 508 if (login_performer_.get()) |
553 login_performer_->RecoverEncryptedData(old_password); | 509 login_performer_->RecoverEncryptedData(old_password); |
554 } | 510 } |
555 | 511 |
556 void ExistingUserController::LoginAsPublicSession( | 512 void ExistingUserController::LoginAsPublicSession( |
557 const UserContext& user_context) { | 513 const UserContext& user_context) { |
558 if (is_login_in_progress_ || | 514 if (is_login_in_progress_ || |
559 user_manager::UserManager::Get()->IsUserLoggedIn()) { | 515 user_manager::UserManager::Get()->IsUserLoggedIn()) { |
560 return; | 516 return; |
561 } | 517 } |
562 | 518 |
563 // Stop the auto-login timer when attempting login. | 519 PerformPreLoginActions(user_context); |
564 StopPublicSessionAutoLoginTimer(); | |
565 | |
566 // Disable clicking on other windows. | |
567 login_display_->SetUIEnabled(false); | |
568 | 520 |
569 CrosSettingsProvider::TrustedStatus status = | 521 CrosSettingsProvider::TrustedStatus status = |
570 cros_settings_->PrepareTrustedValues( | 522 cros_settings_->PrepareTrustedValues( |
571 base::Bind(&ExistingUserController::LoginAsPublicSession, | 523 base::Bind(&ExistingUserController::LoginAsPublicSession, |
572 weak_factory_.GetWeakPtr(), | 524 weak_factory_.GetWeakPtr(), |
573 user_context)); | 525 user_context)); |
574 // If device policy is permanently unavailable, logging into public accounts | 526 // If device policy is permanently unavailable, logging into public accounts |
575 // is not possible. | 527 // is not possible. |
576 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { | 528 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { |
577 login_display_->ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, 1, | 529 login_display_->ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, 1, |
578 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); | 530 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); |
579 // Re-enable clicking on other windows. | 531 PerformLoginFinishedActions(false /* don't start public session timer */); |
580 login_display_->SetUIEnabled(true); | |
581 return; | 532 return; |
582 } | 533 } |
583 | 534 |
584 // If device policy is not verified yet, this function will be called again | 535 // If device policy is not verified yet, this function will be called again |
585 // when verification finishes. | 536 // when verification finishes. |
586 if (status != CrosSettingsProvider::TRUSTED) | 537 if (status != CrosSettingsProvider::TRUSTED) |
587 return; | 538 return; |
588 | 539 |
589 // If there is no public account with the given user ID, logging in is not | 540 // If there is no public account with the given user ID, logging in is not |
590 // possible. | 541 // possible. |
591 const user_manager::User* user = | 542 const user_manager::User* user = |
592 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); | 543 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); |
593 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 544 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
594 // Re-enable clicking on other windows. | 545 PerformLoginFinishedActions(ture /* start public session timer */); |
595 login_display_->SetUIEnabled(true); | |
596 StartPublicSessionAutoLoginTimer(); | |
597 return; | 546 return; |
598 } | 547 } |
599 | 548 |
600 UserContext new_user_context = user_context; | 549 UserContext new_user_context = user_context; |
601 std::string locale = user_context.GetPublicSessionLocale(); | 550 std::string locale = user_context.GetPublicSessionLocale(); |
602 if (locale.empty()) { | 551 if (locale.empty()) { |
603 // When performing auto-login, no locale is chosen by the user. Check | 552 // When performing auto-login, no locale is chosen by the user. Check |
604 // whether a list of recommended locales was set by policy. If so, use its | 553 // whether a list of recommended locales was set by policy. If so, use its |
605 // first entry. Otherwise, |locale| will remain blank, indicating that the | 554 // first entry. Otherwise, |locale| will remain blank, indicating that the |
606 // public session should use the current UI locale. | 555 // public session should use the current UI locale. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 void ExistingUserController::ShowTPMError() { | 710 void ExistingUserController::ShowTPMError() { |
762 login_display_->SetUIEnabled(false); | 711 login_display_->SetUIEnabled(false); |
763 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); | 712 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); |
764 } | 713 } |
765 | 714 |
766 //////////////////////////////////////////////////////////////////////////////// | 715 //////////////////////////////////////////////////////////////////////////////// |
767 // ExistingUserController, LoginPerformer::Delegate implementation: | 716 // ExistingUserController, LoginPerformer::Delegate implementation: |
768 // | 717 // |
769 | 718 |
770 void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { | 719 void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { |
771 is_login_in_progress_ = false; | |
772 offline_failed_ = true; | 720 offline_failed_ = true; |
773 | |
774 guest_mode_url_ = GURL::EmptyGURL(); | 721 guest_mode_url_ = GURL::EmptyGURL(); |
775 std::string error = failure.GetErrorString(); | 722 std::string error = failure.GetErrorString(); |
776 | 723 |
724 PerformLoginFinishedActions(false /* don't start public session timer */); | |
725 | |
777 if (ChromeUserManager::Get() | 726 if (ChromeUserManager::Get() |
778 ->GetUserFlow(last_login_attempt_username_) | 727 ->GetUserFlow(last_login_attempt_username_) |
779 ->HandleLoginFailure(failure)) { | 728 ->HandleLoginFailure(failure)) { |
780 login_display_->SetUIEnabled(true); | |
781 return; | 729 return; |
782 } | 730 } |
783 | 731 |
784 if (failure.reason() == AuthFailure::OWNER_REQUIRED) { | 732 if (failure.reason() == AuthFailure::OWNER_REQUIRED) { |
785 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); | 733 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); |
786 content::BrowserThread::PostDelayedTask( | 734 content::BrowserThread::PostDelayedTask( |
787 content::BrowserThread::UI, FROM_HERE, | 735 content::BrowserThread::UI, FROM_HERE, |
788 base::Bind(&SessionManagerClient::StopSession, | 736 base::Bind(&SessionManagerClient::StopSession, |
789 base::Unretained(DBusThreadManager::Get()-> | 737 base::Unretained(DBusThreadManager::Get()-> |
790 GetSessionManagerClient())), | 738 GetSessionManagerClient())), |
(...skipping 18 matching lines...) Expand all Loading... | |
809 failure.error().state() == | 757 failure.error().state() == |
810 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) { | 758 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) { |
811 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error); | 759 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error); |
812 } else { | 760 } else { |
813 if (!is_known_user) | 761 if (!is_known_user) |
814 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); | 762 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); |
815 else | 763 else |
816 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 764 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
817 } | 765 } |
818 } | 766 } |
819 // Reenable clicking on other windows and status area. | |
820 login_display_->SetUIEnabled(true); | |
821 login_display_->ClearAndEnablePassword(); | 767 login_display_->ClearAndEnablePassword(); |
822 StartPublicSessionAutoLoginTimer(); | 768 StartPublicSessionAutoLoginTimer(); |
823 } | 769 } |
824 | 770 |
825 // Reset user flow to default, so that special flow will not affect next | 771 // Reset user flow to default, so that special flow will not affect next |
826 // attempt. | 772 // attempt. |
827 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_username_); | 773 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_username_); |
828 | 774 |
829 if (auth_status_consumer_) | 775 if (auth_status_consumer_) |
830 auth_status_consumer_->OnAuthFailure(failure); | 776 auth_status_consumer_->OnAuthFailure(failure); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
868 this); | 814 this); |
869 | 815 |
870 // Update user's displayed email. | 816 // Update user's displayed email. |
871 if (!display_email_.empty()) { | 817 if (!display_email_.empty()) { |
872 user_manager::UserManager::Get()->SaveUserDisplayEmail( | 818 user_manager::UserManager::Get()->SaveUserDisplayEmail( |
873 user_context.GetUserID(), display_email_); | 819 user_context.GetUserID(), display_email_); |
874 display_email_.clear(); | 820 display_email_.clear(); |
875 } | 821 } |
876 } | 822 } |
877 | 823 |
878 void ExistingUserController::OnProfilePrepared(Profile* profile) { | 824 void ExistingUserController::OnProfilePrepared(Profile* profile, |
825 bool browser_launched) { | |
879 // Reenable clicking on other windows and status area. | 826 // Reenable clicking on other windows and status area. |
880 login_display_->SetUIEnabled(true); | 827 login_display_->SetUIEnabled(true); |
881 | 828 |
882 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 829 if (browser_launched) |
883 if (user_manager->IsCurrentUserNew() && | 830 host_ = NULL; |
884 user_manager->IsLoggedInAsSupervisedUser()) { | 831 |
885 // Supervised users should launch into empty desktop on first run. | 832 // Inform |auth_status_consumer_| about successful login. |
886 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kSilentLaunch); | 833 // TODO(nkostylev): Pass UserContext back crbug.com/424550 |
834 if (auth_status_consumer_) { | |
835 auth_status_consumer_-> | |
836 OnAuthSuccess(UserContext(last_login_attempt_username_)); | |
887 } | 837 } |
888 | |
889 if (user_manager->IsCurrentUserNew() && | |
890 !ChromeUserManager::Get() | |
891 ->GetCurrentUserFlow() | |
892 ->ShouldSkipPostLoginScreens() && | |
893 !WizardController::default_controller()->skip_post_login_screens()) { | |
894 // Don't specify start URLs if the administrator has configured the start | |
895 // URLs via policy. | |
896 if (!SessionStartupPref::TypeIsManaged(profile->GetPrefs())) | |
897 InitializeStartUrls(); | |
898 | |
899 // Mark the device as registered., i.e. the second part of OOBE as | |
900 // completed. | |
901 if (!StartupUtils::IsDeviceRegistered()) | |
902 StartupUtils::MarkDeviceRegistered(base::Closure()); | |
903 | |
904 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
905 chromeos::switches::kOobeSkipPostLogin)) { | |
906 LoginUtils::Get()->DoBrowserLaunch(profile, host_); | |
907 host_ = NULL; | |
908 } else { | |
909 ActivateWizard(WizardController::kTermsOfServiceScreenName); | |
910 } | |
911 } else { | |
912 LoginUtils::Get()->DoBrowserLaunch(profile, host_); | |
913 host_ = NULL; | |
914 } | |
915 // Inform |auth_status_consumer_| about successful login. | |
916 if (auth_status_consumer_) | |
917 auth_status_consumer_->OnAuthSuccess(UserContext()); | |
918 } | 838 } |
919 | 839 |
920 void ExistingUserController::OnOffTheRecordAuthSuccess() { | 840 void ExistingUserController::OnOffTheRecordAuthSuccess() { |
921 is_login_in_progress_ = false; | 841 is_login_in_progress_ = false; |
922 offline_failed_ = false; | 842 offline_failed_ = false; |
923 | 843 |
924 // Mark the device as registered., i.e. the second part of OOBE as completed. | 844 // Mark the device as registered., i.e. the second part of OOBE as completed. |
925 if (!StartupUtils::IsDeviceRegistered()) | 845 if (!StartupUtils::IsDeviceRegistered()) |
926 StartupUtils::MarkDeviceRegistered(base::Closure()); | 846 StartupUtils::MarkDeviceRegistered(base::Closure()); |
927 | 847 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 // doing this. See http://crosbug.com/9115 http://crosbug.com/7792 | 881 // doing this. See http://crosbug.com/9115 http://crosbug.com/7792 |
962 login_display_->ShowPasswordChangedDialog(show_invalid_old_password_error); | 882 login_display_->ShowPasswordChangedDialog(show_invalid_old_password_error); |
963 | 883 |
964 if (auth_status_consumer_) | 884 if (auth_status_consumer_) |
965 auth_status_consumer_->OnPasswordChangeDetected(); | 885 auth_status_consumer_->OnPasswordChangeDetected(); |
966 | 886 |
967 display_email_.clear(); | 887 display_email_.clear(); |
968 } | 888 } |
969 | 889 |
970 void ExistingUserController::WhiteListCheckFailed(const std::string& email) { | 890 void ExistingUserController::WhiteListCheckFailed(const std::string& email) { |
971 is_login_in_progress_ = false; | 891 PerformLoginFinishedActions(ture /* start public session timer */); |
972 offline_failed_ = false; | 892 offline_failed_ = false; |
973 | 893 |
974 ShowError(IDS_LOGIN_ERROR_WHITELIST, email); | 894 ShowError(IDS_LOGIN_ERROR_WHITELIST, email); |
975 | 895 |
976 // Reenable clicking on other windows and status area. | |
977 login_display_->SetUIEnabled(true); | |
978 login_display_->ShowSigninUI(email); | 896 login_display_->ShowSigninUI(email); |
979 | 897 |
980 if (auth_status_consumer_) { | 898 if (auth_status_consumer_) { |
981 auth_status_consumer_->OnAuthFailure( | 899 auth_status_consumer_->OnAuthFailure( |
982 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED)); | 900 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED)); |
983 } | 901 } |
984 | 902 |
985 display_email_.clear(); | 903 display_email_.clear(); |
986 | |
987 StartPublicSessionAutoLoginTimer(); | |
988 } | 904 } |
989 | 905 |
990 void ExistingUserController::PolicyLoadFailed() { | 906 void ExistingUserController::PolicyLoadFailed() { |
991 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, ""); | 907 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, ""); |
992 | 908 |
993 // Reenable clicking on other windows and status area. | 909 PerformLoginFinishedActions(false /* don't start public session timer */); |
Nikita (slow)
2014/10/20 12:40:47
Thiemo, I think starting public session timer is n
Nikita (slow)
2014/10/22 10:22:25
+dconnelly@
| |
994 is_login_in_progress_ = false; | |
995 offline_failed_ = false; | 910 offline_failed_ = false; |
996 login_display_->SetUIEnabled(true); | |
997 | |
998 display_email_.clear(); | 911 display_email_.clear(); |
999 | |
1000 // Policy load failure stops login attempts -- restart the timer. | |
1001 StartPublicSessionAutoLoginTimer(); | |
1002 } | 912 } |
1003 | 913 |
1004 void ExistingUserController::OnOnlineChecked(const std::string& username, | 914 void ExistingUserController::OnOnlineChecked(const std::string& username, |
1005 bool success) { | 915 bool success) { |
1006 if (success && last_login_attempt_username_ == username) { | 916 if (success && last_login_attempt_username_ == username) { |
1007 online_succeeded_for_ = username; | 917 online_succeeded_for_ = username; |
1008 // Wait for login attempt to end, if it hasn't yet. | 918 // Wait for login attempt to end, if it hasn't yet. |
1009 if (offline_failed_ && !is_login_in_progress_) | 919 if (offline_failed_ && !is_login_in_progress_) |
1010 ShowGaiaPasswordChanged(username); | 920 ShowGaiaPasswordChanged(username); |
1011 } | 921 } |
1012 } | 922 } |
1013 | 923 |
1014 //////////////////////////////////////////////////////////////////////////////// | 924 //////////////////////////////////////////////////////////////////////////////// |
1015 // ExistingUserController, private: | 925 // ExistingUserController, private: |
1016 | 926 |
1017 void ExistingUserController::DeviceSettingsChanged() { | 927 void ExistingUserController::DeviceSettingsChanged() { |
1018 if (host_ != NULL) { | 928 if (host_ != NULL) { |
1019 // Signed settings or user list changed. Notify views and update them. | 929 // Signed settings or user list changed. Notify views and update them. |
1020 UpdateLoginDisplay(user_manager::UserManager::Get()->GetUsers()); | 930 UpdateLoginDisplay(user_manager::UserManager::Get()->GetUsers()); |
1021 ConfigurePublicSessionAutoLogin(); | 931 ConfigurePublicSessionAutoLogin(); |
1022 return; | 932 return; |
1023 } | 933 } |
1024 } | 934 } |
1025 | 935 |
1026 void ExistingUserController::ActivateWizard(const std::string& screen_name) { | |
1027 scoped_ptr<base::DictionaryValue> params; | |
1028 host_->StartWizard(screen_name, params.Pass()); | |
1029 } | |
1030 | |
1031 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const { | 936 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const { |
1032 if (login_performer_) | 937 if (login_performer_) |
1033 return login_performer_->auth_mode(); | 938 return login_performer_->auth_mode(); |
1034 | 939 |
1035 return auth_mode_; | 940 return auth_mode_; |
1036 } | 941 } |
1037 | 942 |
1038 bool ExistingUserController::password_changed() const { | 943 bool ExistingUserController::password_changed() const { |
1039 if (login_performer_) | 944 if (login_performer_) |
1040 return login_performer_->password_changed(); | 945 return login_performer_->password_changed(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 public_session_auto_login_delay_), | 1020 public_session_auto_login_delay_), |
1116 base::Bind( | 1021 base::Bind( |
1117 &ExistingUserController::OnPublicSessionAutoLoginTimerFire, | 1022 &ExistingUserController::OnPublicSessionAutoLoginTimerFire, |
1118 weak_factory_.GetWeakPtr())); | 1023 weak_factory_.GetWeakPtr())); |
1119 } | 1024 } |
1120 | 1025 |
1121 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 1026 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
1122 return host_->GetNativeWindow(); | 1027 return host_->GetNativeWindow(); |
1123 } | 1028 } |
1124 | 1029 |
1125 void ExistingUserController::InitializeStartUrls() const { | |
1126 std::vector<std::string> start_urls; | |
1127 | |
1128 const base::ListValue *urls; | |
1129 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | |
1130 bool can_show_getstarted_guide = | |
1131 user_manager->GetActiveUser()->GetType() == | |
1132 user_manager::USER_TYPE_REGULAR && | |
1133 !user_manager->IsCurrentUserNonCryptohomeDataEphemeral(); | |
1134 if (user_manager->IsLoggedInAsDemoUser()) { | |
1135 if (CrosSettings::Get()->GetList(kStartUpUrls, &urls)) { | |
1136 // The retail mode user will get start URLs from a special policy if it is | |
1137 // set. | |
1138 for (base::ListValue::const_iterator it = urls->begin(); | |
1139 it != urls->end(); ++it) { | |
1140 std::string url; | |
1141 if ((*it)->GetAsString(&url)) | |
1142 start_urls.push_back(url); | |
1143 } | |
1144 } | |
1145 can_show_getstarted_guide = false; | |
1146 // Skip the default first-run behavior for public accounts. | |
1147 } else if (!user_manager->IsLoggedInAsPublicAccount()) { | |
1148 if (AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) { | |
1149 const char* url = kChromeVoxTutorialURLPattern; | |
1150 PrefService* prefs = g_browser_process->local_state(); | |
1151 const std::string current_locale = | |
1152 base::StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); | |
1153 std::string vox_url = base::StringPrintf(url, current_locale.c_str()); | |
1154 start_urls.push_back(vox_url); | |
1155 can_show_getstarted_guide = false; | |
1156 } | |
1157 } | |
1158 | |
1159 // Only show getting started guide for a new user. | |
1160 const bool should_show_getstarted_guide = user_manager->IsCurrentUserNew(); | |
1161 | |
1162 if (can_show_getstarted_guide && should_show_getstarted_guide) { | |
1163 // Don't open default Chrome window if we're going to launch the first-run | |
1164 // app. Because we dont' want the first-run app to be hidden in the | |
1165 // background. | |
1166 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kSilentLaunch); | |
1167 first_run::MaybeLaunchDialogAfterSessionStart(); | |
1168 } else { | |
1169 for (size_t i = 0; i < start_urls.size(); ++i) { | |
1170 CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]); | |
1171 } | |
1172 } | |
1173 } | |
1174 | |
1175 void ExistingUserController::ShowError(int error_id, | 1030 void ExistingUserController::ShowError(int error_id, |
1176 const std::string& details) { | 1031 const std::string& details) { |
1177 // TODO(dpolukhin): show detailed error info. |details| string contains | 1032 // TODO(dpolukhin): show detailed error info. |details| string contains |
1178 // low level error info that is not localized and even is not user friendly. | 1033 // low level error info that is not localized and even is not user friendly. |
1179 // For now just ignore it because error_text contains all required information | 1034 // For now just ignore it because error_text contains all required information |
1180 // for end users, developers can see details string in Chrome logs. | 1035 // for end users, developers can see details string in Chrome logs. |
1181 VLOG(1) << details; | 1036 VLOG(1) << details; |
1182 HelpAppLauncher::HelpTopic help_topic_id; | 1037 HelpAppLauncher::HelpTopic help_topic_id; |
1183 bool is_offline = !network_state_helper_->IsConnected(); | 1038 bool is_offline = !network_state_helper_->IsConnected(); |
1184 switch (login_performer_->error().state()) { | 1039 switch (login_performer_->error().state()) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1248 new_user_context.SetPublicSessionInputMethod(keyboard_layout); | 1103 new_user_context.SetPublicSessionInputMethod(keyboard_layout); |
1249 | 1104 |
1250 LoginAsPublicSessionInternal(new_user_context); | 1105 LoginAsPublicSessionInternal(new_user_context); |
1251 } | 1106 } |
1252 | 1107 |
1253 void ExistingUserController::LoginAsPublicSessionInternal( | 1108 void ExistingUserController::LoginAsPublicSessionInternal( |
1254 const UserContext& user_context) { | 1109 const UserContext& user_context) { |
1255 // Only one instance of LoginPerformer should exist at a time. | 1110 // Only one instance of LoginPerformer should exist at a time. |
1256 login_performer_.reset(NULL); | 1111 login_performer_.reset(NULL); |
1257 login_performer_.reset(new LoginPerformer(this)); | 1112 login_performer_.reset(new LoginPerformer(this)); |
1258 is_login_in_progress_ = true; | |
1259 login_performer_->LoginAsPublicSession(user_context); | 1113 login_performer_->LoginAsPublicSession(user_context); |
1260 SendAccessibilityAlert( | 1114 SendAccessibilityAlert( |
1261 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); | 1115 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); |
1262 } | 1116 } |
1263 | 1117 |
1118 void ExistingUserController::PerformPreLoginActions( | |
1119 const UserContext& user_context) { | |
1120 // Disable clicking on other windows and status tray. | |
1121 login_display_->SetUIEnabled(false); | |
1122 | |
1123 if (last_login_attempt_username_ != user_context.GetUserID()) { | |
1124 last_login_attempt_username_ = user_context.GetUserID(); | |
1125 num_login_attempts_ = 0; | |
1126 | |
1127 // Also reset state variables, which are used to determine password change. | |
1128 offline_failed_ = false; | |
1129 online_succeeded_for_.clear(); | |
1130 } | |
1131 | |
1132 // Guard in cases when we're called twice but login process is still active. | |
1133 // This might happen when login process is paused till signed settings status | |
1134 // is verified which results in Login* method called again as a callback. | |
1135 if (!is_login_in_progress_) | |
1136 num_login_attempts_++; | |
1137 | |
1138 is_login_in_progress_ = true; | |
1139 | |
1140 // Stop the auto-login timer when attempting login. | |
1141 StopPublicSessionAutoLoginTimer(); | |
1142 } | |
1143 | |
1144 void ExistingUserController::PerformLoginFinishedActions( | |
1145 bool start_public_session_timer) { | |
1146 is_login_in_progress_ = false; | |
1147 | |
1148 // Reenable clicking on other windows and status area. | |
1149 login_display_->SetUIEnabled(true); | |
1150 | |
1151 if (start_public_session_timer) | |
1152 StartPublicSessionAutoLoginTimer(); | |
1153 } | |
1154 | |
1264 } // namespace chromeos | 1155 } // namespace chromeos |
OLD | NEW |