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/login_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 initial_online_auth_pending_ = false; | 103 initial_online_auth_pending_ = false; |
104 | 104 |
105 // Offline auth - OK, online auth - failed. | 105 // Offline auth - OK, online auth - failed. |
106 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED) { | 106 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED) { |
107 ResolveInitialNetworkAuthFailure(); | 107 ResolveInitialNetworkAuthFailure(); |
108 } else if (failure.reason() == LoginFailure::LOGIN_TIMED_OUT) { | 108 } else if (failure.reason() == LoginFailure::LOGIN_TIMED_OUT) { |
109 VLOG(1) << "Online login timed out. " | 109 VLOG(1) << "Online login timed out. " |
110 << "Granting user access based on offline auth only."; | 110 << "Granting user access based on offline auth only."; |
111 // ScreenLock is not active, it's ok to delete itself. | 111 // ScreenLock is not active, it's ok to delete itself. |
112 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 112 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
113 } else { | 113 } else { |
114 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: | 114 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: |
115 // happens during offline auth only. | 115 // happens during offline auth only. |
116 // UNLOCK_FAILED is used during normal screen lock case. | 116 // UNLOCK_FAILED is used during normal screen lock case. |
117 // TODO(nkostylev) DATA_REMOVAL_FAILED - ? | 117 // TODO(nkostylev) DATA_REMOVAL_FAILED - ? |
118 NOTREACHED(); | 118 NOTREACHED(); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 void LoginPerformer::OnRetailModeLoginSuccess( | 122 void LoginPerformer::OnRetailModeLoginSuccess( |
(...skipping 20 matching lines...) Expand all Loading... |
143 | 143 |
144 VLOG(1) << "LoginSuccess hash: " << user_context.username_hash | 144 VLOG(1) << "LoginSuccess hash: " << user_context.username_hash |
145 << ", pending_requests " << pending_requests; | 145 << ", pending_requests " << pending_requests; |
146 DCHECK(delegate_); | 146 DCHECK(delegate_); |
147 // After delegate_->OnLoginSuccess(...) is called, delegate_ releases | 147 // After delegate_->OnLoginSuccess(...) is called, delegate_ releases |
148 // LoginPerformer ownership. LP now manages it's lifetime on its own. | 148 // LoginPerformer ownership. LP now manages it's lifetime on its own. |
149 // 2 things could make it exist longer: | 149 // 2 things could make it exist longer: |
150 // 1. ScreenLock active (pending correct new password input) | 150 // 1. ScreenLock active (pending correct new password input) |
151 // 2. Pending online auth request. | 151 // 2. Pending online auth request. |
152 if (!pending_requests) | 152 if (!pending_requests) |
153 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 153 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
154 else | 154 else |
155 initial_online_auth_pending_ = true; | 155 initial_online_auth_pending_ = true; |
156 | 156 |
157 delegate_->OnLoginSuccess(user_context, | 157 delegate_->OnLoginSuccess(user_context, |
158 pending_requests, | 158 pending_requests, |
159 using_oauth); | 159 using_oauth); |
160 } | 160 } |
161 | 161 |
162 void LoginPerformer::OnOffTheRecordLoginSuccess() { | 162 void LoginPerformer::OnOffTheRecordLoginSuccess() { |
163 content::RecordAction( | 163 content::RecordAction( |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 case GoogleServiceAuthError::CONNECTION_FAILED: | 368 case GoogleServiceAuthError::CONNECTION_FAILED: |
369 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: | 369 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: |
370 case GoogleServiceAuthError::TWO_FACTOR: | 370 case GoogleServiceAuthError::TWO_FACTOR: |
371 case GoogleServiceAuthError::REQUEST_CANCELED: | 371 case GoogleServiceAuthError::REQUEST_CANCELED: |
372 // Offline auth already done. Online auth will be done next time | 372 // Offline auth already done. Online auth will be done next time |
373 // or once user accesses web property. | 373 // or once user accesses web property. |
374 VLOG(1) << "Granting user access based on offline auth only. " | 374 VLOG(1) << "Granting user access based on offline auth only. " |
375 << "Online login failed with " | 375 << "Online login failed with " |
376 << last_login_failure_.error().state(); | 376 << last_login_failure_.error().state(); |
377 // Resolving initial online auth failure, no ScreenLock is active. | 377 // Resolving initial online auth failure, no ScreenLock is active. |
378 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 378 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
379 return; | 379 return; |
380 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: | 380 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: |
381 // Offline auth OK, so it might be the case of changed password. | 381 // Offline auth OK, so it might be the case of changed password. |
382 password_changed_ = true; | 382 password_changed_ = true; |
383 case GoogleServiceAuthError::USER_NOT_SIGNED_UP: | 383 case GoogleServiceAuthError::USER_NOT_SIGNED_UP: |
384 case GoogleServiceAuthError::ACCOUNT_DELETED: | 384 case GoogleServiceAuthError::ACCOUNT_DELETED: |
385 case GoogleServiceAuthError::ACCOUNT_DISABLED: | 385 case GoogleServiceAuthError::ACCOUNT_DISABLED: |
386 // Access not granted. User has to sign out. | 386 // Access not granted. User has to sign out. |
387 // Request screen lock & show error message there. | 387 // Request screen lock & show error message there. |
388 case GoogleServiceAuthError::CAPTCHA_REQUIRED: | 388 case GoogleServiceAuthError::CAPTCHA_REQUIRED: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 void LoginPerformer::ResolveScreenLocked() { | 467 void LoginPerformer::ResolveScreenLocked() { |
468 DVLOG(1) << "Screen locked"; | 468 DVLOG(1) << "Screen locked"; |
469 ResolveLockNetworkAuthFailure(); | 469 ResolveLockNetworkAuthFailure(); |
470 } | 470 } |
471 | 471 |
472 void LoginPerformer::ResolveScreenUnlocked() { | 472 void LoginPerformer::ResolveScreenUnlocked() { |
473 DVLOG(1) << "Screen unlocked"; | 473 DVLOG(1) << "Screen unlocked"; |
474 registrar_.RemoveAll(); | 474 registrar_.RemoveAll(); |
475 // If screen was unlocked that was for a reason, should delete itself now. | 475 // If screen was unlocked that was for a reason, should delete itself now. |
476 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 476 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
477 } | 477 } |
478 | 478 |
479 void LoginPerformer::StartLoginCompletion() { | 479 void LoginPerformer::StartLoginCompletion() { |
480 DVLOG(1) << "Login completion started"; | 480 DVLOG(1) << "Login completion started"; |
481 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); | 481 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); |
482 Profile* profile = ProfileHelper::GetSigninProfile(); | 482 Profile* profile = ProfileHelper::GetSigninProfile(); |
483 | 483 |
484 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 484 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
485 BrowserThread::PostTask( | 485 BrowserThread::PostTask( |
486 BrowserThread::UI, FROM_HERE, | 486 BrowserThread::UI, FROM_HERE, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 profile, | 519 profile, |
520 user_context_, | 520 user_context_, |
521 std::string(), | 521 std::string(), |
522 std::string())); | 522 std::string())); |
523 } | 523 } |
524 user_context_.password.clear(); | 524 user_context_.password.clear(); |
525 user_context_.auth_code.clear(); | 525 user_context_.auth_code.clear(); |
526 } | 526 } |
527 | 527 |
528 } // namespace chromeos | 528 } // namespace chromeos |
OLD | NEW |