| 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" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // accessibility is enabled). | 85 // accessibility is enabled). |
| 86 const char kChromeVoxTutorialURLPattern[] = | 86 const char kChromeVoxTutorialURLPattern[] = |
| 87 "http://www.chromevox.com/tutorial/index.html?lang=%s"; | 87 "http://www.chromevox.com/tutorial/index.html?lang=%s"; |
| 88 | 88 |
| 89 // Landing URL when launching Guest mode to fix captive portal. | 89 // Landing URL when launching Guest mode to fix captive portal. |
| 90 const char kCaptivePortalLaunchURL[] = "http://www.google.com/"; | 90 const char kCaptivePortalLaunchURL[] = "http://www.google.com/"; |
| 91 | 91 |
| 92 // Delay for transferring the auth cache to the system profile. | 92 // Delay for transferring the auth cache to the system profile. |
| 93 const long int kAuthCacheTransferDelayMs = 2000; | 93 const long int kAuthCacheTransferDelayMs = 2000; |
| 94 | 94 |
| 95 // Delay for rebooting the machine if safe-modelogin has failed. |
| 96 const long int kSafeModeRebootDelayMs = 30000; |
| 97 |
| 95 // Makes a call to the policy subsystem to reload the policy when we detect | 98 // Makes a call to the policy subsystem to reload the policy when we detect |
| 96 // authentication change. | 99 // authentication change. |
| 97 void RefreshPoliciesOnUIThread() { | 100 void RefreshPoliciesOnUIThread() { |
| 98 if (g_browser_process->browser_policy_connector()) | 101 if (g_browser_process->browser_policy_connector()) |
| 99 g_browser_process->browser_policy_connector()->RefreshPolicies(); | 102 g_browser_process->browser_policy_connector()->RefreshPolicies(); |
| 100 } | 103 } |
| 101 | 104 |
| 102 // Copies any authentication details that were entered in the login profile in | 105 // Copies any authentication details that were entered in the login profile in |
| 103 // the mail profile to make sure all subsystems of Chrome can access the network | 106 // the mail profile to make sure all subsystems of Chrome can access the network |
| 104 // with the provided authentication which are possibly for a proxy server. | 107 // with the provided authentication which are possibly for a proxy server. |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // ExistingUserController, LoginPerformer::Delegate implementation: | 470 // ExistingUserController, LoginPerformer::Delegate implementation: |
| 468 // | 471 // |
| 469 | 472 |
| 470 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 473 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
| 471 is_login_in_progress_ = false; | 474 is_login_in_progress_ = false; |
| 472 offline_failed_ = true; | 475 offline_failed_ = true; |
| 473 | 476 |
| 474 guest_mode_url_ = GURL::EmptyGURL(); | 477 guest_mode_url_ = GURL::EmptyGURL(); |
| 475 std::string error = failure.GetErrorString(); | 478 std::string error = failure.GetErrorString(); |
| 476 | 479 |
| 477 if (!online_succeeded_for_.empty()) { | 480 if (failure.reason() == LoginFailure::OWNER_REQUIRED) { |
| 481 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); |
| 482 content::BrowserThread::PostDelayedTask( |
| 483 content::BrowserThread::UI, FROM_HERE, |
| 484 base::Bind(&SessionManagerClient::StopSession, |
| 485 base::Unretained(DBusThreadManager::Get()-> |
| 486 GetSessionManagerClient())), |
| 487 kSafeModeRebootDelayMs); |
| 488 } else if (!online_succeeded_for_.empty()) { |
| 478 ShowGaiaPasswordChanged(online_succeeded_for_); | 489 ShowGaiaPasswordChanged(online_succeeded_for_); |
| 479 } else { | 490 } else { |
| 480 // Check networking after trying to login in case user is | 491 // Check networking after trying to login in case user is |
| 481 // cached locally or the local admin account. | 492 // cached locally or the local admin account. |
| 482 bool is_known_user = | 493 bool is_known_user = |
| 483 UserManager::Get()->IsKnownUser(last_login_attempt_username_); | 494 UserManager::Get()->IsKnownUser(last_login_attempt_username_); |
| 484 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); | 495 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 485 if (!network) { | 496 if (!network) { |
| 486 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); | 497 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); |
| 487 } else if (!network->Connected()) { | 498 } else if (!network->Connected()) { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 // changed. | 806 // changed. |
| 796 UserManager::Get()->SaveUserOAuthStatus(username, | 807 UserManager::Get()->SaveUserOAuthStatus(username, |
| 797 User::OAUTH_TOKEN_STATUS_INVALID); | 808 User::OAUTH_TOKEN_STATUS_INVALID); |
| 798 | 809 |
| 799 login_display_->SetUIEnabled(true); | 810 login_display_->SetUIEnabled(true); |
| 800 SetStatusAreaEnabled(true); | 811 SetStatusAreaEnabled(true); |
| 801 login_display_->ShowGaiaPasswordChanged(username); | 812 login_display_->ShowGaiaPasswordChanged(username); |
| 802 } | 813 } |
| 803 | 814 |
| 804 } // namespace chromeos | 815 } // namespace chromeos |
| OLD | NEW |