| 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/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 void ParallelAuthenticator::OnLoginSuccess( | 125 void ParallelAuthenticator::OnLoginSuccess( |
| 126 const GaiaAuthConsumer::ClientLoginResult& credentials, | 126 const GaiaAuthConsumer::ClientLoginResult& credentials, |
| 127 bool request_pending) { | 127 bool request_pending) { |
| 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 129 VLOG(1) << "Login success"; | 129 VLOG(1) << "Login success"; |
| 130 // Send notification of success | 130 // Send notification of success |
| 131 AuthenticationNotificationDetails details(true); | 131 AuthenticationNotificationDetails details(true); |
| 132 NotificationService::current()->Notify( | 132 NotificationService::current()->Notify( |
| 133 NotificationType::LOGIN_AUTHENTICATION, | 133 chrome::LOGIN_AUTHENTICATION, |
| 134 NotificationService::AllSources(), | 134 NotificationService::AllSources(), |
| 135 Details<AuthenticationNotificationDetails>(&details)); | 135 Details<AuthenticationNotificationDetails>(&details)); |
| 136 { | 136 { |
| 137 base::AutoLock for_this_block(success_lock_); | 137 base::AutoLock for_this_block(success_lock_); |
| 138 already_reported_success_ = true; | 138 already_reported_success_ = true; |
| 139 } | 139 } |
| 140 consumer_->OnLoginSuccess(current_state_->username, | 140 consumer_->OnLoginSuccess(current_state_->username, |
| 141 current_state_->password, | 141 current_state_->password, |
| 142 credentials, | 142 credentials, |
| 143 request_pending); | 143 request_pending); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void ParallelAuthenticator::OnOffTheRecordLoginSuccess() { | 146 void ParallelAuthenticator::OnOffTheRecordLoginSuccess() { |
| 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 148 // Send notification of success | 148 // Send notification of success |
| 149 AuthenticationNotificationDetails details(true); | 149 AuthenticationNotificationDetails details(true); |
| 150 NotificationService::current()->Notify( | 150 NotificationService::current()->Notify( |
| 151 NotificationType::LOGIN_AUTHENTICATION, | 151 chrome::LOGIN_AUTHENTICATION, |
| 152 NotificationService::AllSources(), | 152 NotificationService::AllSources(), |
| 153 Details<AuthenticationNotificationDetails>(&details)); | 153 Details<AuthenticationNotificationDetails>(&details)); |
| 154 consumer_->OnOffTheRecordLoginSuccess(); | 154 consumer_->OnOffTheRecordLoginSuccess(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ParallelAuthenticator::OnPasswordChangeDetected( | 157 void ParallelAuthenticator::OnPasswordChangeDetected( |
| 158 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 158 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
| 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 160 consumer_->OnPasswordChangeDetected(credentials); | 160 consumer_->OnPasswordChangeDetected(credentials); |
| 161 } | 161 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 BrowserThread::UI, FROM_HERE, | 195 BrowserThread::UI, FROM_HERE, |
| 196 NewRunnableMethod(this, &ParallelAuthenticator::OnLoginFailure, error)); | 196 NewRunnableMethod(this, &ParallelAuthenticator::OnLoginFailure, error)); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) { | 200 void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) { |
| 201 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 201 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 202 // Send notification of failure | 202 // Send notification of failure |
| 203 AuthenticationNotificationDetails details(false); | 203 AuthenticationNotificationDetails details(false); |
| 204 NotificationService::current()->Notify( | 204 NotificationService::current()->Notify( |
| 205 NotificationType::LOGIN_AUTHENTICATION, | 205 chrome::LOGIN_AUTHENTICATION, |
| 206 NotificationService::AllSources(), | 206 NotificationService::AllSources(), |
| 207 Details<AuthenticationNotificationDetails>(&details)); | 207 Details<AuthenticationNotificationDetails>(&details)); |
| 208 LOG(WARNING) << "Login failed: " << error.GetErrorString(); | 208 LOG(WARNING) << "Login failed: " << error.GetErrorString(); |
| 209 consumer_->OnLoginFailure(error); | 209 consumer_->OnLoginFailure(error); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void ParallelAuthenticator::RecoverEncryptedData( | 212 void ParallelAuthenticator::RecoverEncryptedData( |
| 213 const std::string& old_password, | 213 const std::string& old_password, |
| 214 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 214 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
| 215 std::string old_hash = HashPassword(old_password); | 215 std::string old_hash = HashPassword(old_password); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 const unsigned int len) { | 629 const unsigned int len) { |
| 630 if (len < 2*binary_len) | 630 if (len < 2*binary_len) |
| 631 return false; | 631 return false; |
| 632 memset(hex_string, 0, len); | 632 memset(hex_string, 0, len); |
| 633 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) | 633 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) |
| 634 snprintf(hex_string + j, len - j, "%02x", binary[i]); | 634 snprintf(hex_string + j, len - j, "%02x", binary[i]); |
| 635 return true; | 635 return true; |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace chromeos | 638 } // namespace chromeos |
| OLD | NEW |