| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 284 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
| 285 guest_mode_url_ = GURL::EmptyGURL(); | 285 guest_mode_url_ = GURL::EmptyGURL(); |
| 286 std::string error = failure.GetErrorString(); | 286 std::string error = failure.GetErrorString(); |
| 287 | 287 |
| 288 // Check networking after trying to login in case user is | 288 // Check networking after trying to login in case user is |
| 289 // cached locally or the local admin account. | 289 // cached locally or the local admin account. |
| 290 bool is_known_user = | 290 bool is_known_user = |
| 291 UserManager::Get()->IsKnownUser(last_login_attempt_username_); | 291 UserManager::Get()->IsKnownUser(last_login_attempt_username_); |
| 292 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); | 292 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 293 if (!network || !CrosLibrary::Get()->EnsureLoaded()) { | 293 if (!network) { |
| 294 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); | 294 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); |
| 295 } else if (!network->Connected()) { | 295 } else if (!network->Connected()) { |
| 296 if (is_known_user) | 296 if (is_known_user) |
| 297 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 297 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| 298 else | 298 else |
| 299 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); | 299 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); |
| 300 } else { | 300 } else { |
| 301 // Network is connected. | 301 // Network is connected. |
| 302 const Network* active_network = network->active_network(); | 302 const Network* active_network = network->active_network(); |
| 303 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && | 303 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 void ExistingUserController::SetOwnerUserInCryptohome() { | 581 void ExistingUserController::SetOwnerUserInCryptohome() { |
| 582 bool trusted_owner_available = user_settings_->RequestTrustedOwner( | 582 bool trusted_owner_available = user_settings_->RequestTrustedOwner( |
| 583 base::Bind(&ExistingUserController::SetOwnerUserInCryptohome, | 583 base::Bind(&ExistingUserController::SetOwnerUserInCryptohome, |
| 584 weak_factory_.GetWeakPtr())); | 584 weak_factory_.GetWeakPtr())); |
| 585 if (!trusted_owner_available) { | 585 if (!trusted_owner_available) { |
| 586 // Value of owner email is still not verified. | 586 // Value of owner email is still not verified. |
| 587 // Another attempt will be invoked after verification completion. | 587 // Another attempt will be invoked after verification completion. |
| 588 return; | 588 return; |
| 589 } | 589 } |
| 590 if (CrosLibrary::Get()->EnsureLoaded()) { | 590 CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary(); |
| 591 CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary(); | 591 cryptohomed->AsyncSetOwnerUser( |
| 592 cryptohomed->AsyncSetOwnerUser( | 592 UserCrosSettingsProvider::cached_owner(), NULL); |
| 593 UserCrosSettingsProvider::cached_owner(), NULL); | |
| 594 | 593 |
| 595 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here | 594 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here |
| 596 // so it does not delay the following mount. Cleanup will be | 595 // so it does not delay the following mount. Cleanup will be |
| 597 // started in Cryptohomed by timer. | 596 // started in Cryptohomed by timer. |
| 598 } | |
| 599 } | 597 } |
| 600 | 598 |
| 601 } // namespace chromeos | 599 } // namespace chromeos |
| OLD | NEW |