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 restarting the ui if safe-mode login has failed. |
| 96 const long int kSafeModeRestartUiDelayMs = 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // ExistingUserController, LoginPerformer::Delegate implementation: | 468 // ExistingUserController, LoginPerformer::Delegate implementation: |
466 // | 469 // |
467 | 470 |
468 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 471 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
469 is_login_in_progress_ = false; | 472 is_login_in_progress_ = false; |
470 offline_failed_ = true; | 473 offline_failed_ = true; |
471 | 474 |
472 guest_mode_url_ = GURL::EmptyGURL(); | 475 guest_mode_url_ = GURL::EmptyGURL(); |
473 std::string error = failure.GetErrorString(); | 476 std::string error = failure.GetErrorString(); |
474 | 477 |
475 if (!online_succeeded_for_.empty()) { | 478 if (failure.reason() == LoginFailure::OWNER_REQUIRED) { |
| 479 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); |
| 480 content::BrowserThread::PostDelayedTask( |
| 481 content::BrowserThread::UI, FROM_HERE, |
| 482 base::Bind(&SessionManagerClient::StopSession, |
| 483 base::Unretained(DBusThreadManager::Get()-> |
| 484 GetSessionManagerClient())), |
| 485 kSafeModeRestartUiDelayMs); |
| 486 } else if (!online_succeeded_for_.empty()) { |
476 ShowGaiaPasswordChanged(online_succeeded_for_); | 487 ShowGaiaPasswordChanged(online_succeeded_for_); |
477 } else { | 488 } else { |
478 // Check networking after trying to login in case user is | 489 // Check networking after trying to login in case user is |
479 // cached locally or the local admin account. | 490 // cached locally or the local admin account. |
480 bool is_known_user = | 491 bool is_known_user = |
481 UserManager::Get()->IsKnownUser(last_login_attempt_username_); | 492 UserManager::Get()->IsKnownUser(last_login_attempt_username_); |
482 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); | 493 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
483 if (!network) { | 494 if (!network) { |
484 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); | 495 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); |
485 } else if (!network->Connected()) { | 496 } else if (!network->Connected()) { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 // changed. | 813 // changed. |
803 UserManager::Get()->SaveUserOAuthStatus(username, | 814 UserManager::Get()->SaveUserOAuthStatus(username, |
804 User::OAUTH_TOKEN_STATUS_INVALID); | 815 User::OAUTH_TOKEN_STATUS_INVALID); |
805 | 816 |
806 login_display_->SetUIEnabled(true); | 817 login_display_->SetUIEnabled(true); |
807 SetStatusAreaEnabled(true); | 818 SetStatusAreaEnabled(true); |
808 login_display_->ShowGaiaPasswordChanged(username); | 819 login_display_->ShowGaiaPasswordChanged(username); |
809 } | 820 } |
810 | 821 |
811 } // namespace chromeos | 822 } // namespace chromeos |
OLD | NEW |